Title: [199771] trunk
Revision
199771
Author
[email protected]
Date
2016-04-20 06:25:39 -0700 (Wed, 20 Apr 2016)

Log Message

Refactor RenderMathMLSpace to avoid using flexbox
https://bugs.webkit.org/show_bug.cgi?id=155168

Patch by Frederic Wang <[email protected]> on 2016-04-20
Reviewed by Martin Robinson.

Source/WebCore:

No new tests, already covered by existing tests. The behavior of mspace-prefered-width-expected is not specified by the MathML recommendation, we update that test to match our new behavior.

* rendering/mathml/RenderMathMLSpace.cpp: Implement layout functions without passing by flebox.
(WebCore::RenderMathMLSpace::computePreferredLogicalWidths): Implement this function.
(WebCore::RenderMathMLSpace::layoutBlock): Implement this function.
(WebCore::RenderMathMLSpace::computeIntrinsicLogicalWidths): Deleted.
(WebCore::RenderMathMLSpace::updateLogicalWidth): Deleted.
(WebCore::RenderMathMLSpace::updateLogicalHeight): Deleted.
* rendering/mathml/RenderMathMLSpace.h: Update function declarations.

LayoutTests:

* mathml/presentation/mspace-prefered-width-expected.html: Update the expectation so that the logical width and preferred width are both equal to the one specified by the width attribute.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199770 => 199771)


--- trunk/LayoutTests/ChangeLog	2016-04-20 09:06:00 UTC (rev 199770)
+++ trunk/LayoutTests/ChangeLog	2016-04-20 13:25:39 UTC (rev 199771)
@@ -1,3 +1,12 @@
+2016-04-20  Frederic Wang  <[email protected]>
+
+        Refactor RenderMathMLSpace to avoid using flexbox
+        https://bugs.webkit.org/show_bug.cgi?id=155168
+
+        Reviewed by Martin Robinson.
+
+        * mathml/presentation/mspace-prefered-width-expected.html: Update the expectation so that the logical width and preferred width are both equal to the one specified by the width attribute.
+
 2016-04-20  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed GTK+ gardening. Mark HLS tests release expectations as release only.

Modified: trunk/LayoutTests/mathml/presentation/mspace-prefered-width-expected.html (199770 => 199771)


--- trunk/LayoutTests/mathml/presentation/mspace-prefered-width-expected.html	2016-04-20 09:06:00 UTC (rev 199770)
+++ trunk/LayoutTests/mathml/presentation/mspace-prefered-width-expected.html	2016-04-20 13:25:39 UTC (rev 199771)
@@ -14,10 +14,10 @@
 	 <span style="display: inline-block; width: 50px; height: 10px; background:green;"></span>
 	</td>
     <td>
-	 <span style="display: inline-block; width: 50px; height: 10px; background:green; margin-right: 50px;"></span>
+	 <span style="display: inline-block; width: 50px; height: 10px; background:green;"></span>
 	</td>
     <td>
-	 <span style="display: inline-block; width: 50px; height: 10px; background:green; margin-right: -40px;"></span>
+	 <span style="display: inline-block; width: 50px; height: 10px; background:green;"></span>
 	</td>
   </tr>
 </table>

Modified: trunk/Source/WebCore/ChangeLog (199770 => 199771)


--- trunk/Source/WebCore/ChangeLog	2016-04-20 09:06:00 UTC (rev 199770)
+++ trunk/Source/WebCore/ChangeLog	2016-04-20 13:25:39 UTC (rev 199771)
@@ -1,3 +1,20 @@
+2016-04-20  Frederic Wang  <[email protected]>
+
+        Refactor RenderMathMLSpace to avoid using flexbox
+        https://bugs.webkit.org/show_bug.cgi?id=155168
+
+        Reviewed by Martin Robinson.
+
+        No new tests, already covered by existing tests. The behavior of mspace-prefered-width-expected is not specified by the MathML recommendation, we update that test to match our new behavior.
+
+        * rendering/mathml/RenderMathMLSpace.cpp: Implement layout functions without passing by flebox.
+        (WebCore::RenderMathMLSpace::computePreferredLogicalWidths): Implement this function.
+        (WebCore::RenderMathMLSpace::layoutBlock): Implement this function.
+        (WebCore::RenderMathMLSpace::computeIntrinsicLogicalWidths): Deleted.
+        (WebCore::RenderMathMLSpace::updateLogicalWidth): Deleted.
+        (WebCore::RenderMathMLSpace::updateLogicalHeight): Deleted.
+        * rendering/mathml/RenderMathMLSpace.h: Update function declarations.
+
 2016-04-20  Carlos Garcia Campos  <[email protected]>
 
         [Cairo] Crash in GraphicsContext::drawFocusRing when painting is disabled

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp (199770 => 199771)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2016-04-20 09:06:00 UTC (rev 199770)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2016-04-20 13:25:39 UTC (rev 199771)
@@ -44,10 +44,13 @@
 {
 }
 
-void RenderMathMLSpace::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
+void RenderMathMLSpace::computePreferredLogicalWidths()
 {
-    minLogicalWidth = m_width;
-    maxLogicalWidth = m_width;
+    ASSERT(preferredLogicalWidthsDirty());
+
+    m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = m_width;
+
+    setPreferredLogicalWidthsDirty(false);
 }
 
 void RenderMathMLSpace::updateFromElement()
@@ -75,14 +78,17 @@
     setNeedsLayoutAndPrefWidthsRecalc();
 }
 
-void RenderMathMLSpace::updateLogicalWidth()
+void RenderMathMLSpace::layoutBlock(bool relayoutChildren, LayoutUnit)
 {
+    ASSERT(needsLayout());
+
+    if (!relayoutChildren && simplifiedLayout())
+        return;
+
     setLogicalWidth(m_width);
-}
+    setLogicalHeight(m_height + m_depth);
 
-void RenderMathMLSpace::updateLogicalHeight()
-{
-    setLogicalHeight(m_height + m_depth);
+    clearNeedsLayout();
 }
 
 void RenderMathMLSpace::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h (199770 => 199771)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2016-04-20 09:06:00 UTC (rev 199770)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2016-04-20 13:25:39 UTC (rev 199771)
@@ -39,15 +39,14 @@
     MathMLTextElement& element() { return static_cast<MathMLTextElement&>(nodeForNonAnonymous()); }
 
 private:
-    const char* renderName() const override { return isAnonymous() ? "RenderMathMLSpace (anonymous)" : "RenderMathMLSpace"; }
-    bool isRenderMathMLSpace() const override { return true; }
-    void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
-    bool isChildAllowed(const RenderObject&, const RenderStyle&) const override { return false; }
-    void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
-    void updateFromElement() override;
-    Optional<int> firstLineBaseline() const override;
-    void updateLogicalWidth() override;
-    void updateLogicalHeight() override;
+    const char* renderName() const final { return isAnonymous() ? "RenderMathMLSpace (anonymous)" : "RenderMathMLSpace"; }
+    bool isRenderMathMLSpace() const final { return true; }
+    void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
+    bool isChildAllowed(const RenderObject&, const RenderStyle&) const final { return false; }
+    void updateFromElement() final;
+    void computePreferredLogicalWidths() final;
+    void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+    Optional<int> firstLineBaseline() const final;
 
     LayoutUnit m_width;
     LayoutUnit m_height;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to