Title: [96162] trunk
Revision
96162
Author
hy...@apple.com
Date
2011-09-27 15:11:41 -0700 (Tue, 27 Sep 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=68940

Narrow the float/lines pagination heuristic to only kick in if
the previous line broke cleanly and if the floats are occurring
at the start of the line.

Reviewed by Dan Bernstein.

Source/WebCore: 

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::positionNewFloatOnLine):

LayoutTests: 

* fast/regions/webkit-flow-float-pushed-to-last-region.html:
* platform/mac/fast/multicol/float-paginate-empty-lines-expected.txt: Added.
* platform/mac/fast/regions/webkit-flow-float-pushed-to-last-region-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96161 => 96162)


--- trunk/LayoutTests/ChangeLog	2011-09-27 22:04:21 UTC (rev 96161)
+++ trunk/LayoutTests/ChangeLog	2011-09-27 22:11:41 UTC (rev 96162)
@@ -1,3 +1,17 @@
+2011-09-27  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=68940
+
+        Narrow the float/lines pagination heuristic to only kick in if
+        the previous line broke cleanly and if the floats are occurring
+        at the start of the line.
+
+        Reviewed by Dan Bernstein.
+
+        * fast/regions/webkit-flow-float-pushed-to-last-region.html:
+        * platform/mac/fast/multicol/float-paginate-empty-lines-expected.txt: Added.
+        * platform/mac/fast/regions/webkit-flow-float-pushed-to-last-region-expected.txt:
+
 2011-09-27  James Robinson  <jam...@chromium.org>
 
         Add a mechanism to test for the compositing tree mutated during painting

Modified: trunk/LayoutTests/fast/regions/webkit-flow-float-pushed-to-last-region.html (96161 => 96162)


--- trunk/LayoutTests/fast/regions/webkit-flow-float-pushed-to-last-region.html	2011-09-27 22:04:21 UTC (rev 96161)
+++ trunk/LayoutTests/fast/regions/webkit-flow-float-pushed-to-last-region.html	2011-09-27 22:11:41 UTC (rev 96162)
@@ -47,7 +47,7 @@
 <div id="content">
     <div id="first-box">
         <div id="second-box">
-            <p>This line of text <img id="float1"> should not get out of the  region. This line of text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.</p>
+            <p> <img id="float1"> This line of text should not get out of the  region. This line of text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.</p>
             <p>This line of text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.</p>
             <p>This line of text should not get out of the region.</p>
         </div>

Added: trunk/LayoutTests/platform/mac/fast/multicol/float-paginate-empty-lines-expected.txt (0 => 96162)


