Title: [125810] trunk
Revision
125810
Author
[email protected]
Date
2012-08-16 13:50:05 -0700 (Thu, 16 Aug 2012)

Log Message

Regression(r118248): Replaced element not layout
https://bugs.webkit.org/show_bug.cgi?id=85804

Reviewed by Levi Weintraub.

Source/WebCore:

r118248 moved the layout call of replaced elements to nextLineBreak.
This was intended to delay the layout after all the lineboxes are cleared
in RenderBlock::layoutInlineChildren. However, this caused the end line
object to not layout at all. We revert to the old planned way to just
keep a local vector of replaced elements to layout and then layout all of them
after the lineboxes are cleared.

Test: fast/replaced/replaced-last-line-layout.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutInlineChildren):
(WebCore::RenderBlock::LineBreaker::nextLineBreak):

LayoutTests:

* fast/replaced/replaced-last-line-layout-expected.html: Added.
* fast/replaced/replaced-last-line-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125809 => 125810)


--- trunk/LayoutTests/ChangeLog	2012-08-16 20:48:02 UTC (rev 125809)
+++ trunk/LayoutTests/ChangeLog	2012-08-16 20:50:05 UTC (rev 125810)
@@ -1,3 +1,13 @@
+2012-08-16  Abhishek Arya  <[email protected]>
+
+        Regression(r118248): Replaced element not layout
+        https://bugs.webkit.org/show_bug.cgi?id=85804
+
+        Reviewed by Levi Weintraub.
+
+        * fast/replaced/replaced-last-line-layout-expected.html: Added.
+        * fast/replaced/replaced-last-line-layout.html: Added.
+
 2012-08-16  Adam Barth  <[email protected]>
 
         DirectoryEntry should use Dictionary rather than custom bindings code

Added: trunk/LayoutTests/fast/replaced/replaced-last-line-layout-expected.html (0 => 125810)


--- trunk/LayoutTests/fast/replaced/replaced-last-line-layout-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/replaced-last-line-layout-expected.html	2012-08-16 20:50:05 UTC (rev 125810)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="display: inline; position: relative;">
+    <input type="text" id="one" value="One"><br>
+    <input type="text" id="two" value="Two">
+    <div style="position: absolute"></div>
+</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/replaced/replaced-last-line-layout-expected.html
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/replaced/replaced-last-line-layout.html (0 => 125810)


--- trunk/LayoutTests/fast/replaced/replaced-last-line-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/replaced/replaced-last-line-layout.html	2012-08-16 20:50:05 UTC (rev 125810)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div style="display: inline; position: relative;">
+    <input type="text" id="one"><br>
+    <input type="text" id="two">
+    <div style="position: absolute"></div>
+</div>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function finish() {
+    one.value = "One";
+    two.value = "Two";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+setTimeout("finish()", 0);
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/replaced/replaced-last-line-layout.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (125809 => 125810)


--- trunk/Source/WebCore/ChangeLog	2012-08-16 20:48:02 UTC (rev 125809)
+++ trunk/Source/WebCore/ChangeLog	2012-08-16 20:50:05 UTC (rev 125810)
@@ -1,3 +1,23 @@
+2012-08-16  Abhishek Arya  <[email protected]>
+
+        Regression(r118248): Replaced element not layout
+        https://bugs.webkit.org/show_bug.cgi?id=85804
+
+        Reviewed by Levi Weintraub.
+
+        r118248 moved the layout call of replaced elements to nextLineBreak.
+        This was intended to delay the layout after all the lineboxes are cleared
+        in RenderBlock::layoutInlineChildren. However, this caused the end line
+        object to not layout at all. We revert to the old planned way to just
+        keep a local vector of replaced elements to layout and then layout all of them
+        after the lineboxes are cleared.
+
+        Test: fast/replaced/replaced-last-line-layout.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::layoutInlineChildren):
+        (WebCore::RenderBlock::LineBreaker::nextLineBreak):
+
 2012-08-16  Benjamin Poulain  <[email protected]>
 
         Do not perform 8 to 16bits characters conversion when converting a WTFString to NSString/CFString

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (125809 => 125810)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-08-16 20:48:02 UTC (rev 125809)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-08-16 20:50:05 UTC (rev 125810)
@@ -1496,8 +1496,13 @@
          deleteEllipsisLineBoxes();
 
     if (firstChild()) {
-        // layout replaced elements
+        // In full layout mode, clear the line boxes of children upfront. Otherwise,
+        // siblings can run into stale root lineboxes during layout. Then layout
+        // the replaced elements later. In partial layout mode, line boxes are not
+        // deleted and only dirtied. In that case, we can layout the replaced
+        // elements at the same time.
         bool hasInlineChild = false;
+        Vector<RenderBox*> replacedChildren;
         for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
             RenderObject* o = walker.current();
             if (!hasInlineChild && o->isInline())
@@ -1517,9 +1522,13 @@
                     o->containingBlock()->insertPositionedObject(box);
                 else if (o->isFloating())
                     layoutState.floats().append(FloatWithRect(box));
-                else if (layoutState.isFullLayout() || o->needsLayout()) {
-                    // Replaced elements
-                    toRenderBox(o)->dirtyLineBoxes(layoutState.isFullLayout());
+                else if (isFullLayout || o->needsLayout()) {
+                    // Replaced element.
+                    box->dirtyLineBoxes(isFullLayout);
+                    if (isFullLayout)
+                        replacedChildren.append(box);
+                    else
+                        o->layoutIfNeeded();
                 }
             } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInline())) {
                 if (!o->isText())
@@ -1530,6 +1539,11 @@
             }
         }
 
+        if (replacedChildren.size()) {
+            for (size_t i = 0; i < replacedChildren.size(); i++)
+                 replacedChildren[i]->layoutIfNeeded();
+        }
+
         layoutRunsAndFloats(layoutState, hasInlineChild);
     }
 
@@ -2289,7 +2303,6 @@
             width.addUncommittedWidth(borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox));
         } else if (current.m_obj->isReplaced()) {
             RenderBox* replacedBox = toRenderBox(current.m_obj);
-            replacedBox->layoutIfNeeded();
 
             // Break on replaced elements if either has normal white-space.
             if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj->isImage() || allowImagesToBreak)) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to