Title: [99120] trunk
Revision
99120
Author
[email protected]
Date
2011-11-02 16:30:28 -0700 (Wed, 02 Nov 2011)

Log Message

force inline flexitems to be wrapped in anonymous blocks
https://bugs.webkit.org/show_bug.cgi?id=71314

Reviewed by Ojan Vafai.

Source/WebCore:

If there is a mix of inline and block items, all the inline items were already getting wrapped
(see RenderBlock::addChildIgnoringAnonymousColumnBlocks).  However, if there are only inline items,
we need to force them into an anonymous block.

There are still lots of bugs because we're trying to read style values from the anonymous block,
but this at least causes layout to be called on all the render objects.

Tests: css3/flexbox/anonymous-block.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::TreeOrderIterator::next):
(WebCore::RenderFlexibleBox::FlexOrderIterator::next):
(WebCore::RenderFlexibleBox::RenderFlexibleBox): force children into blocks

LayoutTests:

* css3/flexbox/anonymous-block-expected.html: Added.
* css3/flexbox/anonymous-block.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99119 => 99120)


--- trunk/LayoutTests/ChangeLog	2011-11-02 23:22:54 UTC (rev 99119)
+++ trunk/LayoutTests/ChangeLog	2011-11-02 23:30:28 UTC (rev 99120)
@@ -1,3 +1,13 @@
+2011-11-02  Tony Chang  <[email protected]>
+
+        force inline flexitems to be wrapped in anonymous blocks
+        https://bugs.webkit.org/show_bug.cgi?id=71314
+
+        Reviewed by Ojan Vafai.
+
+        * css3/flexbox/anonymous-block-expected.html: Added.
+        * css3/flexbox/anonymous-block.html: Added.
+
 2011-11-02  Erik Arvidsson  <[email protected]>
 
         Remove references to non existing file; js-test-post-function.js

Added: trunk/LayoutTests/css3/flexbox/anonymous-block-expected.html (0 => 99120)


--- trunk/LayoutTests/css3/flexbox/anonymous-block-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/anonymous-block-expected.html	2011-11-02 23:30:28 UTC (rev 99120)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div>This text should be visible.</div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/flexbox/anonymous-block.html (0 => 99120)


--- trunk/LayoutTests/css3/flexbox/anonymous-block.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/anonymous-block.html	2011-11-02 23:30:28 UTC (rev 99120)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="display: -webkit-flexbox">This text should be visible.</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (99119 => 99120)


--- trunk/Source/WebCore/ChangeLog	2011-11-02 23:22:54 UTC (rev 99119)
+++ trunk/Source/WebCore/ChangeLog	2011-11-02 23:30:28 UTC (rev 99120)
@@ -1,3 +1,24 @@
+2011-11-02  Tony Chang  <[email protected]>
+
+        force inline flexitems to be wrapped in anonymous blocks
+        https://bugs.webkit.org/show_bug.cgi?id=71314
+
+        Reviewed by Ojan Vafai.
+
+        If there is a mix of inline and block items, all the inline items were already getting wrapped
+        (see RenderBlock::addChildIgnoringAnonymousColumnBlocks).  However, if there are only inline items,
+        we need to force them into an anonymous block.
+
+        There are still lots of bugs because we're trying to read style values from the anonymous block,
+        but this at least causes layout to be called on all the render objects.
+
+        Tests: css3/flexbox/anonymous-block.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::TreeOrderIterator::next):
+        (WebCore::RenderFlexibleBox::FlexOrderIterator::next):
+        (WebCore::RenderFlexibleBox::RenderFlexibleBox): force children into blocks
+
 2011-11-02  Dean Jackson  <[email protected]>
 
         Add ENABLE_CSS_SHADERS flag

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (99119 => 99120)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2011-11-02 23:22:54 UTC (rev 99119)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2011-11-02 23:30:28 UTC (rev 99120)
@@ -66,15 +66,11 @@
 
     RenderBox* next()
     {
-        RenderObject* child = m_currentChild ? m_currentChild->nextSibling() : m_flexibleBox->firstChild();
-        // FIXME: Inline nodes (like <img> or <input>) should also be treated as boxes.
-        while (child && !child->isBox())
-            child = child->nextSibling();
+        m_currentChild = m_currentChild ? m_currentChild->nextSiblingBox() : m_flexibleBox->firstChildBox();
 
-        if (child)
-            m_flexOrderValues.add(child->style()->flexOrder());
+        if (m_currentChild)
+            m_flexOrderValues.add(m_currentChild->style()->flexOrder());
 
-        m_currentChild = toRenderBox(child);
         return m_currentChild;
     }
 
@@ -113,9 +109,8 @@
 
     RenderBox* next()
     {
-        RenderObject* child = m_currentChild;
         do {
-            if (!child) {
+            if (!m_currentChild) {
                 if (m_orderValuesIterator == m_orderValues.end())
                     return 0;
                 if (m_orderValuesIterator) {
@@ -125,12 +120,11 @@
                 } else
                     m_orderValuesIterator = m_orderValues.begin();
 
-                child = m_flexibleBox->firstChild();
+                m_currentChild = m_flexibleBox->firstChildBox();
             } else
-                child = child->nextSibling();
-        } while (!child || !child->isBox() || child->style()->flexOrder() != *m_orderValuesIterator);
+                m_currentChild = m_currentChild->nextSiblingBox();
+        } while (!m_currentChild || m_currentChild->style()->flexOrder() != *m_orderValuesIterator);
 
-        m_currentChild = toRenderBox(child);
         return m_currentChild;
     }
 
@@ -151,6 +145,7 @@
 RenderFlexibleBox::RenderFlexibleBox(Node* node)
     : RenderBlock(node)
 {
+    setChildrenInline(false); // All of our children must be block-level.
 }
 
 RenderFlexibleBox::~RenderFlexibleBox()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to