Title: [168598] trunk
Revision
168598
Author
an...@apple.com
Date
2014-05-11 02:42:47 -0700 (Sun, 11 May 2014)

Log Message

Text with simple line layout not getting pushed below float when there is not enough space for it
https://bugs.webkit.org/show_bug.cgi?id=126991

Reviewed by Andreas Kling.


Source/WebCore: 
Tests: fast/text/simple-lines-intruding-wide-float-dynamic.html
       fast/text/simple-lines-intruding-wide-float.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::markLinesDirtyInBlockRange):
        
    Invalidate the line layout path when floats change. We need to check SimpleLineLayout::canUseFor again as
    intruding floats may make this flow ineligible to use the path.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::floatingObjectSet):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):
        
    Test the top positions of all floats for case that would push text below the float instead of just testing 
    the first line. We may have floats in the middle of the paragraph too.

LayoutTests: 
* fast/text/simple-lines-intruding-wide-float-dynamic-expected.html: Added.
* fast/text/simple-lines-intruding-wide-float-dynamic.html: Added.
* fast/text/simple-lines-intruding-wide-float-expected.html: Added.
* fast/text/simple-lines-intruding-wide-float.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (168597 => 168598)


--- trunk/LayoutTests/ChangeLog	2014-05-11 07:47:10 UTC (rev 168597)
+++ trunk/LayoutTests/ChangeLog	2014-05-11 09:42:47 UTC (rev 168598)
@@ -1,3 +1,15 @@
+2014-05-11  Antti Koivisto  <an...@apple.com>
+
+        Text with simple line layout not getting pushed below float when there is not enough space for it
+        https://bugs.webkit.org/show_bug.cgi?id=126991
+
+        Reviewed by Andreas Kling.
+
+        * fast/text/simple-lines-intruding-wide-float-dynamic-expected.html: Added.
+        * fast/text/simple-lines-intruding-wide-float-dynamic.html: Added.
+        * fast/text/simple-lines-intruding-wide-float-expected.html: Added.
+        * fast/text/simple-lines-intruding-wide-float.html: Added.
+
 2014-05-10  Alexey Proskuryakov  <a...@apple.com>
 
         Multiple svg-in-object-placeholder-height tests fail

Added: trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-dynamic-expected.html (0 => 168598)


--- trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-dynamic-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-dynamic-expected.html	2014-05-11 09:42:47 UTC (rev 168598)
@@ -0,0 +1,16 @@
+<html>
+<head>  
+<style type="text/css">
+.container { width:800px; }
+.float { float:right; clear:right; border:2px solid blue; width:200px; height:200px }
+.wide { width:785px; }
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="float wide" id="test">
+</div>
+  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-dynamic.html (0 => 168598)


--- trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-dynamic.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-dynamic.html	2014-05-11 09:42:47 UTC (rev 168598)
@@ -0,0 +1,20 @@
+<html>
+<head>  
+<style type="text/css">
+.container { width:800px; }
+.float { float:right; clear:right; border:2px solid blue; width:200px; height:200px }
+.wide { width:785px; }
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="float" id="test">
+</div>
+  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+</div>
+<script>
+document.body.offsetLeft;
+document.getElementById("test").className += " wide";
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-expected.html (0 => 168598)


--- trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float-expected.html	2014-05-11 09:42:47 UTC (rev 168598)
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+<style type="text/css">
+ .container { width:800px; }
+ .float { float:right; clear:right; border:2px solid blue; width:200px; height:200px }
+ .wide { width:785px; }
+
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="float">
+ </div>
+ <div class="float wide">
+ </div>
+  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
+  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float.html (0 => 168598)


--- trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-lines-intruding-wide-float.html	2014-05-11 09:42:47 UTC (rev 168598)
@@ -0,0 +1,20 @@
+<html>
+<head>  
+<style type="text/css">
+ .container { width:800px; }
+ .float { float:right; clear:right; border:2px solid blue; width:200px; height:200px }
+ .wide { width:785px; }
+
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="float">
+ </div>
+ <div class="float wide">
+ </div>
+  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
+  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (168597 => 168598)


