diff options
author | win7-7 <win7-7@users.noreply.github.com> | 2020-02-03 20:47:41 +0200 |
---|---|---|
committer | win7-7 <win7-7@users.noreply.github.com> | 2020-02-03 20:47:41 +0200 |
commit | 597a6996f14429d09a7c89b1f774d2490cca3dd6 (patch) | |
tree | 3dbc37b8f412d636abcb5b167f58f3fbb1faa2a0 /layout/tables/nsTableCellFrame.cpp | |
parent | c4e1022f578b264641f5e25fcef3069bdae7490e (diff) | |
download | UXP-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 'layout/tables/nsTableCellFrame.cpp')
-rw-r--r-- | layout/tables/nsTableCellFrame.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
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 <mtd>) 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 <mtd>) and table headers parse the "colspan" attribute + // into an integer. if (attr && attr->Type() == nsAttrValue::eInteger) { colSpan = attr->GetIntegerValue(); } |