Title: [152793] trunk
Revision
152793
Author
[email protected]
Date
2013-07-17 11:46:39 -0700 (Wed, 17 Jul 2013)

Log Message

Wrong linebox height, when block element parent has vertical-align property defined.
https://bugs.webkit.org/show_bug.cgi?id=118245

Patch by Zalan Bujtas <[email protected]> on 2013-07-17
Reviewed by David Hyatt.

Do not push the current element to the next, when it is still considered empty, even with
some object(s) in front. Behave as if it was actually empty.
Inline elements like <span></span> generate such lines.

Source/WebCore:

Test: fast/css/empty-span-with-parent-div-and-vertical-align.html

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

LayoutTests:

* fast/css/empty-span-with-parent-div-and-vertical-align-expected.html: Added.
* fast/css/empty-span-with-parent-div-and-vertical-align.html: Added.
* platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.png: Rebased.
* platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.txt: Rebased.
* platform/mac/tables/mozilla/marvin/backgr_index-expected.png: Rebased.
* platform/mac/tables/mozilla/marvin/backgr_index-expected.txt: Rebased.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152792 => 152793)


--- trunk/LayoutTests/ChangeLog	2013-07-17 18:35:06 UTC (rev 152792)
+++ trunk/LayoutTests/ChangeLog	2013-07-17 18:46:39 UTC (rev 152793)
@@ -1,3 +1,21 @@
+2013-07-17  Zalan Bujtas  <[email protected]>
+
+        Wrong linebox height, when block element parent has vertical-align property defined.
+        https://bugs.webkit.org/show_bug.cgi?id=118245
+
+        Reviewed by David Hyatt.
+
+        Do not push the current element to the next, when it is still considered empty, even with
+        some object(s) in front. Behave as if it was actually empty.
+        Inline elements like <span></span> generate such lines.
+
+        * fast/css/empty-span-with-parent-div-and-vertical-align-expected.html: Added.
+        * fast/css/empty-span-with-parent-div-and-vertical-align.html: Added.
+        * platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.png: Rebased.
+        * platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.txt: Rebased.
+        * platform/mac/tables/mozilla/marvin/backgr_index-expected.png: Rebased.
+        * platform/mac/tables/mozilla/marvin/backgr_index-expected.txt: Rebased.
+
 2013-07-17  Alex Christensen  <[email protected]>
 
         Unreviewed. Skip failing WebGL tests.

Added: trunk/LayoutTests/fast/css/empty-span-with-parent-div-and-vertical-align-expected.html (0 => 152793)


--- trunk/LayoutTests/fast/css/empty-span-with-parent-div-and-vertical-align-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/empty-span-with-parent-div-and-vertical-align-expected.html	2013-07-17 18:46:39 UTC (rev 152793)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+    .va { 
+      width: 30px; 
+      background: green; 
+    }
+  </style>
+</head>
+<body>
+  <div>This tests that no new line is added for the input, when the child inline element is empty.</div>
+  <div class="va">
+    <input type="submit">
+  </div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/empty-span-with-parent-div-and-vertical-align.html (0 => 152793)


--- trunk/LayoutTests/fast/css/empty-span-with-parent-div-and-vertical-align.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/empty-span-with-parent-div-and-vertical-align.html	2013-07-17 18:46:39 UTC (rev 152793)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+    .va {
+      width: 30px;
+      background: green;
+      vertical-align: 100px;
+    }
+  </style>
+</head>
+<body>
+  <div>This tests that no new line is added for the input, when the child inline element is empty.</div>
+  <div class="va">
+    <span></span><input type="submit">
+  </div>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.txt (152792 => 152793)


--- trunk/LayoutTests/platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.txt	2013-07-17 18:35:06 UTC (rev 152792)
+++ trunk/LayoutTests/platform/mac/fast/lists/inlineBoxWrapperNullCheck-expected.txt	2013-07-17 18:46:39 UTC (rev 152793)
@@ -6,7 +6,7 @@
       RenderBlock {DIV} at (0,0) size 190x26
         RenderBlock {UL} at (0,0) size 190x26
           RenderListItem {LI} at (40,0) size 150x26
