Title: [150602] trunk
Revision
150602
Author
[email protected]
Date
2013-05-23 11:55:53 -0700 (Thu, 23 May 2013)

Log Message

The ellipsis in a text overflow should not avoid floats
https://bugs.webkit.org/show_bug.cgi?id=115746

Reviewed by David Hyatt.

Source/WebCore:

When placing an ellipsis for text overflow we shouldn't avoid any floats on the line.
That is to say, if there is a float in the box we overflow we should let our no-wrap text,
including the ellipsis, render inside the float just as we would if overflow was hidden but
a text-overflow rendering had not been specified.

Test: fast/css/text-overflow-ellipsis-behind-floats.html

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

LayoutTests:

* fast/css/text-overflow-ellipsis-behind-floats-expected.html: Added.
* fast/css/text-overflow-ellipsis-behind-floats.html: Added.
* fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html:
* fast/css/text-overflow-ellipsis-full-truncate-rtl.html:
  Change this test to expect the text to cross into the floating input element
  and render the ellipsis at the left extreme of the element. The previous expected
  rendering relied on the incorrect premise that an overflow ellipsis should avoid
  floated elements.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (150601 => 150602)


--- trunk/LayoutTests/ChangeLog	2013-05-23 18:51:57 UTC (rev 150601)
+++ trunk/LayoutTests/ChangeLog	2013-05-23 18:55:53 UTC (rev 150602)
@@ -1,3 +1,19 @@
+2013-05-18  Robert Hogan  <[email protected]>
+
+        The ellipsis in a text overflow should not avoid floats
+        https://bugs.webkit.org/show_bug.cgi?id=115746
+
+        Reviewed by David Hyatt.
+
+        * fast/css/text-overflow-ellipsis-behind-floats-expected.html: Added.
+        * fast/css/text-overflow-ellipsis-behind-floats.html: Added.
+        * fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html:
+        * fast/css/text-overflow-ellipsis-full-truncate-rtl.html:
+          Change this test to expect the text to cross into the floating input element
+          and render the ellipsis at the left extreme of the element. The previous expected
+          rendering relied on the incorrect premise that an overflow ellipsis should avoid
+          floated elements.
+
 2013-05-23  Ryosuke Niwa  <[email protected]>
 
         [Lion] [WK2] compositing/overflow/overflow-compositing-descendant.html

Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats-expected.html (0 => 150602)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats-expected.html	2013-05-23 18:55:53 UTC (rev 150602)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  div {
+    overflow: hidden;
+    white-space: nowrap;
+  }
+
+ .ellipsis {
+    text-overflow: ellipsis;
+  }
+
+</style>
+</head>
+<body>
+
+<div class="ellipsis">
+<div id="float"></div>
+1. 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.
+</div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats.html (0 => 150602)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats.html	2013-05-23 18:55:53 UTC (rev 150602)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  div {
+    overflow: hidden;
+    white-space: nowrap;
+  }
+
+ #float {
+    float: right; 
+    width: 100px;
+    height: 20px;
+  }
+
+ .ellipsis {
+    text-overflow: ellipsis;
+  }
+
+</style>
+</head>
+<body>
+
+<div class="ellipsis">
+<div id="float"></div>
+1. 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.
+</div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/text-overflow-ellipsis-behind-floats.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html (150601 => 150602)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html	2013-05-23 18:51:57 UTC (rev 150601)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html	2013-05-23 18:55:53 UTC (rev 150602)
@@ -14,7 +14,7 @@
 </style>
 <body>
 <p dir='ltr'>This tests that ellipsis is placed correctly, when full truncation takes over in an rtl flow.</p>
-<div style='width:582px;'><input type="text" size='74'>consectetur adipisicing elit, sed do eiusmod</div>
+<div style='width:582px;'><input type="text" size='74'>consectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elit, sed do eiusmod</div>
 </body>
 </div>
 

Modified: trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl.html (150601 => 150602)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl.html	2013-05-23 18:51:57 UTC (rev 150601)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl.html	2013-05-23 18:55:53 UTC (rev 150602)
@@ -14,7 +14,7 @@
 </style>
 <body>
 <p dir='ltr'>This tests that ellipsis is placed correctly, when full truncation takes over in an rtl flow.</p>
-<div style='width:582px;'><input type="text" size='74'><span>Lorem ipsum dolor sit</span>consectetur adipisicing elit</div>
+<div style='width:582px;'><input type="text" size='74'><span>Lorem ipsum dolor sit</span>consectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elitconsectetur adipisicing elit</div>
 </body>
 </div>
 

Modified: trunk/Source/WebCore/ChangeLog (150601 => 150602)


--- trunk/Source/WebCore/ChangeLog	2013-05-23 18:51:57 UTC (rev 150601)
+++ trunk/Source/WebCore/ChangeLog	2013-05-23 18:55:53 UTC (rev 150602)
@@ -1,3 +1,20 @@
+2013-05-18  Robert Hogan  <[email protected]>
+
+        The ellipsis in a text overflow should not avoid floats
+        https://bugs.webkit.org/show_bug.cgi?id=115746
+
+        Reviewed by David Hyatt.
+
+        When placing an ellipsis for text overflow we shouldn't avoid any floats on the line.
+        That is to say, if there is a float in the box we overflow we should let our no-wrap text,
+        including the ellipsis, render inside the float just as we would if overflow was hidden but
+        a text-overflow rendering had not been specified.
+
+        Test: fast/css/text-overflow-ellipsis-behind-floats.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::checkLinesForTextOverflow):
+
 2013-05-23  Christophe Dumez  <[email protected]>
 
         Unreviewed, rolling out r150586.

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (150601 => 150602)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-05-23 18:51:57 UTC (rev 150601)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-05-23 18:55:53 UTC (rev 150602)
@@ -3497,8 +3497,8 @@
     for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
         // FIXME: Use pixelSnappedLogicalRightOffsetForLine instead of snapping it ourselves once the column workaround in said method has been fixed.
         // https://bugs.webkit.org/show_bug.cgi?id=105461
-        int blockRightEdge = snapSizeToPixel(logicalRightOffsetForLine(curr->lineTop(), firstLine), curr->x());
-        int blockLeftEdge = pixelSnappedLogicalLeftOffsetForLine(curr->lineTop(), firstLine);
+        int blockRightEdge = snapSizeToPixel(ltr ? logicalRightOffsetForContent(curr->lineTop()) : logicalRightOffsetForLine(curr->lineTop(), firstLine), curr->x());
+        int blockLeftEdge = ltr ? pixelSnappedLogicalLeftOffsetForLine(curr->lineTop(), firstLine).toInt() : snapSizeToPixel(logicalLeftOffsetForContent(curr->lineTop()), curr->x());
         int lineBoxEdge = ltr ? snapSizeToPixel(curr->x() + curr->logicalWidth(), curr->x()) : snapSizeToPixel(curr->x(), 0);
         if ((ltr && lineBoxEdge > blockRightEdge) || (!ltr && lineBoxEdge < blockLeftEdge)) {
             // This line spills out of our box in the appropriate direction.  Now we need to see if the line
@@ -3512,7 +3512,7 @@
                 float totalLogicalWidth = curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge, blockRightEdge, width);
 
                 float logicalLeft = 0; // We are only intersted in the delta from the base position.
-                float truncatedWidth = pixelSnappedLogicalRightOffsetForLine(curr->lineTop(), firstLine);
+                float truncatedWidth = snapSizeToPixel(logicalRightOffsetForContent(curr->lineTop()), curr->x());
                 updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
                 if (ltr)
                     curr->adjustLogicalPosition(logicalLeft, 0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to