Title: [140032] trunk/Source/WebCore
Revision
140032
Author
o...@chromium.org
Date
2013-01-17 12:55:57 -0800 (Thu, 17 Jan 2013)

Log Message

MathML padding overrides only need to be on RenderMathMLRoot
https://bugs.webkit.org/show_bug.cgi?id=107151

Reviewed by Tony Chang.

RenderMathMLRoot is the only class that uses these.
No need for them to be on the generic MathML superclass.

* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::RenderMathMLBlock):
* rendering/mathml/RenderMathMLBlock.h:
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::RenderMathMLRoot):
(WebCore::RenderMathMLRoot::paddingTop):
(WebCore::RenderMathMLRoot::paddingBottom):
(WebCore::RenderMathMLRoot::paddingLeft):
(WebCore::RenderMathMLRoot::paddingRight):
(WebCore::RenderMathMLRoot::paddingBefore):
(WebCore::RenderMathMLRoot::paddingAfter):
(WebCore::RenderMathMLRoot::paddingStart):
(WebCore::RenderMathMLRoot::paddingEnd):
* rendering/mathml/RenderMathMLRoot.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140031 => 140032)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 20:51:56 UTC (rev 140031)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 20:55:57 UTC (rev 140032)
@@ -1,3 +1,28 @@
+2013-01-17  Ojan Vafai  <o...@chromium.org>
+
+        MathML padding overrides only need to be on RenderMathMLRoot
+        https://bugs.webkit.org/show_bug.cgi?id=107151
+
+        Reviewed by Tony Chang.
+
+        RenderMathMLRoot is the only class that uses these.
+        No need for them to be on the generic MathML superclass.
+
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::RenderMathMLBlock::RenderMathMLBlock):
+        * rendering/mathml/RenderMathMLBlock.h:
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::RenderMathMLRoot):
+        (WebCore::RenderMathMLRoot::paddingTop):
+        (WebCore::RenderMathMLRoot::paddingBottom):
+        (WebCore::RenderMathMLRoot::paddingLeft):
+        (WebCore::RenderMathMLRoot::paddingRight):
+        (WebCore::RenderMathMLRoot::paddingBefore):
+        (WebCore::RenderMathMLRoot::paddingAfter):
+        (WebCore::RenderMathMLRoot::paddingStart):
+        (WebCore::RenderMathMLRoot::paddingEnd):
+        * rendering/mathml/RenderMathMLRoot.h:
+
 2013-01-17  Poul Sysolyatin  <psyt...@gmail.com>
 
         32-bit build for Qt5 on Mac OS fails.

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (140031 => 140032)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2013-01-17 20:51:56 UTC (rev 140031)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2013-01-17 20:55:57 UTC (rev 140032)
@@ -45,10 +45,6 @@
 RenderMathMLBlock::RenderMathMLBlock(Element* container)
     : RenderFlexibleBox(container)
     , m_ignoreInAccessibilityTree(false)
-    , m_intrinsicPaddingBefore(0)
-    , m_intrinsicPaddingAfter(0)
-    , m_intrinsicPaddingStart(0)
-    , m_intrinsicPaddingEnd(0)
     , m_preferredLogicalHeight(preferredLogicalHeightUnset)
 {
 }
@@ -58,90 +54,6 @@
     return child->node() && child->node()->nodeType() == Node::ELEMENT_NODE;
 }
 
