Bug 24186 - Regression RTL: text truncation with text-overflow:ellipsis does not work correctly
Summary: Regression RTL: text truncation with text-overflow:ellipsis does not work cor...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
Keywords: Regression
Depends on:
Reported: 2009-02-26 00:28 PST by Xiaomei Ji
Modified: 2009-05-13 15:33 PDT (History)
4 users (show)

See Also:

text overflow truncation (659 bytes, text/html)
2009-02-26 00:29 PST, Xiaomei Ji
no flags Details
Patch 1 (3.55 KB, patch)
2009-04-10 14:55 PDT, Jeremy Moskovich
no flags Details | Formatted Diff | Diff
Patch 2 (3.66 KB, patch)
2009-04-10 15:03 PDT, Jeremy Moskovich
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xiaomei Ji 2009-02-26 00:28:01 PST
This is a regression, happens in nightly build r41128, but not in Safari 3.2.1.

Bidi text "MSN Arabia رياضه، أخبار، مرآة، أفلام، موسيقى، جمال، سيارات، اقتصاد و المزيد على" was truncated wrong when the following style was specified:

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 207px;

The truncation seems wrongly truncated the leading English characters.

test case is attached.
Comment 1 Xiaomei Ji 2009-02-26 00:29:00 PST
Created attachment 28008 [details]
text overflow truncation
Comment 2 Xiaomei Ji 2009-02-26 00:32:59 PST
Also in Chrome bug
Comment 3 Jeremy Moskovich 2009-04-10 14:48:58 PDT
The reason that the English text run is truncated is because of the way the loop in InlineFlowBox::placeEllipsisBox() works.

It iterates over all of it's children from left to right till it finds the one containing the ellipsis, all boxes after that one are marked as hidden.  This happens when foundBox is set to true.

The fix is to change the order of iteration for the RTL case so we can correctly truncate the children to the left of the ellipsis.
Comment 4 Jeremy Moskovich 2009-04-10 14:55:32 PDT
Created attachment 29400 [details]
Patch 1

Vary the order of iteration based on direction.
Comment 5 Jeremy Moskovich 2009-04-10 15:03:38 PDT
Created attachment 29401 [details]
Patch 2

Add bug URL to changelog
Comment 6 Jeremy Moskovich 2009-05-01 15:22:54 PDT
Comment on attachment 29401 [details]
Patch 2

Clearing review flag since I'm rolling this fix into the patch for bug 25135.
Comment 7 Dimitri Glazkov (Google) 2009-05-13 15:33:50 PDT
Fixed in http://trac.webkit.org/changeset/43664.