Title: [123842] trunk
Revision
123842
Author
[email protected]
Date
2012-07-27 00:27:44 -0700 (Fri, 27 Jul 2012)

Log Message

changing -webkit-order should change the paint order of flex items
https://bugs.webkit.org/show_bug.cgi?id=92041

Reviewed by Ojan Vafai.

Source/WebCore:

Override paintChildren and use the flex order iterator to determine the order to paint the children.

Test: css3/flexbox/order-painting.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock): Save a reference to the order iterator.
(WebCore::RenderFlexibleBox::paintChildren):
* rendering/RenderFlexibleBox.h:
(RenderFlexibleBox): Hold a reference to the order iterator so we don't have to recreate it at paint time.
    Also mark all the virtual methods with OVERRIDE.

LayoutTests:

Use a ref test since this is testing paint behavior.

* css3/flexbox/order-painting-expected.html: Added.
* css3/flexbox/order-painting.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123841 => 123842)


--- trunk/LayoutTests/ChangeLog	2012-07-27 07:10:06 UTC (rev 123841)
+++ trunk/LayoutTests/ChangeLog	2012-07-27 07:27:44 UTC (rev 123842)
@@ -1,3 +1,15 @@
+2012-07-27  Tony Chang  <[email protected]>
+
+        changing -webkit-order should change the paint order of flex items
+        https://bugs.webkit.org/show_bug.cgi?id=92041
+
+        Reviewed by Ojan Vafai.
+
+        Use a ref test since this is testing paint behavior.
+
+        * css3/flexbox/order-painting-expected.html: Added.
+        * css3/flexbox/order-painting.html: Added.
+
 2012-07-27  Csaba Osztrogonác  <[email protected]>
 
         [Qt][WK2] REGRESSION(r119127): resetting window.internals settings between tests doesn't work properly

Added: trunk/LayoutTests/css3/flexbox/order-painting-expected.html (0 => 123842)


--- trunk/LayoutTests/css3/flexbox/order-painting-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/order-painting-expected.html	2012-07-27 07:27:44 UTC (rev 123842)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test passes if there is no red showing.</p>
+
+<div style="width: 100px; height: 100px; background-color: green"></div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/flexbox/order-painting.html (0 => 123842)


--- trunk/LayoutTests/css3/flexbox/order-painting.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/order-painting.html	2012-07-27 07:27:44 UTC (rev 123842)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test passes if there is no red showing.</p>
+
+<div style="display: -webkit-flex; width: 100px;">
+    <div style="-webkit-order: 2; background-color: green; width: 100px; height: 100px; margin-left: -50px;"></div>
+    <div style="-webkit-order: 1; background-color: red;   width: 50px;  height: 100px;"></div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (123841 => 123842)


--- trunk/Source/WebCore/ChangeLog	2012-07-27 07:10:06 UTC (rev 123841)
+++ trunk/Source/WebCore/ChangeLog	2012-07-27 07:27:44 UTC (rev 123842)
@@ -1,3 +1,21 @@
+2012-07-27  Tony Chang  <[email protected]>
+
+        changing -webkit-order should change the paint order of flex items
+        https://bugs.webkit.org/show_bug.cgi?id=92041
+
+        Reviewed by Ojan Vafai.
+
+        Override paintChildren and use the flex order iterator to determine the order to paint the children.
+
+        Test: css3/flexbox/order-painting.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutBlock): Save a reference to the order iterator.
+        (WebCore::RenderFlexibleBox::paintChildren):
+        * rendering/RenderFlexibleBox.h:
+        (RenderFlexibleBox): Hold a reference to the order iterator so we don't have to recreate it at paint time.
+            Also mark all the virtual methods with OVERRIDE.
+
 2012-07-26  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r123820.

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (123841 => 123842)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-07-27 07:10:06 UTC (rev 123841)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-07-27 07:27:44 UTC (rev 123842)
@@ -259,12 +259,12 @@
     WTF::Vector<LineContext> lineContexts;
     OrderHashSet orderValues;
     computeMainAxisPreferredSizes(relayoutChildren, orderValues);
-    OrderIterator flexIterator(this, orderValues);
-    layoutFlexItems(flexIterator, lineContexts);
+    m_orderIterator = adoptPtr(new OrderIterator(this, orderValues));
+    layoutFlexItems(*m_orderIterator, lineContexts);
 
     LayoutUnit oldClientAfterEdge = clientLogicalBottom();
     computeLogicalHeight();
-    repositionLogicalHeightDependentFlexItems(flexIterator, lineContexts, oldClientAfterEdge);
+    repositionLogicalHeightDependentFlexItems(*m_orderIterator, lineContexts, oldClientAfterEdge);
 
     if (size() != previousSize)
         relayoutChildren = true;
@@ -289,6 +289,16 @@
     setNeedsLayout(false);
 }
 
+void RenderFlexibleBox::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect)
+{
+    ASSERT(m_orderIterator);
+
+    for (RenderBox* child = m_orderIterator->first(); child; child = m_orderIterator->next()) {
+        if (!paintChild(child, paintInfo, paintOffset, paintInfoForChild, usePrintRect))
+            return;
+    }
+}
+
 void RenderFlexibleBox::repositionLogicalHeightDependentFlexItems(OrderIterator& iterator, WTF::Vector<LineContext>& lineContexts, LayoutUnit& oldClientAfterEdge)
 {
     LayoutUnit crossAxisStartEdge = lineContexts.isEmpty() ? ZERO_LAYOUT_UNIT : lineContexts[0].crossAxisOffset;

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (123841 => 123842)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2012-07-27 07:10:06 UTC (rev 123841)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2012-07-27 07:27:44 UTC (rev 123842)
@@ -32,6 +32,7 @@
 #define RenderFlexibleBox_h
 
 #include "RenderBlock.h"
+#include <wtf/OwnPtr.h>
 
 namespace WebCore {
 
@@ -40,12 +41,14 @@
     RenderFlexibleBox(Node*);
     virtual ~RenderFlexibleBox();
 
-    virtual const char* renderName() const;
+    virtual const char* renderName() const OVERRIDE;
 
-    virtual bool isFlexibleBox() const { return true; }
-    virtual void computePreferredLogicalWidths();
-    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0);
+    virtual bool isFlexibleBox() const OVERRIDE { return true; }
+    virtual void computePreferredLogicalWidths() OVERRIDE;
+    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) OVERRIDE;
 
+    virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) OVERRIDE;
+
     bool isHorizontalFlow() const;
 
 private:
@@ -132,6 +135,8 @@
     void applyStretchAlignmentToChild(RenderBox*, LayoutUnit lineCrossAxisExtent);
     void flipForRightToLeftColumn(OrderIterator&);
     void flipForWrapReverse(OrderIterator&, const WTF::Vector<LineContext>&, LayoutUnit crossAxisStartEdge);
+
+    OwnPtr<OrderIterator> m_orderIterator;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to