Title: [125262] trunk
Revision
125262
Author
[email protected]
Date
2012-08-10 02:06:20 -0700 (Fri, 10 Aug 2012)

Log Message

implement display: -webkit-inline-flex
https://bugs.webkit.org/show_bug.cgi?id=77772

Reviewed by Ojan Vafai.

Source/WebCore:

The crashes last time were because we were marking too much of the tree for relayout. During some editing
operations, this causes a layout when we're in an inconsistent state.

Tests: css3/flexbox/inline-flex-crash.html
       css3/flexbox/inline-flex-crash2.html
       css3/flexbox/inline-flex.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): Only layout the child.
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Only layout the child.
(WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Only layout the child.
* rendering/style/RenderStyle.h: Include INLINE_FLEX as an inline and replaced display type.

LayoutTests:

Include 2 crash tests that caused this to be reverted the last time.

* css3/flexbox/inline-flex-crash-expected.txt: Added.
* css3/flexbox/inline-flex-crash.html: Added.
* css3/flexbox/inline-flex-crash2-expected.txt: Added.
* css3/flexbox/inline-flex-crash2.html: Added.
* css3/flexbox/inline-flex-expected.html: Added.
* css3/flexbox/inline-flex.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125261 => 125262)


--- trunk/LayoutTests/ChangeLog	2012-08-10 08:46:38 UTC (rev 125261)
+++ trunk/LayoutTests/ChangeLog	2012-08-10 09:06:20 UTC (rev 125262)
@@ -1,3 +1,19 @@
+2012-08-10  Tony Chang  <[email protected]>
+
+        implement display: -webkit-inline-flex
+        https://bugs.webkit.org/show_bug.cgi?id=77772
+
+        Reviewed by Ojan Vafai.
+
+        Include 2 crash tests that caused this to be reverted the last time.
+
+        * css3/flexbox/inline-flex-crash-expected.txt: Added.
+        * css3/flexbox/inline-flex-crash.html: Added.
+        * css3/flexbox/inline-flex-crash2-expected.txt: Added.
+        * css3/flexbox/inline-flex-crash2.html: Added.
+        * css3/flexbox/inline-flex-expected.html: Added.
+        * css3/flexbox/inline-flex.html: Added.
+
 2012-08-10  Zan Dobersek  <[email protected]>
 
         Unreviewed GTK gardening, rebaselining after r125167.

Added: trunk/LayoutTests/css3/flexbox/inline-flex-crash-expected.txt (0 => 125262)


--- trunk/LayoutTests/css3/flexbox/inline-flex-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/inline-flex-crash-expected.txt	2012-08-10 09:06:20 UTC (rev 125262)
@@ -0,0 +1,5 @@
+This test passes if it doesn't crash.
+
+AA
+
+؅

Added: trunk/LayoutTests/css3/flexbox/inline-flex-crash.html (0 => 125262)


--- trunk/LayoutTests/css3/flexbox/inline-flex-crash.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/inline-flex-crash.html	2012-08-10 09:06:20 UTC (rev 125262)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<style>#el0::first-letter, #el0:first-child { height: 10px; }</style>
+This test passes if it doesn't crash.
+
+<div id='container' contentEditable><a><img><div id="el0" style="display: -webkit-inline-flex"><pre></pre></div></a></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+document.querySelector('pre').textContent = 'AA\u0605';
+window.getSelection().selectAllChildren(document.getElementById('container'));
+document.execCommand('FormatBlock', false, '<h1>');
+</script>

Added: trunk/LayoutTests/css3/flexbox/inline-flex-crash2-expected.txt (0 => 125262)


--- trunk/LayoutTests/css3/flexbox/inline-flex-crash2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/inline-flex-crash2-expected.txt	2012-08-10 09:06:20 UTC (rev 125262)
@@ -0,0 +1,5 @@
+This test passes if it doesn't crash.
+
+AAAA
+
+A

Added: trunk/LayoutTests/css3/flexbox/inline-flex-crash2.html (0 => 125262)


--- trunk/LayoutTests/css3/flexbox/inline-flex-crash2.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/inline-flex-crash2.html	2012-08-10 09:06:20 UTC (rev 125262)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>#el0::first-letter, #el0:first-child { height: 100px;}</style>
+This test passes if it doesn't crash.
+
+<div id='container' contentEditable><a><img><div id="el0" style="display: -webkit-inline-flex"><pre>AAAAA</pre></div></a></div>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+window.getSelection().selectAllChildren(document.getElementById('container'));
+document.execCommand('FormatBlock', false, '<h5>');
+</script>

Added: trunk/LayoutTests/css3/flexbox/inline-flex-expected.txt (0 => 125262)


--- trunk/LayoutTests/css3/flexbox/inline-flex-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/inline-flex-expected.txt	2012-08-10 09:06:20 UTC (rev 125262)
@@ -0,0 +1,3 @@
+This test passes if the three green boxes are on the same horizontal line.
+
+ PASS