-            RenderListMarker at (0,0) size 7x18: bullet
+            RenderListMarker at (-17,8) size 7x18: bullet
             RenderInline {A} at (0,0) size 201x18
               RenderText {#text} at (0,0) size 0x0
               RenderImage {IMG} at (0,0) size 201x22

Modified: trunk/LayoutTests/platform/mac/tables/mozilla/marvin/backgr_index-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/tables/mozilla/marvin/backgr_index-expected.txt (152792 => 152793)


--- trunk/LayoutTests/platform/mac/tables/mozilla/marvin/backgr_index-expected.txt	2013-07-17 18:35:06 UTC (rev 152792)
+++ trunk/LayoutTests/platform/mac/tables/mozilla/marvin/backgr_index-expected.txt	2013-07-17 18:46:39 UTC (rev 152793)
@@ -1,8 +1,8 @@
-layer at (0,0) size 827x1744
+layer at (0,0) size 827x1729
   RenderView at (0,0) size 785x585
-layer at (0,0) size 785x1744
-  RenderBlock {HTML} at (0,0) size 785x1744
-    RenderBody {BODY} at (8,17) size 769x1714 [color=#00FF00] [bgcolor=#333333]
+layer at (0,0) size 785x1729
+  RenderBlock {HTML} at (0,0) size 785x1729
+    RenderBody {BODY} at (8,17) size 769x1699 [color=#00FF00] [bgcolor=#333333]
       RenderBlock {H1} at (0,0) size 769x30
         RenderText {#text} at (0,0) size 528x30
           text run at (0,0) width 528: "CSS2 Table Backgrounds Test Suite"
@@ -29,7 +29,7 @@
       RenderBlock {P} at (0,232) size 769x15
         RenderText {#text} at (0,0) size 392x15
           text run at (0,0) width 392: "The images used as backgrounds are the following:"
-      RenderBlock {UL} at (0,260) size 769x745
+      RenderBlock {UL} at (0,260) size 769x730
         RenderListItem {LI} at (40,0) size 729x33
           RenderListMarker at (-16,18) size 6x15: bullet
           RenderImage {IMG} at (0,0) size 80x30
@@ -38,24 +38,24 @@
           RenderListMarker at (-16,68) size 6x15: bullet
           RenderImage {IMG} at (0,0) size 30x80
           RenderText {#text} at (0,0) size 0x0
-        RenderListItem {LI} at (40,116) size 729x629
-          RenderListMarker at (-16,0) size 6x15: bullet
-          RenderImage {IMG} at (0,15) size 779x611
+        RenderListItem {LI} at (40,116) size 729x614
+          RenderListMarker at (-16,599) size 6x15: bullet
+          RenderImage {IMG} at (0,0) size 779x611
           RenderText {#text} at (0,0) size 0x0
-      RenderBlock {P} at (0,1018) size 769x15
+      RenderBlock {P} at (0,1003) size 769x15
         RenderText {#text} at (0,0) size 336x15
           text run at (0,0) width 336: "They are in GIF format, with transparency."
-      RenderBlock {P} at (0,1046) size 769x30
+      RenderBlock {P} at (0,1031) size 769x30
         RenderText {#text} at (0,0) size 760x30
           text run at (0,0) width 760: "Each color band in the rainbow backgrounds is 20 pixels wide. Each stripe within the color band"
           text run at (0,15) width 152: "is two pixels wide."
-      RenderBlock {P} at (0,1089) size 769x15
+      RenderBlock {P} at (0,1074) size 769x15
         RenderText {#text} at (0,0) size 728x15
           text run at (0,0) width 728: "The aqua and purple band is 10 pixels wide. Each stripe within the band is two pixels wide."
-      RenderBlock {P} at (0,1117) size 769x15
+      RenderBlock {P} at (0,1102) size 769x15
         RenderText {#text} at (0,0) size 744x15
           text run at (0,0) width 744: "Many image background rules in this test suite are backed up with a 'black' background color."
-      RenderBlock {P} at (0,1145) size 769x60
+      RenderBlock {P} at (0,1130) size 769x60
         RenderText {#text} at (0,0) size 232x15
           text run at (0,0) width 232: "This test suite assumes that "
         RenderInline {STRONG} at (0,0) size 720x30
@@ -75,10 +75,10 @@
             text run at (0,45) width 56: "<tfoot>"
         RenderText {#text} at (56,45) size 8x15
           text run at (56,45) width 8: "."
-      RenderBlock {H2} at (0,1221) size 769x23
+      RenderBlock {H2} at (0,1206) size 769x23
         RenderText {#text} at (0,0) size 204x23
           text run at (0,0) width 204: "Table of Contents"
-      RenderBlock {OL} at (0,1260) size 769x454
+      RenderBlock {OL} at (0,1245) size 769x454
         RenderListItem {LI} at (40,0) size 729x105
           RenderBlock (anonymous) at (0,0) size 729x15
             RenderListMarker at (-28,0) size 24x15: "A"

Modified: trunk/Source/WebCore/ChangeLog (152792 => 152793)


--- trunk/Source/WebCore/ChangeLog	2013-07-17 18:35:06 UTC (rev 152792)
+++ trunk/Source/WebCore/ChangeLog	2013-07-17 18:46:39 UTC (rev 152793)
@@ -1,3 +1,19 @@
+2013-07-17  Zalan Bujtas  <[email protected]>
+
+        Wrong linebox height, when block element parent has vertical-align property defined.
+        https://bugs.webkit.org/show_bug.cgi?id=118245
+
+        Reviewed by David Hyatt.
+
+        Do not push the current element to the next, when it is still considered empty, even with
+        some object(s) in front. Behave as if it was actually empty.
+        Inline elements like <span></span> generate such lines.
+
+        Test: fast/css/empty-span-with-parent-div-and-vertical-align.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
+
 2013-07-17  Andreas Kling  <[email protected]>
 
         CSS selector list splitting should be by component, not by selector.

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (152792 => 152793)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-07-17 18:35:06 UTC (rev 152792)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-07-17 18:46:39 UTC (rev 152793)
@@ -3504,22 +3504,31 @@
     bool segmentAllowsOverflow = true;
 #endif
 
-    if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR()) && segmentAllowsOverflow) {
-        // we just add as much as possible
-        if (blockStyle->whiteSpace() == PRE && !current.m_pos) {
-            lBreak.moveTo(last, last->isText() ? last->length() : 0);
-        } else if (lBreak.m_obj) {
-            // Don't ever break in the middle of a word if we can help it.
-            // There's no room at all. We just have to be on this line,
-            // even though we'll spill out.
-            lBreak.moveTo(current.m_obj, current.m_pos);
+    if (segmentAllowsOverflow) {
+        if (lBreak == resolver.position()) {
+            if (!lBreak.m_obj || !lBreak.m_obj->isBR()) {
+                // we just add as much as possible
+                if (blockStyle->whiteSpace() == PRE && !current.m_pos) {
+                    lBreak.moveTo(last, last->isText() ? last->length() : 0);
+                } else if (lBreak.m_obj) {
+                    // Don't ever break in the middle of a word if we can help it.
+                    // There's no room at all. We just have to be on this line,
+                    // even though we'll spill out.
+                    lBreak.moveTo(current.m_obj, current.m_pos);
+                }
+            }
+            // make sure we consume at least one char/object.
+            if (lBreak == resolver.position())
+                lBreak.increment();
+        } else if (!width.committedWidth() && (!current.m_obj || !current.m_obj->isBR()) && !current.m_pos) {
+            // Do not push the current object to the next line, when this line has some content, but it is still considered empty.
+            // Empty inline elements like <span></span> can produce such lines and now we just ignore these break opportunities
+            // at the start of a line, if no width has been committed yet.
+            // Behave as if it was actually empty and consume at least one object.
+            lBreak.increment();
         }
     }
 
-    // make sure we consume at least one char/object.
-    if (lBreak == resolver.position() && segmentAllowsOverflow)
-        lBreak.increment();
-
     // Sanity check our midpoints.
     checkMidpoints(lineMidpointState, lBreak);
 
@@ -3608,7 +3617,7 @@
             if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width)) {
                 float totalLogicalWidth = curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge, blockRightEdge, width);
 
-                float logicalLeft = 0; // We are only intersted in the delta from the base position.
+                float logicalLeft = 0; // We are only interested in the delta from the base position.
                 float truncatedWidth = pixelSnappedLogicalRightOffsetForLine(curr->lineTop(), firstLine);
                 updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
                 if (ltr)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to