Title: [150065] trunk
Revision
150065
Author
commit-qu...@webkit.org
Date
2013-05-14 05:27:03 -0700 (Tue, 14 May 2013)

Log Message

Ellipsis text is placed to wrong position, when the truncated text is fully cut off in RTL direction.
https://bugs.webkit.org/show_bug.cgi?id=115858

Patch by Zalan Bujtas <za...@apple.com> on 2013-05-14
Reviewed by Darin Adler.

Source/WebCore:

Take text direction into account to calculate ellipsis position in case of
full truncation.

Test: fast/css/text-overflow-ellipsis-full-truncate-rtl.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::placeEllipsisBox):

LayoutTests:

* fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html: Added.
* fast/css/text-overflow-ellipsis-full-truncate-rtl.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (150064 => 150065)


--- trunk/LayoutTests/ChangeLog	2013-05-14 11:37:46 UTC (rev 150064)
+++ trunk/LayoutTests/ChangeLog	2013-05-14 12:27:03 UTC (rev 150065)
@@ -1,3 +1,13 @@
+2013-05-14  Zalan Bujtas  <za...@apple.com>
+
+        Ellipsis text is placed to wrong position, when the truncated text is fully cut off in RTL direction.
+        https://bugs.webkit.org/show_bug.cgi?id=115858
+
+        Reviewed by Darin Adler.
+
+        * fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html: Added.
+        * fast/css/text-overflow-ellipsis-full-truncate-rtl.html: Added.
+
 2013-05-14  Zoltan Arvai  <zar...@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening.

Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html (0 => 150065)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl-expected.html	2013-05-14 12:27:03 UTC (rev 150065)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html dir='rtl'>
+<head>
+<style>
+  div {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+  }
+
+  input {
+    float: left;
+  }
+</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>
+</body>
+</div>
+

Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl.html (0 => 150065)


--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-full-truncate-rtl.html	2013-05-14 12:27:03 UTC (rev 150065)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html dir='rtl'>
+<head>
+<style>
+  div {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+  }
+
+  input {
+    float: left;
+  }
+</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>
+</body>
+</div>
+

Modified: trunk/Source/WebCore/ChangeLog (150064 => 150065)


--- trunk/Source/WebCore/ChangeLog	2013-05-14 11:37:46 UTC (rev 150064)
+++ trunk/Source/WebCore/ChangeLog	2013-05-14 12:27:03 UTC (rev 150065)
@@ -1,3 +1,18 @@
+2013-05-14  Zalan Bujtas  <za...@apple.com>
+
+        Ellipsis text is placed to wrong position, when the truncated text is fully cut off in RTL direction.
+        https://bugs.webkit.org/show_bug.cgi?id=115858
+
+        Reviewed by Darin Adler.
+
+        Take text direction into account to calculate ellipsis position in case of
+        full truncation.
+
+        Test: fast/css/text-overflow-ellipsis-full-truncate-rtl.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::placeEllipsisBox):
+
 2013-05-14  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [BlackBerry] Implement platform strategies

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (150064 => 150065)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2013-05-14 11:37:46 UTC (rev 150064)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2013-05-14 12:27:03 UTC (rev 150065)
@@ -289,7 +289,7 @@
             // and the ellipsis edge.
             m_truncation = cFullTruncation;
             truncatedWidth += ellipsisWidth;
-            return min(ellipsisX, x());
+            return flowIsLTR ? min(ellipsisX, x()) : max(ellipsisX, right() - ellipsisWidth);
         }
 
         // Set the truncation index on the text run.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to