Added: trunk/LayoutTests/css3/flexbox/inline-flex.html (0 => 125262)


--- trunk/LayoutTests/css3/flexbox/inline-flex.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/inline-flex.html	2012-08-10 09:06:20 UTC (rev 125262)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<style>
+#testcase > div {
+    height: 50px;
+    width: 50px;
+    background-color: green;
+    outline: 2px solid darkgreen;
+}
+
+#testcase > div > div {
+    -webkit-flex: 1;
+}
+
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<script src=""
+<body _onload_="checkLayout('#testcase')">
+<p>This test passes if the three green boxes are on the same horizontal line.</p>
+
+<div id="testcase" style="position: relative">
+<div data-offset-y="0" data-offset-x="0" data-expected-width="50" data-expected-height="50" style="display: inline-block">
+</div><div data-offset-y="0" data-offset-x="50" data-expected-width="50" data-expected-height="50" style="display: -webkit-inline-flex;">
+    <div data-expected-width="25"></div>
+    <div data-expected-width="25"></div>
+</div><div data-offset-y="0" data-offset-x="100" data-expected-width="50" data-expected-height="50" style="display: inline-block"></div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (125261 => 125262)


--- trunk/Source/WebCore/ChangeLog	2012-08-10 08:46:38 UTC (rev 125261)
+++ trunk/Source/WebCore/ChangeLog	2012-08-10 09:06:20 UTC (rev 125262)
@@ -1,3 +1,23 @@
+2012-08-10  Tony Chang  <[email protected]>
+
+        implement display: -webkit-inline-flex
+        https://bugs.webkit.org/show_bug.cgi?id=77772
+
+        Reviewed by Ojan Vafai.
+
+        The crashes last time were because we were marking too much of the tree for relayout. During some editing
+        operations, this causes a layout when we're in an inconsistent state.
+
+        Tests: css3/flexbox/inline-flex-crash.html
+               css3/flexbox/inline-flex-crash2.html
+               css3/flexbox/inline-flex.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): Only layout the child.
+        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Only layout the child.
+        (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Only layout the child.
+        * rendering/style/RenderStyle.h: Include INLINE_FLEX as an inline and replaced display type.
+
 2012-08-10  Vineet Chaudhary  <[email protected]>
 
         Moving the common code from CodegeneratorJS/V8.pm to Codegenerator.pm

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (125261 => 125262)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-08-10 08:46:38 UTC (rev 125261)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-08-10 09:06:20 UTC (rev 125262)
@@ -780,7 +780,7 @@
         Length childMainAxisMin = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight();
         if (hasOrthogonalFlow(child) && (flexBasisForChild(child).isAuto() || childMainAxisMin.isAuto())) {
             if (!relayoutChildren)
-                child->setChildNeedsLayout(true);
+                child->setChildNeedsLayout(true, MarkOnlyThis);
             child->layoutIfNeeded();
         }
 
@@ -1019,7 +1019,7 @@
         LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPaddingExtentForChild(child);
         setLogicalOverrideSize(child, childPreferredSize);
         // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905.
-        child->setChildNeedsLayout(true);
+        child->setChildNeedsLayout(true, MarkOnlyThis);
         child->layoutIfNeeded();
 
         updateAutoMarginsInMainAxis(child, autoMarginOffset);
@@ -1243,14 +1243,14 @@
         if (child->logicalHeight() != logicalHeightBefore) {
             child->setOverrideLogicalContentHeight(child->logicalHeight() - child->borderAndPaddingLogicalHeight());
             child->setLogicalHeight(0);
-            child->setChildNeedsLayout(true);
+            child->setChildNeedsLayout(true, MarkOnlyThis);
             child->layoutIfNeeded();
         }
     } else if (isColumnFlow() && child->style()->logicalWidth().isAuto() && isMultiline()) {
         // FIXME: Handle min-width and max-width.
         LayoutUnit childWidth = lineCrossAxisExtent - crossAxisMarginExtentForChild(child);
         child->setOverrideLogicalContentWidth(std::max(ZERO_LAYOUT_UNIT, childWidth));
-        child->setChildNeedsLayout(true);
+        child->setChildNeedsLayout(true, MarkOnlyThis);
         child->layoutIfNeeded();
     }
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (125261 => 125262)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-08-10 08:46:38 UTC (rev 125261)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-08-10 09:06:20 UTC (rev 125262)
@@ -1740,7 +1740,7 @@
 
     bool isDisplayReplacedType(EDisplay display) const
     {
-        return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_TABLE || display == INLINE_GRID;
+        return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEX || display == INLINE_TABLE || display == INLINE_GRID;
     }
 
     bool isDisplayInlineType(EDisplay display) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to