Title: [138196] trunk
Revision
138196
Author
e...@chromium.org
Date
2012-12-19 15:07:55 -0800 (Wed, 19 Dec 2012)

Log Message

[Regression] text-overflow ellipsis clips content when zoomed
https://bugs.webkit.org/show_bug.cgi?id=105456

Reviewed by Levi Weintraub.

Source/WebCore: 

At certain zoom levels text-overflow ellipsis incorrectly clips
content and displays the ellipsis even though the full content
would fit.

Test: fast/sub-pixel/ellipsis-zoom.html
        
* rendering/RenderBlock.h:
(WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine):
Add bug url to FIXME.
        
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::checkLinesForTextOverflow):
Pixel snap the content edge before comparing with the line box
edge as the line box edge is aligned to a pixel boundary.

LayoutTests: 

Add test for text-overflow: ellipsis.

* fast/sub-pixel/ellipsis-zoom-expected.html: Added.
* fast/sub-pixel/ellipsis-zoom.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138195 => 138196)


--- trunk/LayoutTests/ChangeLog	2012-12-19 22:39:28 UTC (rev 138195)
+++ trunk/LayoutTests/ChangeLog	2012-12-19 23:07:55 UTC (rev 138196)
@@ -1,3 +1,15 @@
+2012-12-19  Emil A Eklund  <e...@chromium.org>
+
+        [Regression] text-overflow ellipsis clips content when zoomed
+        https://bugs.webkit.org/show_bug.cgi?id=105456
+
+        Reviewed by Levi Weintraub.
+
+        Add test for text-overflow: ellipsis.
+
+        * fast/sub-pixel/ellipsis-zoom-expected.html: Added.
+        * fast/sub-pixel/ellipsis-zoom.html: Added.
+
 2012-12-19  Levi Weintraub  <le...@chromium.org>
 
         Re-skipping touch-input-element-chang-documents.html since it's still

Added: trunk/LayoutTests/fast/sub-pixel/ellipsis-zoom-expected.html (0 => 138196)


--- trunk/LayoutTests/fast/sub-pixel/ellipsis-zoom-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/ellipsis-zoom-expected.html	2012-12-19 23:07:55 UTC (rev 138196)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            .test > div { display: inline-block; white-space: nowrap; padding: 0 1px; }
+        </style>
+    </head>
+    <body>
+        <div class="test" style="zoom: 0.5;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 0.66;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 0.75;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 0.9;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.0;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.1;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.25;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.33;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <p>
+            None of the lines above should be truncated.
+        </p>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/sub-pixel/ellipsis-zoom.html (0 => 138196)


--- trunk/LayoutTests/fast/sub-pixel/ellipsis-zoom.html	                        (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/ellipsis-zoom.html	2012-12-19 23:07:55 UTC (rev 138196)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            .test > div { display: inline-block; overflow: hidden; white-space: nowrap; padding: 0 1px; }
+            .test > .ellipsis { text-overflow: ellipsis; }
+        </style>
+    </head>
+    <body>
+        <div class="test" style="zoom: 0.5;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 0.66;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 0.75;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 0.9;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.0;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.1;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.25;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <div class="test" style="zoom: 1.33;">
+            <div class="ellipsis">Should not be truncated</div><br>
+            <div class="expected">Should not be truncated</div>
+        </div>
+        <p>
+            None of the lines above should be truncated.
+        </p>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (138195 => 138196)


--- trunk/Source/WebCore/ChangeLog	2012-12-19 22:39:28 UTC (rev 138195)
+++ trunk/Source/WebCore/ChangeLog	2012-12-19 23:07:55 UTC (rev 138196)
@@ -1,3 +1,25 @@
+2012-12-19  Emil A Eklund  <e...@chromium.org>
+
+        [Regression] text-overflow ellipsis clips content when zoomed
+        https://bugs.webkit.org/show_bug.cgi?id=105456
+
+        Reviewed by Levi Weintraub.
+
+        At certain zoom levels text-overflow ellipsis incorrectly clips
+        content and displays the ellipsis even though the full content
+        would fit.
+
+        Test: fast/sub-pixel/ellipsis-zoom.html
+        
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine):
+        Add bug url to FIXME.
+        
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::checkLinesForTextOverflow):
+        Pixel snap the content edge before comparing with the line box
+        edge as the line box edge is aligned to a pixel boundary.
+
 2012-12-19  Antti Koivisto  <an...@apple.com>
 
         Use ElementTraversal in LiveNodeListBase

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (138195 => 138196)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2012-12-19 22:39:28 UTC (rev 138195)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2012-12-19 23:07:55 UTC (rev 138196)
@@ -199,6 +199,7 @@
         // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted
         // by a subpixel value for all but the first column. This can lead to the actual pixel snapped width of the column being off
         // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor.
+        // https://bugs.webkit.org/show_bug.cgi?id=105461
         return floorToInt(logicalRightOffsetForLine(position, firstLine, logicalHeight));
     }
     LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine, LayoutUnit logicalHeight = 0) const

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (138195 => 138196)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-12-19 22:39:28 UTC (rev 138195)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-12-19 23:07:55 UTC (rev 138196)
@@ -3199,8 +3199,10 @@
     ETextAlign textAlign = style()->textAlign();
     bool firstLine = true;
     for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
-        LayoutUnit blockRightEdge = logicalRightOffsetForLine(curr->lineTop(), firstLine);
-        LayoutUnit blockLeftEdge = logicalLeftOffsetForLine(curr->lineTop(), firstLine);
+        // 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);
         LayoutUnit lineBoxEdge = ltr ? curr->x() + curr->logicalWidth() : curr->x();
         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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to