-LayoutUnit RenderMathMLBlock::paddingTop() const
-{
-    LayoutUnit result = computedCSSPaddingTop();
-    switch (style()->writingMode()) {
-    case TopToBottomWritingMode:
-        return result + m_intrinsicPaddingBefore;
-    case BottomToTopWritingMode:
-        return result + m_intrinsicPaddingAfter;
-    case LeftToRightWritingMode:
-    case RightToLeftWritingMode:
-        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingStart : m_intrinsicPaddingEnd);
-    }
-    ASSERT_NOT_REACHED();
-    return result;
-}
-
-LayoutUnit RenderMathMLBlock::paddingBottom() const
-{
-    LayoutUnit result = computedCSSPaddingBottom();
-    switch (style()->writingMode()) {
-    case TopToBottomWritingMode:
-        return result + m_intrinsicPaddingAfter;
-    case BottomToTopWritingMode:
-        return result + m_intrinsicPaddingBefore;
-    case LeftToRightWritingMode:
-    case RightToLeftWritingMode:
-        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingEnd : m_intrinsicPaddingStart);
-    }
-    ASSERT_NOT_REACHED();
-    return result;
-}
-
-LayoutUnit RenderMathMLBlock::paddingLeft() const
-{
-    LayoutUnit result = computedCSSPaddingLeft();
-    switch (style()->writingMode()) {
-    case LeftToRightWritingMode:
-        return result + m_intrinsicPaddingBefore;
-    case RightToLeftWritingMode:
-        return result + m_intrinsicPaddingAfter;
-    case TopToBottomWritingMode:
-    case BottomToTopWritingMode:
-        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingStart : m_intrinsicPaddingEnd);
-    }
-    ASSERT_NOT_REACHED();
-    return result;
-}
-
-LayoutUnit RenderMathMLBlock::paddingRight() const
-{
-    LayoutUnit result = computedCSSPaddingRight();
-    switch (style()->writingMode()) {
-    case RightToLeftWritingMode:
-        return result + m_intrinsicPaddingBefore;
-    case LeftToRightWritingMode:
-        return result + m_intrinsicPaddingAfter;
-    case TopToBottomWritingMode:
-    case BottomToTopWritingMode:
-        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingEnd : m_intrinsicPaddingStart);
-    }
-    ASSERT_NOT_REACHED();
-    return result;
-}
-
-LayoutUnit RenderMathMLBlock::paddingBefore() const
-{
-    return computedCSSPaddingBefore() + m_intrinsicPaddingBefore;
-}
-
-LayoutUnit RenderMathMLBlock::paddingAfter() const
-{
-    return computedCSSPaddingAfter() + m_intrinsicPaddingAfter;
-}
-
-LayoutUnit RenderMathMLBlock::paddingStart() const
-{
-    return computedCSSPaddingStart() + m_intrinsicPaddingStart;
-}
-
-LayoutUnit RenderMathMLBlock::paddingEnd() const
-{
-    return computedCSSPaddingEnd() + m_intrinsicPaddingEnd;
-}
-
 void RenderMathMLBlock::computePreferredLogicalWidths()
 {
     ASSERT(preferredLogicalWidthsDirty());

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (140031 => 140032)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2013-01-17 20:51:56 UTC (rev 140031)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2013-01-17 20:55:57 UTC (rev 140032)
@@ -64,15 +64,6 @@
     // FIXME: We don't yet handle all the cases in the MathML spec. See
     // https://bugs.webkit.org/show_bug.cgi?id=78617.
     virtual RenderMathMLOperator* unembellishedOperator() { return 0; }
-
-    virtual LayoutUnit paddingTop() const OVERRIDE;
-    virtual LayoutUnit paddingBottom() const OVERRIDE;
-    virtual LayoutUnit paddingLeft() const OVERRIDE;
-    virtual LayoutUnit paddingRight() const OVERRIDE;
-    virtual LayoutUnit paddingBefore() const OVERRIDE;
-    virtual LayoutUnit paddingAfter() const OVERRIDE;
-    virtual LayoutUnit paddingStart() const OVERRIDE;
-    virtual LayoutUnit paddingEnd() const OVERRIDE;
     
     // A MathML element's preferred logical widths often depend on its children's preferred heights, not just their widths.
     // This is due to operator stretching and other layout fine tuning. We define an element's preferred height to be its
@@ -107,11 +98,6 @@
     // This can only be called after children have been sized by computeChildrenPreferredLogicalHeights().
     static LayoutUnit preferredLogicalHeightAfterSizing(RenderObject* child);
     
-    int m_intrinsicPaddingBefore;
-    int m_intrinsicPaddingAfter;
-    int m_intrinsicPaddingStart;
-    int m_intrinsicPaddingEnd;
-    
     // m_preferredLogicalHeight is dirty if it's < 0 or preferredLogicalWidthsDirty().
     LayoutUnit m_preferredLogicalHeight;
 };

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (140031 => 140032)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2013-01-17 20:51:56 UTC (rev 140031)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2013-01-17 20:55:57 UTC (rev 140032)
@@ -68,9 +68,97 @@
     
 RenderMathMLRoot::RenderMathMLRoot(Element* element)
     : RenderMathMLBlock(element)
+    , m_intrinsicPaddingBefore(0)
+    , m_intrinsicPaddingAfter(0)
+    , m_intrinsicPaddingStart(0)
+    , m_intrinsicPaddingEnd(0)
 {
 }
 
