Modified: trunk/Source/WebCore/ChangeLog (157598 => 157599)
--- trunk/Source/WebCore/ChangeLog 2013-10-17 21:14:46 UTC (rev 157598)
+++ trunk/Source/WebCore/ChangeLog 2013-10-17 21:21:02 UTC (rev 157599)
@@ -1,3 +1,15 @@
+2013-10-17 Andreas Kling <[email protected]>
+
+ CTTE: RenderMathMLOperator always has a MathMLElement.
+ <https://webkit.org/b/122988>
+
+ Reviewed by Antti Koivisto.
+
+ The renderer is never anonymous and always has a corresponding
+ MathMLElement. Overload element() with a tighter return type.
+
+ Also marked the class FINAL and made most methods private.
+
2013-10-17 Nico Weber <[email protected]>
Fix three bugs in the equals() implementations for css gradients.
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (157598 => 157599)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2013-10-17 21:14:46 UTC (rev 157598)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2013-10-17 21:21:02 UTC (rev 157599)
@@ -62,7 +62,7 @@
{ 0x222b, 0x2320, 0x23ae, 0x2321, 0x0 } // integral sign
};
-RenderMathMLOperator::RenderMathMLOperator(Element& element)
+RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element)
: RenderMathMLBlock(element)
, m_stretchHeight(0)
, m_operator(0)
@@ -71,7 +71,7 @@
{
}
-RenderMathMLOperator::RenderMathMLOperator(Element& element, UChar operatorChar)
+RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, UChar operatorChar)
: RenderMathMLBlock(element)
, m_stretchHeight(0)
, m_operator(convertHyphenMinusToMinusSign(operatorChar))
@@ -163,20 +163,20 @@
// dynamic DOM changes.
void RenderMathMLOperator::updateFromElement()
{
- RenderObject* savedRenderer = element()->renderer();
+ RenderElement* savedRenderer = element().renderer();
// Destroy our current children
destroyLeftoverChildren();
// Since we share a node with our children, destroying our children may set our node's
// renderer to 0, so we need to restore it.
- element()->setRenderer(savedRenderer);
+ element().setRenderer(savedRenderer);
RefPtr<RenderStyle> newStyle = RenderStyle::create();
newStyle->inheritFrom(style());
newStyle->setDisplay(FLEX);
- RenderMathMLBlock* container = new RenderMathMLBlock(*element());
+ RenderMathMLBlock* container = new RenderMathMLBlock(element());
// This container doesn't offer any useful information to accessibility.
container->setIgnoreInAccessibilityTree(true);
container->setStyle(newStyle.release());
@@ -186,7 +186,7 @@
if (m_operator)
text = new RenderText(document(), String(&m_operator, 1));
else
- text = new RenderText(document(), element()->textContent().replace(hyphenMinus, minusSign).impl());
+ text = new RenderText(document(), element().textContent().replace(hyphenMinus, minusSign).impl());
// If we can't figure out the text, leave it blank.
if (text)
@@ -198,8 +198,7 @@
bool RenderMathMLOperator::shouldAllowStretching(UChar& stretchedCharacter)
{
- Element* mo = element();
- if (equalIgnoringCase(mo->getAttribute(MathMLNames::stretchyAttr), "false"))
+ if (equalIgnoringCase(element().getAttribute(MathMLNames::stretchyAttr), "false"))
return false;
if (m_operator) {
@@ -208,7 +207,7 @@
}
// FIXME: This does not handle surrogate pairs (http://wkbug.com/122296/).
- String opText = mo->textContent();
+ String opText = element().textContent();
stretchedCharacter = 0;
for (unsigned i = 0; i < opText.length(); ++i) {
// If there's more than one non-whitespace character in this node, then don't even try to stretch it.
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (157598 => 157599)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2013-10-17 21:14:46 UTC (rev 157598)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2013-10-17 21:21:02 UTC (rev 157599)
@@ -28,30 +28,23 @@
#if ENABLE(MATHML)
+#include "MathMLElement.h"
#include "RenderMathMLBlock.h"
#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
-class RenderMathMLOperator : public RenderMathMLBlock {
+class RenderMathMLOperator FINAL : public RenderMathMLBlock {
public:
- RenderMathMLOperator(Element&);
- RenderMathMLOperator(Element&, UChar operatorChar);
+ RenderMathMLOperator(MathMLElement&);
+ RenderMathMLOperator(MathMLElement&, UChar operatorChar);
- virtual bool isRenderMathMLOperator() const OVERRIDE { return true; }
-
- virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const OVERRIDE;
- virtual void updateFromElement() OVERRIDE;
- virtual void computePreferredLogicalWidths() OVERRIDE;
- virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
-
- virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE { return this; }
+ MathMLElement& element() { return toMathMLElement(nodeForNonAnonymous()); }
+
void stretchToHeight(int pixelHeight);
int stretchHeight() { return m_stretchHeight; }
float expandedStretchHeight() const;
- virtual int firstLineBoxBaseline() const OVERRIDE;
-
enum OperatorType { Default, Separator, Fence };
void setOperatorType(OperatorType type) { m_operatorType = type; }
OperatorType operatorType() const { return m_operatorType; }
@@ -67,10 +60,18 @@
UChar middleGlyph;
};
+ virtual void updateFromElement() OVERRIDE;
+
private:
virtual const char* renderName() const OVERRIDE { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
- virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect);
+ virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) OVERRIDE;
+ virtual bool isRenderMathMLOperator() const OVERRIDE { return true; }
+ virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const OVERRIDE;
+ virtual void computePreferredLogicalWidths() OVERRIDE;
+ virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
+ virtual int firstLineBoxBaseline() const OVERRIDE;
+ virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE { return this; }
bool shouldAllowStretching(UChar& characterForStretching);
StretchyCharacter* findAcceptableStretchyCharacter(UChar);