Title: [157613] trunk/Source/WebCore
Revision
157613
Author
akl...@apple.com
Date
2013-10-17 16:33:53 -0700 (Thu, 17 Oct 2013)

Log Message

CTTE: RenderMathMLSpace always has a MathMLTextElement.
<https://webkit.org/b/122992>

The renderer is never anonymous and always has a corresponding
MathMLTextElement. Overload element() with a tighter return type.

Also marked the class FINAL and made most methods private.

Reviewed by Antti Koivisto.

* rendering/mathml/RenderMathMLSpace.cpp:
(WebCore::RenderMathMLSpace::RenderMathMLSpace):
(WebCore::RenderMathMLSpace::updateFromElement):
* rendering/mathml/RenderMathMLSpace.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157612 => 157613)


--- trunk/Source/WebCore/ChangeLog	2013-10-17 23:29:16 UTC (rev 157612)
+++ trunk/Source/WebCore/ChangeLog	2013-10-17 23:33:53 UTC (rev 157613)
@@ -1,3 +1,20 @@
+2013-10-17  Andreas Kling  <akl...@apple.com>
+
+        CTTE: RenderMathMLSpace always has a MathMLTextElement.
+        <https://webkit.org/b/122992>
+
+        The renderer is never anonymous and always has a corresponding
+        MathMLTextElement. Overload element() with a tighter return type.
+
+        Also marked the class FINAL and made most methods private.
+
+        Reviewed by Antti Koivisto.
+
+        * rendering/mathml/RenderMathMLSpace.cpp:
+        (WebCore::RenderMathMLSpace::RenderMathMLSpace):
+        (WebCore::RenderMathMLSpace::updateFromElement):
+        * rendering/mathml/RenderMathMLSpace.h:
+
 2013-10-17  Tim Horton  <timothy_hor...@apple.com>
 
         PlatformCALayer constructor should take layer type as an argument

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp (157612 => 157613)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2013-10-17 23:29:16 UTC (rev 157612)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2013-10-17 23:33:53 UTC (rev 157613)
@@ -36,7 +36,7 @@
     
 using namespace MathMLNames;
 
-RenderMathMLSpace::RenderMathMLSpace(Element& element)
+RenderMathMLSpace::RenderMathMLSpace(MathMLTextElement& element)
     : RenderMathMLBlock(element)
     , m_width(0)
     , m_height(0)
@@ -52,15 +52,15 @@
 
 void RenderMathMLSpace::updateFromElement()
 {
-    Element* space = element();
+    const auto& spaceElement = element();
 
     // This parses the mspace attributes, using 0 as the default values.
     m_width = 0;
     m_height = 0;
     m_depth = 0;
-    parseMathMLLength(space->getAttribute(MathMLNames::widthAttr), m_width, style());
-    parseMathMLLength(space->getAttribute(MathMLNames::heightAttr), m_height, style());
-    parseMathMLLength(space->getAttribute(MathMLNames::depthAttr), m_depth, style());
+    parseMathMLLength(spaceElement.getAttribute(MathMLNames::widthAttr), m_width, style());
+    parseMathMLLength(spaceElement.getAttribute(MathMLNames::heightAttr), m_height, style());
+    parseMathMLLength(spaceElement.getAttribute(MathMLNames::depthAttr), m_depth, style());
 
     // FIXME: Negative width values should be accepted.
     if (m_width < 0)

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h (157612 => 157613)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2013-10-17 23:29:16 UTC (rev 157612)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2013-10-17 23:33:53 UTC (rev 157613)
@@ -28,28 +28,26 @@
 
 #if ENABLE(MATHML)
 
+#include "MathMLTextElement.h"
 #include "RenderMathMLBlock.h"
 
 namespace WebCore {
     
-class RenderMathMLSpace : public RenderMathMLBlock {
+class RenderMathMLSpace FINAL : public RenderMathMLBlock {
 public:
-    explicit RenderMathMLSpace(Element&);
+    explicit RenderMathMLSpace(MathMLTextElement&);
+    MathMLTextElement& element() { return static_cast<MathMLTextElement&>(nodeForNonAnonymous()); }
 
-    virtual int firstLineBoxBaseline() const OVERRIDE;
-    virtual void updateLogicalWidth() OVERRIDE;
-    virtual void updateLogicalHeight() OVERRIDE;
-
 private:
-    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
     virtual const char* renderName() const OVERRIDE { return isAnonymous() ? "RenderMathMLSpace (anonymous)" : "RenderMathMLSpace"; }
-
     virtual bool isRenderMathMLSpace() const OVERRIDE { return true; }
-
+    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
     virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const OVERRIDE { return false; }
     virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
-
     virtual void updateFromElement() OVERRIDE;
+    virtual int firstLineBoxBaseline() const OVERRIDE;
+    virtual void updateLogicalWidth() OVERRIDE;
+    virtual void updateLogicalHeight() OVERRIDE;
 
     LayoutUnit m_width;
     LayoutUnit m_height;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to