+LayoutUnit RenderMathMLRoot::paddingTop() const
+{
+    LayoutUnit result = computedCSSPaddingTop();
+    switch (style()->writingMode()) {
+    case TopToBottomWritingMode:
+        return result + m_intrinsicPaddingBefore;
+    case BottomToTopWritingMode:
+        return result + m_intrinsicPaddingAfter;
+    case LeftToRightWritingMode:
+    case RightToLeftWritingMode:
+        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingStart : m_intrinsicPaddingEnd);
+    }
+    ASSERT_NOT_REACHED();
+    return result;
+}
+
+LayoutUnit RenderMathMLRoot::paddingBottom() const
+{
+    LayoutUnit result = computedCSSPaddingBottom();
+    switch (style()->writingMode()) {
+    case TopToBottomWritingMode:
+        return result + m_intrinsicPaddingAfter;
+    case BottomToTopWritingMode:
+        return result + m_intrinsicPaddingBefore;
+    case LeftToRightWritingMode:
+    case RightToLeftWritingMode:
+        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingEnd : m_intrinsicPaddingStart);
+    }
+    ASSERT_NOT_REACHED();
+    return result;
+}
+
+LayoutUnit RenderMathMLRoot::paddingLeft() const
+{
+    LayoutUnit result = computedCSSPaddingLeft();
+    switch (style()->writingMode()) {
+    case LeftToRightWritingMode:
+        return result + m_intrinsicPaddingBefore;
+    case RightToLeftWritingMode:
+        return result + m_intrinsicPaddingAfter;
+    case TopToBottomWritingMode:
+    case BottomToTopWritingMode:
+        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingStart : m_intrinsicPaddingEnd);
+    }
+    ASSERT_NOT_REACHED();
+    return result;
+}
+
+LayoutUnit RenderMathMLRoot::paddingRight() const
+{
+    LayoutUnit result = computedCSSPaddingRight();
+    switch (style()->writingMode()) {
+    case RightToLeftWritingMode:
+        return result + m_intrinsicPaddingBefore;
+    case LeftToRightWritingMode:
+        return result + m_intrinsicPaddingAfter;
+    case TopToBottomWritingMode:
+    case BottomToTopWritingMode:
+        return result + (style()->isLeftToRightDirection() ? m_intrinsicPaddingEnd : m_intrinsicPaddingStart);
+    }
+    ASSERT_NOT_REACHED();
+    return result;
+}
+
+LayoutUnit RenderMathMLRoot::paddingBefore() const
+{
+    return computedCSSPaddingBefore() + m_intrinsicPaddingBefore;
+}
+
+LayoutUnit RenderMathMLRoot::paddingAfter() const
+{
+    return computedCSSPaddingAfter() + m_intrinsicPaddingAfter;
+}
+
+LayoutUnit RenderMathMLRoot::paddingStart() const
+{
+    return computedCSSPaddingStart() + m_intrinsicPaddingStart;
+}
+
+LayoutUnit RenderMathMLRoot::paddingEnd() const
+{
+    return computedCSSPaddingEnd() + m_intrinsicPaddingEnd;
+}
+
 void RenderMathMLRoot::addChild(RenderObject* newChild, RenderObject* beforeChild)
 {
     // Insert an implicit <mrow> for <mroot> as well as <msqrt>, to ensure firstChild() will have a box

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h (140031 => 140032)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h	2013-01-17 20:51:56 UTC (rev 140031)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h	2013-01-17 20:55:57 UTC (rev 140032)
@@ -36,7 +36,16 @@
 class RenderMathMLRoot : public RenderMathMLBlock {
 public:
     RenderMathMLRoot(Element*);
-    
+
+    virtual LayoutUnit paddingTop() const OVERRIDE;
+    virtual LayoutUnit paddingBottom() const OVERRIDE;
+    virtual LayoutUnit paddingLeft() const OVERRIDE;
+    virtual LayoutUnit paddingRight() const OVERRIDE;
+    virtual LayoutUnit paddingBefore() const OVERRIDE;
+    virtual LayoutUnit paddingAfter() const OVERRIDE;
+    virtual LayoutUnit paddingStart() const OVERRIDE;
+    virtual LayoutUnit paddingEnd() const OVERRIDE;
+
     virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE;
     
 protected:
@@ -52,7 +61,11 @@
     
     // This may return 0 for a non-MathML index (which won't occur in valid MathML).
     RenderBoxModelObject* index() const;
-    
+
+    int m_intrinsicPaddingBefore;
+    int m_intrinsicPaddingAfter;
+    int m_intrinsicPaddingStart;
+    int m_intrinsicPaddingEnd;
     int m_overbarLeftPointShift;
     int m_indexTop;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to