--- trunk/Source/WebCore/ChangeLog	2014-05-11 07:47:10 UTC (rev 168597)
+++ trunk/Source/WebCore/ChangeLog	2014-05-11 09:42:47 UTC (rev 168598)
@@ -1,3 +1,27 @@
+2014-05-11  Antti Koivisto  <an...@apple.com>
+
+        Text with simple line layout not getting pushed below float when there is not enough space for it
+        https://bugs.webkit.org/show_bug.cgi?id=126991
+
+        Reviewed by Andreas Kling.
+
+        Tests: fast/text/simple-lines-intruding-wide-float-dynamic.html
+               fast/text/simple-lines-intruding-wide-float.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::markLinesDirtyInBlockRange):
+        
+            Invalidate the line layout path when floats change. We need to check SimpleLineLayout::canUseFor again as
+            intruding floats may make this flow ineligible to use the path.
+
+        * rendering/RenderBlockFlow.h:
+        (WebCore::RenderBlockFlow::floatingObjectSet):
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseFor):
+        
+            Test the top positions of all floats for case that would push text below the float instead of just testing 
+            the first line. We may have floats in the middle of the paragraph too.
+
 2014-05-11  pe...@outlook.com  <pe...@outlook.com>
 
         WinCairo crashes on acid3 test

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (168597 => 168598)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-05-11 07:47:10 UTC (rev 168597)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-05-11 09:42:47 UTC (rev 168598)
@@ -2872,6 +2872,12 @@
     if (logicalTop >= logicalBottom)
         return;
 
+    // Floats currently affect the choice whether to use simple line layout path.
+    if (m_simpleLineLayout) {
+        invalidateLineLayoutPath();
+        return;
+    }
+
     RootInlineBox* lowestDirtyLine = lastRootBox();
     RootInlineBox* afterLowest = lowestDirtyLine;
     while (lowestDirtyLine && lowestDirtyLine->lineBottomWithLeading() >= logicalBottom && logicalBottom < LayoutUnit::max()) {

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (168597 => 168598)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2014-05-11 07:47:10 UTC (rev 168597)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2014-05-11 09:42:47 UTC (rev 168598)
@@ -291,6 +291,8 @@
     void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = nullptr, bool inLayout = true);
     void markSiblingsWithFloatsForLayout(RenderBox* floatToRemove = nullptr);
 
+    const FloatingObjectSet* floatingObjectSet() const { return m_floatingObjects ? &m_floatingObjects->set() : nullptr; }
+
     LayoutUnit logicalTopForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->y() : floatingObject->x(); }
     LayoutUnit logicalBottomForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->maxY() : floatingObject->maxX(); }
     LayoutUnit logicalLeftForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->x() : floatingObject->y(); }

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (168597 => 168598)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2014-05-11 07:47:10 UTC (rev 168597)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2014-05-11 09:42:47 UTC (rev 168598)
@@ -162,9 +162,13 @@
     const RenderText& textRenderer = toRenderText(*flow.firstChild());
     if (flow.containsFloats()) {
         // We can't use the code path if any lines would need to be shifted below floats. This is because we don't keep per-line y coordinates.
-        // It is enough to test the first line width only as currently all floats must be overhanging.
-        if (textRenderer.minLogicalWidth() > LineWidth(const_cast<RenderBlockFlow&>(flow), false, DoNotIndentText).availableWidth())
-            return false;
+        float minimumWidthNeeded = textRenderer.minLogicalWidth();
+        for (auto& floatRenderer : *flow.floatingObjectSet()) {
+            ASSERT(floatRenderer);
+            float availableWidth = flow.availableLogicalWidthForLine(floatRenderer->y(), false);
+            if (availableWidth < minimumWidthNeeded)
+                return false;
+        }
     }
     if (textRenderer.isCombineText() || textRenderer.isCounter() || textRenderer.isQuote() || textRenderer.isTextFragment()
         || textRenderer.isSVGInlineText())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to