Bug 121902 - text-overflow: ellipsis is broken by text-align: right and padding-left
Summary: text-overflow: ellipsis is broken by text-align: right and padding-left
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-09-25 05:05 PDT by Rob Crowther
Modified: 2015-07-27 14:54 PDT (History)
19 users (show)

See Also:


Attachments
Test case demonstrating problem (middle div) (1.15 KB, text/html)
2013-09-25 05:05 PDT, Rob Crowther
no flags Details
Correct display of test case in Firefox 25 (31.83 KB, image/png)
2013-09-25 05:06 PDT, Rob Crowther
no flags Details
Incorrect display of test case in iOS7 (90.89 KB, image/png)
2013-09-25 05:07 PDT, Rob Crowther
no flags Details
Patch (24.68 KB, patch)
2014-02-19 00:46 PST, Deepak Mittal
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (703.89 KB, application/zip)
2014-02-19 01:44 PST, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion (789.61 KB, application/zip)
2014-02-19 02:34 PST, Build Bot
no flags Details
Patch (237.19 KB, patch)
2014-02-24 21:25 PST, Deepak Mittal
no flags Details | Formatted Diff | Diff
Patch (665.84 KB, patch)
2015-07-24 19:36 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Crowther 2013-09-25 05:05:37 PDT
Created attachment 212554 [details]
Test case demonstrating problem (middle div)

If an element has both text-align: right and a value for padding-left then text-overflow: ellipsis is broken, no ellipses appear and the text is flush to the edge of the box.
Comment 1 Rob Crowther 2013-09-25 05:06:37 PDT
Created attachment 212555 [details]
Correct display of test case in Firefox 25
Comment 2 Rob Crowther 2013-09-25 05:07:14 PDT
Created attachment 212556 [details]
Incorrect display of test case in iOS7
Comment 3 Deepak Mittal 2014-02-13 04:47:26 PST
I am working on this issue..
I found the cause of this issue..if possible pleased assigned it to me..
Comment 4 Deepak Mittal 2014-02-19 00:46:28 PST
Created attachment 224604 [details]
Patch
Comment 5 Build Bot 2014-02-19 01:44:43 PST
Comment on attachment 224604 [details]
Patch

Attachment 224604 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4645716538425344

New failing tests:
fast/ruby/ruby-base-merge-block-children-crash-2.html
fast/css/vertical-text-overflow-ellipsis-text-align-right.html
fast/css/text-alignment.html
fast/css/text-overflow-ellipsis-text-align-right.html
Comment 6 Build Bot 2014-02-19 01:44:45 PST
Created attachment 224612 [details]
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-12  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 7 Build Bot 2014-02-19 02:34:56 PST
Comment on attachment 224604 [details]
Patch

Attachment 224604 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/4604709801295872

New failing tests:
fast/ruby/ruby-base-merge-block-children-crash-2.html
fast/css/vertical-text-overflow-ellipsis-text-align-right.html
fast/css/text-alignment.html
fast/css/text-overflow-ellipsis-text-align-right.html
Comment 8 Build Bot 2014-02-19 02:34:58 PST
Created attachment 224615 [details]
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-02  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 9 Deepak Mittal 2014-02-21 01:32:28 PST
I have found that in void RenderBlockFlow::checkLinesForTextOverflow() in RenderBlockLineLayout.cpp file The renderbox is getting shifted by the logicalLeft when TextAlign is RIGHT, that is in this case is 61 and 21, 

So due to this ellipsis are not showing in the second div element and for the third div ellipsis dots are touching right edge of the box.

If I stop this adjustLogicalPosition call as :

if (ltr) {
      if (textAlign == RIGHT)
          logicalLeft = 0;
      curr->adjustLogicalPosition(logicalLeft, 0);
}

Then the issue is not getting reproduced.
But with this below test cases are failing..

fast/ruby/ruby-base-merge-block-children-crash-2.html
fast/css/vertical-text-overflow-ellipsis-text-align-right.html
fast/css/text-alignment.html
fast/css/text-overflow-ellipsis-text-align-right.html
Comment 10 Deepak Mittal 2014-02-24 21:25:37 PST
Created attachment 225120 [details]
Patch
Comment 11 Deepak Mittal 2014-02-24 22:36:53 PST
Please review this patch, and let me know if any query..
Comment 12 zalan 2014-03-01 21:51:16 PST
Comment on attachment 225120 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=225120&action=review

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:2089
> +                        logicalLeft = 0;

