Diff
Modified: trunk/Source/WebCore/ChangeLog (107262 => 107263)
--- trunk/Source/WebCore/ChangeLog 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/ChangeLog 2012-02-09 19:11:57 UTC (rev 107263)
@@ -1,3 +1,62 @@
+2012-02-09 David Barton <[email protected]>
+
+ MathML internals for bug 52444 fix - type checking, PassRefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=78180
+
+ Reviewed by Eric Seidel.
+
+ static_cast<Element*>(node()) is done in methods in RenderMathMLFenced.cpp and a few
+ other files. It is more type-safe if the RenderMathMLFenced() or other constructor only
+ accepts an Element*, not a Node*. Also a couple functions were changed to return a
+ PassRefPtr instead of a RefPtr.
+
+ No new tests.
+
+ * rendering/mathml/RenderMathMLFenced.cpp:
+ (WebCore::RenderMathMLFenced::RenderMathMLFenced):
+ (WebCore::RenderMathMLFenced::updateFromElement):
+ (WebCore::RenderMathMLFenced::makeOperatorStyle):
+ (WebCore::RenderMathMLFenced::makeFences):
+ (WebCore::RenderMathMLFenced::addChild):
+ * rendering/mathml/RenderMathMLFenced.h:
+ (RenderMathMLFenced):
+ * rendering/mathml/RenderMathMLFraction.cpp:
+ (WebCore::RenderMathMLFraction::RenderMathMLFraction):
+ * rendering/mathml/RenderMathMLFraction.h:
+ (RenderMathMLFraction):
+ * rendering/mathml/RenderMathMLMath.cpp:
+ (WebCore::RenderMathMLMath::RenderMathMLMath):
+ * rendering/mathml/RenderMathMLMath.h:
+ (RenderMathMLMath):
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::RenderMathMLOperator):
+ (WebCore::RenderMathMLOperator::updateFromElement):
+ (WebCore::RenderMathMLOperator::createStackableStyle):
+ (WebCore::RenderMathMLOperator::createGlyph):
+ * rendering/mathml/RenderMathMLOperator.h:
+ (RenderMathMLOperator):
+ * rendering/mathml/RenderMathMLRoot.cpp:
+ (WebCore::RenderMathMLRoot::RenderMathMLRoot):
+ (WebCore::RenderMathMLRoot::layout):
+ * rendering/mathml/RenderMathMLRoot.h:
+ (RenderMathMLRoot):
+ * rendering/mathml/RenderMathMLRow.cpp:
+ (WebCore::RenderMathMLRow::RenderMathMLRow):
+ * rendering/mathml/RenderMathMLRow.h:
+ (RenderMathMLRow):
+ * rendering/mathml/RenderMathMLSquareRoot.cpp:
+ (WebCore::RenderMathMLSquareRoot::RenderMathMLSquareRoot):
+ * rendering/mathml/RenderMathMLSquareRoot.h:
+ (RenderMathMLSquareRoot):
+ * rendering/mathml/RenderMathMLSubSup.cpp:
+ (WebCore::RenderMathMLSubSup::addChild):
+ * rendering/mathml/RenderMathMLSubSup.h:
+ (RenderMathMLSubSup):
+ * rendering/mathml/RenderMathMLUnderOver.cpp:
+ (WebCore::RenderMathMLUnderOver::RenderMathMLUnderOver):
+ * rendering/mathml/RenderMathMLUnderOver.h:
+ (RenderMathMLUnderOver):
+
2012-02-09 Andreas Kling <[email protected]>
Avoid unnecessary work when evaluating style sharing candidates.
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -44,8 +44,8 @@
static const float gOperatorPadding = 0.1f;
-RenderMathMLFenced::RenderMathMLFenced(Node* fenced)
- : RenderMathMLRow(fenced)
+RenderMathMLFenced::RenderMathMLFenced(Element* element)
+ : RenderMathMLRow(element)
, m_open(OpeningBraceChar)
, m_close(ClosingBraceChar)
{
@@ -63,7 +63,7 @@
if (closeValue.length() > 0)
m_close = closeValue[0];
- AtomicString separators = static_cast<Element*>(fenced)->getAttribute(MathMLNames::separatorsAttr);
+ AtomicString separators = fenced->getAttribute(MathMLNames::separatorsAttr);
if (!separators.isNull()) {
StringBuilder characters;
for (unsigned int i = 0; i < separators.length(); i++) {
@@ -80,22 +80,22 @@
makeFences();
}
-RefPtr<RenderStyle> RenderMathMLFenced::makeOperatorStyle()
+PassRefPtr<RenderStyle> RenderMathMLFenced::makeOperatorStyle()
{
RefPtr<RenderStyle> newStyle = RenderStyle::create();
newStyle->inheritFrom(style());
newStyle->setDisplay(INLINE_BLOCK);
newStyle->setPaddingRight(Length(static_cast<int>(gOperatorPadding * style()->fontSize()), Fixed));
- return newStyle;
+ return newStyle.release();
}
void RenderMathMLFenced::makeFences()
{
RenderObject* openFence = new (renderArena()) RenderMathMLOperator(node(), m_open);
- openFence->setStyle(makeOperatorStyle().release());
+ openFence->setStyle(makeOperatorStyle());
RenderBlock::addChild(openFence, firstChild());
RenderObject* closeFence = new (renderArena()) RenderMathMLOperator(node(), m_close);
- closeFence->setStyle(makeOperatorStyle().release());
+ closeFence->setStyle(makeOperatorStyle());
RenderBlock::addChild(closeFence);
}
@@ -122,7 +122,7 @@
separator = (*m_separators.get())[count - 2];
RenderObject* separatorObj = new (renderArena()) RenderMathMLOperator(node(), separator);
- separatorObj->setStyle(makeOperatorStyle().release());
+ separatorObj->setStyle(makeOperatorStyle());
RenderBlock::addChild(separatorObj, lastChild());
}
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,15 +34,16 @@
class RenderMathMLFenced : public RenderMathMLRow {
public:
- RenderMathMLFenced(Node *fraction);
+ RenderMathMLFenced(Element*);
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
virtual void updateFromElement();
private:
virtual const char* renderName() const { return "RenderMathMLFenced"; }
+ PassRefPtr<RenderStyle> makeOperatorStyle();
void makeFences();
- RefPtr<RenderStyle> makeOperatorStyle();
+
UChar m_open;
UChar m_close;
RefPtr<StringImpl> m_separators;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -46,8 +46,8 @@
static const float gFractionBarWidth = 0.05f;
static const float gDenominatorPad = 0.1f;
-RenderMathMLFraction::RenderMathMLFraction(Element* fraction)
- : RenderMathMLBlock(fraction)
+RenderMathMLFraction::RenderMathMLFraction(Element* element)
+ : RenderMathMLBlock(element)
, m_lineThickness(gLineMedium)
{
setChildrenInline(false);
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -35,7 +35,7 @@
class RenderMathMLFraction : public RenderMathMLBlock {
public:
- RenderMathMLFraction(Element* fraction);
+ RenderMathMLFraction(Element*);
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
virtual void updateFromElement();
virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
@@ -44,6 +44,7 @@
virtual void layout();
private:
virtual const char* renderName() const { return "RenderMathMLFraction"; }
+
float m_lineThickness;
};
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -35,8 +35,8 @@
using namespace MathMLNames;
-RenderMathMLMath::RenderMathMLMath(Node* math)
- : RenderMathMLRow(math)
+RenderMathMLMath::RenderMathMLMath(Element* element)
+ : RenderMathMLRow(element)
{
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,7 +34,7 @@
class RenderMathMLMath : public RenderMathMLRow {
public:
- RenderMathMLMath(Node* container);
+ RenderMathMLMath(Element*);
virtual bool isRenderMathMLMath() const { return true; }
private:
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -38,15 +38,15 @@
using namespace MathMLNames;
-RenderMathMLOperator::RenderMathMLOperator(Node* container)
- : RenderMathMLBlock(container)
+RenderMathMLOperator::RenderMathMLOperator(Element* element)
+ : RenderMathMLBlock(element)
, m_stretchHeight(0)
, m_operator(0)
{
}
-RenderMathMLOperator::RenderMathMLOperator(Node* container, UChar operatorChar)
- : RenderMathMLBlock(container)
+RenderMathMLOperator::RenderMathMLOperator(Node* node, UChar operatorChar)
+ : RenderMathMLBlock(node)
, m_stretchHeight(0)
, m_operator(convertHyphenMinusToMinusSign(operatorChar))
{
@@ -139,7 +139,7 @@
// This boolean indicates whether stretching is disabled via the markup.
bool stretchDisabled = false;
- // We made need the element later if we can't stretch.
+ // We may need the element later if we can't stretch.
if (node()->nodeType() == Node::ELEMENT_NODE) {
if (Element* mo = static_cast<Element*>(node())) {
AtomicString stretchyAttr = mo->getAttribute(MathMLNames::stretchyAttr);
@@ -282,7 +282,7 @@
}
}
-RefPtr<RenderStyle> RenderMathMLOperator::createStackableStyle(int size, int topRelative)
+PassRefPtr<RenderStyle> RenderMathMLOperator::createStackableStyle(int size, int topRelative)
{
RefPtr<RenderStyle> newStyle = RenderStyle::create();
newStyle->inheritFrom(style());
@@ -307,13 +307,13 @@
newStyle->setPosition(RelativePosition);
}
- return newStyle;
+ return newStyle.release();
}
RenderBlock* RenderMathMLOperator::createGlyph(UChar glyph, int size, int charRelative, int topRelative)
{
RenderBlock* container = new (renderArena()) RenderMathMLBlock(node());
- container->setStyle(createStackableStyle(size, topRelative).release());
+ container->setStyle(createStackableStyle(size, topRelative));
addChild(container);
RenderBlock* parent = container;
if (charRelative) {
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -35,8 +35,8 @@
class RenderMathMLOperator : public RenderMathMLBlock {
public:
- RenderMathMLOperator(Node* container);
- RenderMathMLOperator(Node* container, UChar operatorChar);
+ RenderMathMLOperator(Element*);
+ RenderMathMLOperator(Node*, UChar operatorChar);
virtual bool isRenderMathMLOperator() const { return true; }
virtual void stretchToHeight(int pixelHeight);
virtual void updateFromElement();
@@ -45,7 +45,7 @@
protected:
virtual void layout();
- virtual RefPtr<RenderStyle> createStackableStyle(int size, int topRelative);
+ virtual PassRefPtr<RenderStyle> createStackableStyle(int size, int topRelative);
virtual RenderBlock* createGlyph(UChar glyph, int size = 0, int charRelative = 0, int topRelative = 0);
private:
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -64,8 +64,8 @@
// Radical thick line thickness (%)
const float gRadicalThickLineThickness = 0.1f;
-RenderMathMLRoot::RenderMathMLRoot(Node *_expression_)
-: RenderMathMLBlock(_expression_)
+RenderMathMLRoot::RenderMathMLRoot(Element* element)
+ : RenderMathMLBlock(element)
{
}
@@ -232,7 +232,8 @@
LayoutUnit indexShift = indexBox->offsetWidth() + topStartShift;
LayoutUnit radicalHeight = static_cast<LayoutUnit>((1 - gRadicalTopLeftPointYPos) * maxHeight);
- LayoutUnit rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->offsetHeight() - (maxHeight + static_cast<LayoutUnit>(gRootPadding * style()->fontSize()));
+ LayoutUnit rootMarginTop = radicalHeight + style()->paddingBottom().value() + indexBox->offsetHeight()
+ - (maxHeight + static_cast<LayoutUnit>(gRootPadding * style()->fontSize()));
style()->setPaddingLeft(Length(indexShift, Fixed));
if (rootMarginTop > 0)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,7 +34,7 @@
class RenderMathMLRoot : public RenderMathMLBlock {
public:
- RenderMathMLRoot(Node* fraction);
+ RenderMathMLRoot(Element*);
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
virtual void paint(PaintInfo&, const LayoutPoint&);
protected:
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -36,8 +36,8 @@
using namespace MathMLNames;
-RenderMathMLRow::RenderMathMLRow(Node* row)
- : RenderMathMLBlock(row)
+RenderMathMLRow::RenderMathMLRow(Element* element)
+ : RenderMathMLBlock(element)
{
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,7 +34,7 @@
class RenderMathMLRow : public RenderMathMLBlock {
public:
- RenderMathMLRow(Node* container);
+ RenderMathMLRow(Element*);
virtual bool isRenderMathMLRow() const { return true; }
virtual int nonOperatorHeight() const;
virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -61,8 +61,8 @@
// Radical thick line thickness (%)
const float gRadicalThickLineThickness = 0.1f;
-RenderMathMLSquareRoot::RenderMathMLSquareRoot(Node *_expression_)
- : RenderMathMLBlock(_expression_)
+RenderMathMLSquareRoot::RenderMathMLSquareRoot(Element* element)
+ : RenderMathMLBlock(element)
{
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,7 +34,7 @@
class RenderMathMLSquareRoot : public RenderMathMLBlock {
public:
- RenderMathMLSquareRoot(Node* fraction);
+ RenderMathMLSquareRoot(Element*);
virtual void paint(PaintInfo&, const LayoutPoint&);
protected:
virtual void layout();
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -56,7 +56,6 @@
void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild)
{
-
// Note: The RenderMathMLBlock only allows element children to be added.
Element* childElement = toElement(child->node());
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,7 +34,7 @@
class RenderMathMLSubSup : public RenderMathMLBlock {
public:
- RenderMathMLSubSup(Element* fraction);
+ RenderMathMLSubSup(Element*);
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
virtual bool hasBase() const { return true; }
virtual int nonOperatorHeight() const;
@@ -57,4 +57,3 @@
#endif // ENABLE(MATHML)
#endif // RenderMathMLSubSup_h
-
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp 2012-02-09 19:11:57 UTC (rev 107263)
@@ -38,10 +38,9 @@
static const double gOverSpacingAdjustment = 0.5;
-RenderMathMLUnderOver::RenderMathMLUnderOver(Node* _expression_)
- : RenderMathMLBlock(_expression_)
+RenderMathMLUnderOver::RenderMathMLUnderOver(Element* element)
+ : RenderMathMLBlock(element)
{
- Element* element = static_cast<Element*>(_expression_);
// Determine what kind of under/over _expression_ we have by element name
if (element->hasLocalName(MathMLNames::munderTag))
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h (107262 => 107263)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h 2012-02-09 19:01:07 UTC (rev 107262)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h 2012-02-09 19:11:57 UTC (rev 107263)
@@ -34,7 +34,7 @@
class RenderMathMLUnderOver : public RenderMathMLBlock {
public:
- RenderMathMLUnderOver(Node* _expression_);
+ RenderMathMLUnderOver(Element*);
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
virtual void layout();
virtual bool hasBase() const { return true; }