Title: [143754] trunk
Revision
143754
Author
[email protected]
Date
2013-02-22 10:58:19 -0800 (Fri, 22 Feb 2013)

Log Message

text-overflow:ellipsis is not applied when the block contains nested blocks
https://bugs.webkit.org/show_bug.cgi?id=101879

Patch by Bem Jones-Bey <[email protected]> on 2013-02-22
Reviewed by Eric Seidel.

Source/WebCore:

Since text-overflow is not an inherited property, the anonymous blocks
don't know they should ellipse. This causes the anonymous blocks
created in the nested block situation to check their parent to find
out if they should ellipse.

Test: fast/css/text-overflow-ellipsis-anonymous-blocks.html

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

LayoutTests:

Use the test from the specification that is supplied as part of the
bug.

* fast/css/text-overflow-ellipsis-anonymous-blocks-expected.html: Added.
* fast/css/text-overflow-ellipsis-anonymous-blocks.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143753 => 143754)


--- trunk/LayoutTests/ChangeLog	2013-02-22 18:50:39 UTC (rev 143753)
+++ trunk/LayoutTests/ChangeLog	2013-02-22 18:58:19 UTC (rev 143754)
@@ -1,3 +1,16 @@
+2013-02-22  Bem Jones-Bey  <[email protected]>
+
+        text-overflow:ellipsis is not applied when the block contains nested blocks
+        https://bugs.webkit.org/show_bug.cgi?id=101879
+
+        Reviewed by Eric Seidel.
+
+        Use the test from the specification that is supplied as part of the
+        bug.
+
+        * fast/css/text-overflow-ellipsis-anonymous-blocks-expected.html: Added.
+        * fast/css/text-overflow-ellipsis-anonymous-blocks.html: Added.
+
 2013-02-22  Raphael Kubo da Costa  <[email protected]>
 
         [WTR] Do not dump information about empty subframes.

Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-anonymous-blocks-expected.html (0 => 143754)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-anonymous-blocks-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-anonymous-blocks-expected.html	2013-02-22 18:58:19 UTC (rev 143754)
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>test: overflow: ellipis</title>
+<style>
+div { width: 50px; text-overflow:ellipsis; overflow:hidden; }
+</style>
+</head>
+
+<body>
+<p><a href="" 101879</a>: This is a test from the <a href="" 3 ui spec</a> that demonstates proper behavior for a nested block inside of a block that has text-overflow: ellipsis. The only string below that shouldn't have ellipeses is the "PARAGRAPH" string. (But it should be truncated because of overflow: hidden).</p>
+<div style="border: 1px solid"> <div>NESTED</div> <p>PARAGRAPH</p> <div>WON'T</div> <div>ELLIPSE.</div> </div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-anonymous-blocks.html (0 => 143754)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-anonymous-blocks.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-anonymous-blocks.html	2013-02-22 18:58:19 UTC (rev 143754)
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>test: overflow: ellipis</title>
+<style>
+div { width: 50px; text-overflow:ellipsis; overflow:hidden; }
+</style>
+</head>
+
+<body>
+<p><a href="" 101879</a>: This is a test from the <a href="" 3 ui spec</a> that demonstates proper behavior for a nested block inside of a block that has text-overflow: ellipsis. The only string below that shouldn't have ellipeses is the "PARAGRAPH" string. (But it should be truncated because of overflow: hidden).</p>
+<div style="border: 1px solid"> NESTED <p>PARAGRAPH</p> WON'T ELLIPSE. </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143753 => 143754)


--- trunk/Source/WebCore/ChangeLog	2013-02-22 18:50:39 UTC (rev 143753)
+++ trunk/Source/WebCore/ChangeLog	2013-02-22 18:58:19 UTC (rev 143754)
@@ -1,3 +1,20 @@
+2013-02-22  Bem Jones-Bey  <[email protected]>
+
+        text-overflow:ellipsis is not applied when the block contains nested blocks
+        https://bugs.webkit.org/show_bug.cgi?id=101879
+
+        Reviewed by Eric Seidel.
+
+        Since text-overflow is not an inherited property, the anonymous blocks
+        don't know they should ellipse. This causes the anonymous blocks
+        created in the nested block situation to check their parent to find
+        out if they should ellipse.
+
+        Test: fast/css/text-overflow-ellipsis-anonymous-blocks.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::layoutInlineChildren):
+
 2013-02-22  Eric Seidel  <[email protected]>
 
         REGRESSION(r143664, r143681): http/tests/security/feed-urls-from-remote.html fails

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (143753 => 143754)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-02-22 18:50:39 UTC (rev 143753)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-02-22 18:58:19 UTC (rev 143754)
@@ -1828,12 +1828,14 @@
     if (isFullLayout)
         lineBoxes()->deleteLineBoxes(renderArena());
 
-    // Text truncation only kicks in if your overflow isn't visible and your text-overflow-mode isn't
-    // clip.
+    // Text truncation kicks in in two cases:
+    //     1) If your overflow isn't visible and your text-overflow-mode isn't clip.
+    //     2) If you're an anonymous block with a block parent that satisfies #1.
     // FIXME: CSS3 says that descendants that are clipped must also know how to truncate.  This is insanely
-    // difficult to figure out (especially in the middle of doing layout), and is really an esoteric pile of nonsense
-    // anyway, so we won't worry about following the draft here.
-    bool hasTextOverflow = style()->textOverflow() && hasOverflowClip();
+    // difficult to figure out in general (especially in the middle of doing layout), so we only handle the
+    // simple case of an anonymous block truncating when it's parent is clipped.
+    bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip())
+        || (isAnonymousBlock() && parent() && parent()->isRenderBlock() && parent()->style()->textOverflow() && parent()->hasOverflowClip());
 
     // Walk all the lines and delete our ellipsis line boxes if they exist.
     if (hasTextOverflow)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to