Override the value here which is calculated a few line above (in updateLogicalWidthForAlignment()) does not seem to be the right thing to do. I'd look into updateLogicalWidthForAlignment() to figure out why it returns invalid logicalLeft.
Comment 13 Deepak Mittal 2014-03-13 01:46:05 PDT
(In reply to comment #12)
> (From update of attachment 225120 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=225120&action=review
> 
> > Source/WebCore/rendering/RenderBlockLineLayout.cpp:2089
> > +                        logicalLeft = 0;
> 
> Override the value here which is calculated a few line above (in updateLogicalWidthForAlignment()) does not seem to be the right thing to do. I'd look into updateLogicalWidthForAlignment() to figure out why it returns invalid logicalLeft.

This is happening as updateLogicalWidthForAlignment() when textAline is RIGHT, Then logicalLeft will get set to the difference of availableLogicalWidth and the totalLogicalWidth. As

if (totalLogicalWidth < availableLogicalWidth)
            logicalLeft += availableLogicalWidth - totalLogicalWidth;

That is causing the shift of the second box.as a part of adjustLogicalPosition() call.I have checked that in the FF this shifting is not happening so second box is coming properly..
Comment 14 zalan 2014-03-14 10:51:53 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > (From update of attachment 225120 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=225120&action=review
> > 
> > > Source/WebCore/rendering/RenderBlockLineLayout.cpp:2089
> > > +                        logicalLeft = 0;
> > 
> > Override the value here which is calculated a few line above (in updateLogicalWidthForAlignment()) does not seem to be the right thing to do. I'd look into updateLogicalWidthForAlignment() to figure out why it returns invalid logicalLeft.
> 
> This is happening as updateLogicalWidthForAlignment() when textAline is RIGHT, Then logicalLeft will get set to the difference of availableLogicalWidth and the totalLogicalWidth. As
> 
> if (totalLogicalWidth < availableLogicalWidth)
>             logicalLeft += availableLogicalWidth - totalLogicalWidth;
> 
> That is causing the shift of the second box.as a part of adjustLogicalPosition() call.I have checked that in the FF this shifting is not happening so second box is coming properly..
updateLogicalWidthForRightAlignedBlock() seems to have a very specific calculation about this. Your best bet to figure it out is to talk to David Hyatt at #webkit.
Comment 15 Deepak Mittal 2014-03-19 23:32:18 PDT
Hi David Hyatt,
Can you please give your opinion on my patch ..Thanks..
Comment 16 Ben Frain 2015-07-22 03:15:41 PDT
This is problem for us. We have a situation where we are displaying a score board header for Live sports events. The team on the right of the scoreboard that is right aligned fails to get truncated name in Safari/iOS. Fine everywhere else.

Any chance this fix will be in before iOS9? Otherwise we have another year to wait!!
Comment 17 Ben Frain 2015-07-22 03:54:56 PDT
Here is a reduction of our use case, showing the problem that Safari exhibits: http://codepen.io/benfrain/full/JdavXM
Comment 18 Myles C. Maxfield 2015-07-24 19:36:50 PDT
Created attachment 257505 [details]
Patch
Comment 19 WebKit Commit Bot 2015-07-24 20:52:32 PDT
Comment on attachment 257505 [details]
Patch

Clearing flags on attachment: 257505

Committed r187380: <http://trac.webkit.org/changeset/187380>
Comment 20 WebKit Commit Bot 2015-07-24 20:52:40 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Radar WebKit Bug Importer 2015-07-25 01:25:22 PDT
<rdar://problem/21995463>
Comment 22 Alexey Proskuryakov 2015-07-25 18:44:07 PDT
This change broke multiple tests on Windows. Myles, will you have a moment to update the results (assuming that this is all that's needed)?

fast/css/text-overflow-ellipsis-text-align-center.html
fast/css/text-overflow-ellipsis-text-align-left.html
fast/css/text-overflow-ellipsis-text-align-right.html
fast/css/vertical-text-overflow-ellipsis-text-align-center.html
fast/css/vertical-text-overflow-ellipsis-text-align-right.html
fast/inline/padding-ellipsis-right.html
Comment 23 Myles C. Maxfield 2015-07-27 14:54:18 PDT
Committed r187452