--- trunk/LayoutTests/platform/mac/fast/multicol/float-paginate-empty-lines-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/multicol/float-paginate-empty-lines-expected.txt	2011-09-27 22:11:41 UTC (rev 96162)
@@ -0,0 +1,51 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x54
+        RenderText {#text} at (0,0) size 764x54
+          text run at (0,0) width 764: "This test is ensuring we don't grow the height of a block improperly when a float has no line association (e.g., when it's at"
+          text run at (0,18) width 741: "the end of a block). The complete dashed border should be in the first column, with none of it appearing in the second"
+          text run at (0,36) width 51: "column."
+layer at (8,78) size 784x400
+  RenderBlock {DIV} at (0,70) size 784x400
+    RenderBlock {DIV} at (0,0) size 384x236 [border: (10px dashed #800000)]
+      RenderText {#text} at (10,10) size 110x18
+        text run at (10,10) width 110: "This is some text."
+      RenderBR {BR} at (120,24) size 0x0
+      RenderText {#text} at (10,28) size 110x18
+        text run at (10,28) width 110: "This is some text."
+      RenderBR {BR} at (120,42) size 0x0
+      RenderText {#text} at (10,46) size 110x18
+        text run at (10,46) width 110: "This is some text."
+      RenderBR {BR} at (120,60) size 0x0
+      RenderText {#text} at (10,64) size 110x18
+        text run at (10,64) width 110: "This is some text."
+      RenderBR {BR} at (120,78) size 0x0
+      RenderText {#text} at (10,82) size 110x18
+        text run at (10,82) width 110: "This is some text."
+      RenderBR {BR} at (120,96) size 0x0
+      RenderText {#text} at (10,100) size 110x18
+        text run at (10,100) width 110: "This is some text."
+      RenderBR {BR} at (120,114) size 0x0
+      RenderText {#text} at (10,118) size 110x18
+        text run at (10,118) width 110: "This is some text."
+      RenderBR {BR} at (120,132) size 0x0
+      RenderText {#text} at (10,136) size 110x18
+        text run at (10,136) width 110: "This is some text."
+      RenderBR {BR} at (120,150) size 0x0
+      RenderText {#text} at (10,154) size 110x18
+        text run at (10,154) width 110: "This is some text."
+      RenderBR {BR} at (120,168) size 0x0
+      RenderText {#text} at (10,172) size 110x18
+        text run at (10,172) width 110: "This is some text."
+      RenderBR {BR} at (120,186) size 0x0
+      RenderText {#text} at (10,190) size 110x18
+        text run at (10,190) width 110: "This is some text."
+      RenderBR {BR} at (120,204) size 0x0
+      RenderText {#text} at (10,208) size 110x18
+        text run at (10,208) width 110: "This is some text."
+      RenderBR {BR} at (120,222) size 0x0
+      RenderImage {IMG} at (274,400) size 100x200 [bgcolor=#CCCCCC]
+      RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/fast/regions/webkit-flow-float-pushed-to-last-region-expected.txt (96161 => 96162)


--- trunk/LayoutTests/platform/mac/fast/regions/webkit-flow-float-pushed-to-last-region-expected.txt	2011-09-27 22:04:21 UTC (rev 96161)
+++ trunk/LayoutTests/platform/mac/fast/regions/webkit-flow-float-pushed-to-last-region-expected.txt	2011-09-27 22:11:41 UTC (rev 96162)
@@ -15,11 +15,9 @@
           RenderBlock {DIV} at (5,5) size 390x443 [border: (1px solid #0000FF)]
             RenderBlock {DIV} at (11,11) size 368x421 [border: (1px solid #008000)]
               RenderBlock {P} at (1,17) size 366x265
-                RenderText {#text} at (0,157) size 104x18
-                  text run at (0,157) width 104: "This line of text "
                 RenderImage {IMG} at (236,157) size 130x100 [bgcolor=#008000]
-                RenderText {#text} at (104,157) size 236x108
-                  text run at (104,157) width 132: "should not get out of"
+                RenderText {#text} at (0,157) size 236x108
+                  text run at (0,157) width 236: "This line of text should not get out of"
                   text run at (0,175) width 26: "the "
                   text run at (26,175) width 210: "region. This line of text should"
                   text run at (0,193) width 236: "not get out of the region. This line of"

Modified: trunk/Source/WebCore/ChangeLog (96161 => 96162)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 22:04:21 UTC (rev 96161)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 22:11:41 UTC (rev 96162)
@@ -1,3 +1,16 @@
+2011-09-27  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=68940
+
+        Narrow the float/lines pagination heuristic to only kick in if
+        the previous line broke cleanly and if the floats are occurring
+        at the start of the line.
+
+        Reviewed by Dan Bernstein.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::positionNewFloatOnLine):
+
 2011-09-27  James Robinson  <jam...@chromium.org>
 
         Add a mechanism to test for the compositing tree mutated during painting

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (96161 => 96162)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2011-09-27 22:04:21 UTC (rev 96161)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2011-09-27 22:11:41 UTC (rev 96162)
@@ -2653,7 +2653,10 @@
 
     width.shrinkAvailableWidthForNewFloatIfNeeded(newFloat);
 
-    if (!newFloat->m_paginationStrut)
+    // We only connect floats to lines for pagination purposes if the floats occur at the start of
+    // the line and the previous line had a hard break (so this line is either the first in the block
+    // or follows a <br>).
+    if (!newFloat->m_paginationStrut || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty())
         return true;
 
     const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
@@ -2689,16 +2692,9 @@
         }
     }
 
-    if (lineInfo.isEmpty()) {
-        // Just update the line info's pagination strut without altering our logical height yet. If the line ends up containing
-        // no content, then we don't want to improperly grow the height of the block.
-        lineInfo.setFloatPaginationStrut(lineInfo.floatPaginationStrut() + paginationStrut);
-    } else {
-        // The line already has content on it, so we want to go ahead and shift everything down.
-        setLogicalHeight(logicalHeight() + paginationStrut);
-        width.updateAvailableWidth();
-    }
-
+    // Just update the line info's pagination strut without altering our logical height yet. If the line ends up containing
+    // no content, then we don't want to improperly grow the height of the block.
+    lineInfo.setFloatPaginationStrut(lineInfo.floatPaginationStrut() + paginationStrut);
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to