summaryrefslogtreecommitdiffstats
path: root/dom/mathml/nsMathMLElement.cpp
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2020-02-03 20:47:41 +0200
committerwin7-7 <win7-7@users.noreply.github.com>2020-02-03 20:47:41 +0200
commit597a6996f14429d09a7c89b1f774d2490cca3dd6 (patch)
tree3dbc37b8f412d636abcb5b167f58f3fbb1faa2a0 /dom/mathml/nsMathMLElement.cpp
parentc4e1022f578b264641f5e25fcef3069bdae7490e (diff)
downloadUXP-597a6996f14429d09a7c89b1f774d2490cca3dd6.tar
UXP-597a6996f14429d09a7c89b1f774d2490cca3dd6.tar.gz
UXP-597a6996f14429d09a7c89b1f774d2490cca3dd6.tar.lz
UXP-597a6996f14429d09a7c89b1f774d2490cca3dd6.tar.xz
UXP-597a6996f14429d09a7c89b1f774d2490cca3dd6.zip
Issue #1386 - Devirtualize GetRowSpan/GetColSpan
It's at ~1.5% on the perf log for the Netflix use case, which seems a bit too much.
Diffstat (limited to 'dom/mathml/nsMathMLElement.cpp')
-rw-r--r--dom/mathml/nsMathMLElement.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/dom/mathml/nsMathMLElement.cpp b/dom/mathml/nsMathMLElement.cpp
index d6aef876c..2be931682 100644
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -9,6 +9,7 @@
#include "base/compiler_specific.h"
#include "mozilla/ArrayUtils.h"
#include "nsGkAtoms.h"
+#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
#include "nsCRT.h"
#include "nsLayoutStylesheetCache.h"
#include "nsRuleData.h"
@@ -150,8 +151,9 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
const nsAString& aValue,
nsAttrValue& aResult)
{
+ MOZ_ASSERT(IsMathMLElement());
if (aNamespaceID == kNameSpaceID_None) {
- if (IsMathMLElement(nsGkAtoms::math) && aAttribute == nsGkAtoms::mode) {
+ if (mNodeInfo->Equals(nsGkAtoms::math) && aAttribute == nsGkAtoms::mode) {
WarnDeprecated(nsGkAtoms::mode->GetUTF16String(),
nsGkAtoms::display->GetUTF16String(), OwnerDoc());
}
@@ -165,6 +167,16 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
aAttribute == nsGkAtoms::mathbackground_) {
return aResult.ParseColor(aValue);
}
+ if (mNodeInfo->Equals(nsGkAtoms::mtd_)) {
+ if (aAttribute == nsGkAtoms::columnspan_) {
+ aResult.ParseClampedNonNegativeInt(aValue, 1, 1, MAX_COLSPAN);
+ return true;
+ }
+ if (aAttribute == nsGkAtoms::rowspan) {
+ aResult.ParseClampedNonNegativeInt(aValue, 1, 0, MAX_ROWSPAN);
+ return true;
+ }
+ }
}
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
@@ -209,6 +221,8 @@ static Element::MappedAttributeEntry sDirStyles[] = {
bool
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
+ MOZ_ASSERT(IsMathMLElement());
+
static const MappedAttributeEntry* const mtableMap[] = {
sMtableStyles,
sCommonPresStyles
@@ -240,10 +254,10 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
if (IsAnyOfMathMLElements(nsGkAtoms::mstyle_, nsGkAtoms::math))
return FindAttributeDependence(aAttribute, mstyleMap);
- if (IsMathMLElement(nsGkAtoms::mtable_))
+ if (mNodeInfo->Equals(nsGkAtoms::mtable_))
return FindAttributeDependence(aAttribute, mtableMap);
- if (IsMathMLElement(nsGkAtoms::mrow_))
+ if (mNodeInfo->Equals(nsGkAtoms::mrow_))
return FindAttributeDependence(aAttribute, mrowMap);
if (IsAnyOfMathMLElements(nsGkAtoms::maction_,