Title: [157593] trunk/Source/WebCore
- Revision
- 157593
- Author
- [email protected]
- Date
- 2013-10-17 13:08:46 -0700 (Thu, 17 Oct 2013)
Log Message
CTTE: RenderMathMLFenced always has a MathMLInlineContainerElement.
<https://webkit.org/b/122986>
This renderer is never anonymous and always has a corresponding
MathMLInlineContainerElement. Overload element() with a tighter
return type.
Also marked the class FINAL and made most methods private.
Reviewed by Anders Carlsson.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (157592 => 157593)
--- trunk/Source/WebCore/ChangeLog 2013-10-17 20:04:03 UTC (rev 157592)
+++ trunk/Source/WebCore/ChangeLog 2013-10-17 20:08:46 UTC (rev 157593)
@@ -1,3 +1,16 @@
+2013-10-17 Andreas Kling <[email protected]>
+
+ CTTE: RenderMathMLFenced always has a MathMLInlineContainerElement.
+ <https://webkit.org/b/122986>
+
+ This renderer is never anonymous and always has a corresponding
+ MathMLInlineContainerElement. Overload element() with a tighter
+ return type.
+
+ Also marked the class FINAL and made most methods private.
+
+ Reviewed by Anders Carlsson.
+
2013-10-17 Myles C. Maxfield <[email protected]>
Comment AffineTransform::xScale() and yScale() to make their meanings clearer
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp (157592 => 157593)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2013-10-17 20:04:03 UTC (rev 157592)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2013-10-17 20:08:46 UTC (rev 157593)
@@ -45,7 +45,7 @@
static const float gSeparatorMarginEndEms = 0.25f;
static const float gFenceMarginEms = 0.1f;
-RenderMathMLFenced::RenderMathMLFenced(Element& element)
+RenderMathMLFenced::RenderMathMLFenced(MathMLInlineContainerElement& element)
: RenderMathMLRow(element)
, m_open(OpeningBraceChar)
, m_close(ClosingBraceChar)
@@ -55,17 +55,17 @@
void RenderMathMLFenced::updateFromElement()
{
- Element* fenced = element();
+ const auto& fenced = element();
// FIXME: Handle open/close values with more than one character (they should be treated like text).
- AtomicString openValue = fenced->getAttribute(MathMLNames::openAttr);
+ AtomicString openValue = fenced.getAttribute(MathMLNames::openAttr);
if (openValue.length() > 0)
m_open = openValue[0];
- AtomicString closeValue = fenced->getAttribute(MathMLNames::closeAttr);
+ AtomicString closeValue = fenced.getAttribute(MathMLNames::closeAttr);
if (closeValue.length() > 0)
m_close = closeValue[0];
- AtomicString separators = fenced->getAttribute(MathMLNames::separatorsAttr);
+ AtomicString separators = fenced.getAttribute(MathMLNames::separatorsAttr);
if (!separators.isNull()) {
StringBuilder characters;
for (unsigned int i = 0; i < separators.length(); i++) {
@@ -89,7 +89,7 @@
newStyle->setMarginEnd(Length((operatorType == RenderMathMLOperator::Fence ? gFenceMarginEms : gSeparatorMarginEndEms) * style()->fontSize(), Fixed));
if (operatorType == RenderMathMLOperator::Fence)
newStyle->setMarginStart(Length(gFenceMarginEms * style()->fontSize(), Fixed));
- RenderMathMLOperator* newOperator = new RenderMathMLOperator(*element(), uChar);
+ RenderMathMLOperator* newOperator = new RenderMathMLOperator(element(), uChar);
newOperator->setOperatorType(operatorType);
newOperator->setStyle(newStyle.release());
return newOperator;
@@ -159,15 +159,13 @@
RenderMathMLBlock::styleDidChange(diff, oldStyle);
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->node() == element()) {
+ if (child->node() == &element()) {
ASSERT(child->style()->refCount() == 1);
child->style()->inheritFrom(style());
bool isFence = child == firstChild() || child == lastChild();
child->style()->setMarginEnd(Length((isFence ? gFenceMarginEms : gSeparatorMarginEndEms) * style()->fontSize(), Fixed));
if (isFence) {
- ASSERT(child->isRenderMathMLBlock());
RenderMathMLBlock* block = toRenderMathMLBlock(child);
- ASSERT(block->isRenderMathMLOperator());
toRenderMathMLOperator(block)->updateFromElement();
child->style()->setMarginStart(Length(gFenceMarginEms * style()->fontSize(), Fixed));
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h (157592 => 157593)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2013-10-17 20:04:03 UTC (rev 157592)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2013-10-17 20:08:46 UTC (rev 157593)
@@ -28,25 +28,27 @@
#if ENABLE(MATHML)
+#include "MathMLInlineContainerElement.h"
#include "RenderMathMLOperator.h"
#include "RenderMathMLRow.h"
namespace WebCore {
-class RenderMathMLFenced : public RenderMathMLRow {
+class RenderMathMLFenced FINAL : public RenderMathMLRow {
public:
- explicit RenderMathMLFenced(Element&);
- virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
- virtual void updateFromElement();
+ explicit RenderMathMLFenced(MathMLInlineContainerElement&);
+ MathMLInlineContainerElement& element() { return static_cast<MathMLInlineContainerElement&>(nodeForNonAnonymous()); }
private:
- virtual bool isRenderMathMLFenced() const { return true; }
- virtual const char* renderName() const { return "RenderMathMLFenced"; }
+ virtual bool isRenderMathMLFenced() const OVERRIDE { return true; }
+ virtual const char* renderName() const OVERRIDE { return "RenderMathMLFenced"; }
+ virtual void addChild(RenderObject* child, RenderObject* beforeChild) OVERRIDE;
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
+ virtual void updateFromElement() OVERRIDE;
+
RenderMathMLOperator* createMathMLOperator(UChar, RenderMathMLOperator::OperatorType);
void makeFences();
-
- virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
UChar m_open;
UChar m_close;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes