From 597a6996f14429d09a7c89b1f774d2490cca3dd6 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Mon, 3 Feb 2020 20:47:41 +0200 Subject: 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. --- layout/tables/nsTableCellFrame.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'layout/tables/nsTableCellFrame.cpp') diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 2862bb201..d1736995e 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -711,16 +711,18 @@ nsTableCellFrame::GetCellBaseline() const borderPadding; } -int32_t nsTableCellFrame::GetRowSpan() +int32_t +nsTableCellFrame::GetRowSpan() { int32_t rowSpan=1; - nsGenericHTMLElement *hc = nsGenericHTMLElement::FromContent(mContent); // Don't look at the content's rowspan if we're a pseudo cell - if (hc && !StyleContext()->GetPseudo()) { - const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::rowspan); + if (!StyleContext()->GetPseudo()) { + dom::Element* elem = mContent->AsElement(); + const nsAttrValue* attr = elem->GetParsedAttr(nsGkAtoms::rowspan); // Note that we don't need to check the tag name, because only table cells - // and table headers parse the "rowspan" attribute into an integer. + // (including MathML ) and table headers parse the "rowspan" attribute + // into an integer. if (attr && attr->Type() == nsAttrValue::eInteger) { rowSpan = attr->GetIntegerValue(); } @@ -728,16 +730,20 @@ int32_t nsTableCellFrame::GetRowSpan() return rowSpan; } -int32_t nsTableCellFrame::GetColSpan() +int32_t +nsTableCellFrame::GetColSpan() { int32_t colSpan=1; - nsGenericHTMLElement *hc = nsGenericHTMLElement::FromContent(mContent); // Don't look at the content's colspan if we're a pseudo cell - if (hc && !StyleContext()->GetPseudo()) { - const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::colspan); + if (!StyleContext()->GetPseudo()) { + dom::Element* elem = mContent->AsElement(); + const nsAttrValue* attr = elem->GetParsedAttr( + MOZ_UNLIKELY(elem->IsMathMLElement()) ? nsGkAtoms::columnspan_ + : nsGkAtoms::colspan); // Note that we don't need to check the tag name, because only table cells - // and table headers parse the "colspan" attribute into an integer. + // (including MathML ) and table headers parse the "colspan" attribute + // into an integer. if (attr && attr->Type() == nsAttrValue::eInteger) { colSpan = attr->GetIntegerValue(); } -- cgit v1.2.3 From 3a7d5d01cccf6abb3b83db8cf31ca213724f3ee7 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Wed, 5 Feb 2020 16:57:42 +0200 Subject: fix whitespace fix whitespace. --- layout/tables/nsTableCellFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'layout/tables/nsTableCellFrame.cpp') diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index d1736995e..cd846efa2 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -740,7 +740,7 @@ nsTableCellFrame::GetColSpan() dom::Element* elem = mContent->AsElement(); const nsAttrValue* attr = elem->GetParsedAttr( MOZ_UNLIKELY(elem->IsMathMLElement()) ? nsGkAtoms::columnspan_ - : nsGkAtoms::colspan); + : nsGkAtoms::colspan); // Note that we don't need to check the tag name, because only table cells // (including MathML ) and table headers parse the "colspan" attribute // into an integer. -- cgit v1.2.3