summaryrefslogtreecommitdiffstats
path: root/layout
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-02-07 09:52:57 +0100
committerGitHub <noreply@github.com>2020-02-07 09:52:57 +0100
commita6ef90b1830e263fefda7bcb6e7b74464044a678 (patch)
tree85fc59a89d370d98e2c132e2b4b77343eb507ff0 /layout
parent99aa809cb850a19d09cb7fc3b92899085b4b447e (diff)
parent3a7d5d01cccf6abb3b83db8cf31ca213724f3ee7 (diff)
downloadUXP-a6ef90b1830e263fefda7bcb6e7b74464044a678.tar
UXP-a6ef90b1830e263fefda7bcb6e7b74464044a678.tar.gz
UXP-a6ef90b1830e263fefda7bcb6e7b74464044a678.tar.lz
UXP-a6ef90b1830e263fefda7bcb6e7b74464044a678.tar.xz
UXP-a6ef90b1830e263fefda7bcb6e7b74464044a678.zip
Merge pull request #1388 from win7-7/devirtualize-pr
Merging this in even without a test performed since the code change looks sane. real-world testing will have to be performed.
Diffstat (limited to 'layout')
-rw-r--r--layout/mathml/nsMathMLmtableFrame.cpp41
-rw-r--r--layout/mathml/nsMathMLmtableFrame.h2
-rw-r--r--layout/tables/celldata.h6
-rw-r--r--layout/tables/nsITableCellLayout.h4
-rw-r--r--layout/tables/nsTableCellFrame.cpp26
-rw-r--r--layout/tables/nsTableCellFrame.h6
6 files changed, 24 insertions, 61 deletions
diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp
index fd184e637..1ff8a28ef 100644
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -1160,47 +1160,6 @@ nsMathMLmtdFrame::Init(nsIContent* aContent,
RemoveStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
}
-int32_t
-nsMathMLmtdFrame::GetRowSpan()
-{
- int32_t rowspan = 1;
-
- // Don't look at the content's rowspan if we're not an mtd or a pseudo cell.
- if (mContent->IsMathMLElement(nsGkAtoms::mtd_) &&
- !StyleContext()->GetPseudo()) {
- nsAutoString value;
- mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rowspan, value);
- if (!value.IsEmpty()) {
- nsresult error;
- rowspan = value.ToInteger(&error);
- if (NS_FAILED(error) || rowspan < 0)
- rowspan = 1;
- rowspan = std::min(rowspan, MAX_ROWSPAN);
- }
- }
- return rowspan;
-}
-
-int32_t
-nsMathMLmtdFrame::GetColSpan()
-{
- int32_t colspan = 1;
-
- // Don't look at the content's colspan if we're not an mtd or a pseudo cell.
- if (mContent->IsMathMLElement(nsGkAtoms::mtd_) &&
- !StyleContext()->GetPseudo()) {
- nsAutoString value;
- mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::columnspan_, value);
- if (!value.IsEmpty()) {
- nsresult error;
- colspan = value.ToInteger(&error);
- if (NS_FAILED(error) || colspan <= 0 || colspan > MAX_COLSPAN)
- colspan = 1;
- }
- }
- return colspan;
-}
-
nsresult
nsMathMLmtdFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
diff --git a/layout/mathml/nsMathMLmtableFrame.h b/layout/mathml/nsMathMLmtableFrame.h
index 5cb4fc4a2..725991c17 100644
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -257,8 +257,6 @@ public:
nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
- virtual int32_t GetRowSpan() override;
- virtual int32_t GetColSpan() override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
diff --git a/layout/tables/celldata.h b/layout/tables/celldata.h
index b744b5175..ac7be58d7 100644
--- a/layout/tables/celldata.h
+++ b/layout/tables/celldata.h
@@ -6,6 +6,7 @@
#define CellData_h__
#include "nsISupports.h"
+#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
#include "nsCoord.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/WritingModes.h"
@@ -15,11 +16,6 @@ class nsTableCellFrame;
class nsCellMap;
class BCCellData;
-
-#define MAX_ROWSPAN 65534 // the cellmap can not handle more.
-#define MAX_COLSPAN 1000 // limit as IE and opera do. If this ever changes,
- // change COL_SPAN_OFFSET/COL_SPAN_SHIFT accordingly.
-
/**
* Data stored by nsCellMap to rationalize rowspan and colspan cells.
*/
diff --git a/layout/tables/nsITableCellLayout.h b/layout/tables/nsITableCellLayout.h
index e761d76be..a366b150e 100644
--- a/layout/tables/nsITableCellLayout.h
+++ b/layout/tables/nsITableCellLayout.h
@@ -7,6 +7,10 @@
#include "nsQueryFrame.h"
+#define MAX_ROWSPAN 65534 // the cellmap can not handle more.
+#define MAX_COLSPAN 1000 // limit as IE and opera do. If this ever changes,
+// change COL_SPAN_OFFSET/COL_SPAN_SHIFT accordingly.
+
/**
* nsITableCellLayout
* interface for layout objects that act like table cells.
diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp
index 2862bb201..cd846efa2 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();
}
diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h
index e8dad5c20..ea527b3c5 100644
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -165,11 +165,11 @@ public:
/**
* return the cell's specified row span. this is what was specified in the
- * content model or in the style info, and is always >= 1.
+ * content model or in the style info, and is always >= 0.
* to get the effective row span (the actual value that applies), use GetEffectiveRowSpan()
* @see nsTableFrame::GetEffectiveRowSpan()
*/
- virtual int32_t GetRowSpan();
+ int32_t GetRowSpan();
// there is no set row index because row index depends on the cell's parent row only
@@ -191,7 +191,7 @@ public:
* to get the effective col span (the actual value that applies), use GetEffectiveColSpan()
* @see nsTableFrame::GetEffectiveColSpan()
*/
- virtual int32_t GetColSpan();
+ int32_t GetColSpan();
/** return the cell's column index (starting at 0 for the first column) */
virtual nsresult GetColIndex(int32_t &aColIndex) const override;