Bug 105600 - REGRESSION (r138196): Regions with text-overflow: ellipsis; are being ellipsized unnecessarily
Summary: REGRESSION (r138196): Regions with text-overflow: ellipsis; are being ellipsi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Emil A Eklund
URL: https://github.com/scalatra/scalatra/
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2012-12-20 18:35 PST by Mark Rowe (bdash)
Modified: 2012-12-28 10:34 PST (History)
7 users (show)

See Also:


Attachments
Patch (4.59 KB, patch)
2012-12-26 13:00 PST, Emil A Eklund
darin: review+
Details | Formatted Diff | Diff
Patch for landing (5.30 KB, patch)
2012-12-27 10:37 PST, Emil A Eklund
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rowe (bdash) 2012-12-20 18:35:47 PST
After <http://trac.webkit.org/changeset/138196> I'm seeing unnecessarily ellipsized text on a number of different websites. For instance, on <https://github.com/scalatra/scalatra/> the folder listing includes many ellipsized items. In particular, the first item "akka" is displayed as "ak…" even though the following item is substantially longer and is not itself truncated.

This is also visible on Facebook in the news feed sorting widget. "Most recent" is truncated to "Must rece…", even though there's clearly room for the "nt" to be displayed.
Comment 1 Radar WebKit Bug Importer 2012-12-20 18:37:10 PST
<rdar://problem/12922386>
Comment 2 Levi Weintraub 2012-12-20 19:50:59 PST
If this is urgent for anyone, feel free to roll out the patch. Otherwise Emil or I will take a look tomorrow AM PST (assuming he doesn't look at it tonight).
Comment 3 Emil A Eklund 2012-12-21 09:53:03 PST
Looking into this now.
Comment 4 Emil A Eklund 2012-12-21 11:19:08 PST
I have not been able to reproduce the problem on the github site listed above nor on facebook in a tip of tree safari build regardless of zoom level.
Comment 5 mitz 2012-12-21 11:34:27 PST
You may need to disable screen font substitution and/or enable kerning and ligatures by default to see this. The relevant user defaults are:

WebKitScreenFontSubstitutionEnabled
WebKitKerningAndLigaturesEnabledByDefault
Comment 6 mitz 2012-12-21 11:40:55 PST
(In reply to comment #5)
> You may need to disable screen font substitution and/or enable kerning and ligatures by default to see this. The relevant user defaults are:
> 
> WebKitScreenFontSubstitutionEnabled

This is actually a WebKit preference, so for Safari’s WebKit2 content view you’ll need to use

com.apple.Safari.ContentPageGroupIdentifier.WebKit2ScreenFontSubstitutionEnabled

> WebKitKerningAndLigaturesEnabledByDefault
Comment 7 Emil A Eklund 2012-12-21 11:51:49 PST
Tried setting the defaults as but still does not reproduce. Are there any other settings I might need (or perhaps the defaults needs to be set in a different way)?

$ defaults write com.apple.Safari WebKitScreenFontSubstitutionEnabled 1
$ defaults write com.apple.Safari WebKitKerningAndLigaturesEnabledByDefault 1
$ defaults write com.apple.Safari.ContentPageGroupIdentifier WebKit2ScreenFontSubstitutionEnabled 1
Comment 8 Mark Rowe (bdash) 2012-12-21 11:53:55 PST
The last one should be:

$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2ScreenFontSubstitutionEnabled 1
Comment 9 Emil A Eklund 2012-12-21 12:27:30 PST
(In reply to comment #8)
> The last one should be:
> 
> $ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2ScreenFontSubstitutionEnabled 1

Ah, thanks. Sadly I'm still not able to reproduce the problem.
Comment 10 mitz 2012-12-22 09:41:51 PST
(In reply to comment #9)
> (In reply to comment #8)
> > The last one should be:
> > 
> > $ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2ScreenFontSubstitutionEnabled 1
> 
> Ah, thanks. Sadly I'm still not able to reproduce the problem.

1 (or YES) is the default on Mountain Lion and earlier. In order to be able to reproduce the problem, please try

$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2ScreenFontSubstitutionEnabled 0
Comment 11 Emil A Eklund 2012-12-26 10:26:59 PST
(In reply to comment #10)
> 1 (or YES) is the default on Mountain Lion and earlier. In order to be able to reproduce the problem, please try
> 
> $ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2ScreenFontSubstitutionEnabled 0

That did the trick, thanks!
Comment 12 Emil A Eklund 2012-12-26 13:00:10 PST
Created attachment 180761 [details]
Patch
Comment 13 Darin Adler 2012-12-26 17:44:46 PST
Comment on attachment 180761 [details]
Patch

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

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:3206
> +        int lineBoxEdge = ltr ? snapSizeToPixel(curr->x() + curr->logicalWidth(), curr->x()) : snapSizeToPixel(curr->x(), 0);

Is there a way to write the two snaps more consistently. I’m concerned that curr->x() ends up being the reference value when it’s LTR, but 0 when it’s RTL. Does not seem quite right. And the test case only covers LTR, so the RTL code could be wrong and the test would not show us.
Comment 14 Emil A Eklund 2012-12-27 10:36:35 PST
(In reply to comment #13)
> (From update of attachment 180761 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=180761&action=review
> 
> > Source/WebCore/rendering/RenderBlockLineLayout.cpp:3206
> > +        int lineBoxEdge = ltr ? snapSizeToPixel(curr->x() + curr->logicalWidth(), curr->x()) : snapSizeToPixel(curr->x(), 0);
> 
> Is there a way to write the two snaps more consistently. I’m concerned that curr->x() ends up being the reference value when it’s LTR, but 0 when it’s RTL. Does not seem quite right. And the test case only covers LTR, so the RTL code could be wrong and the test would not show us.

I tested with both LTR and RTL content and both resulted in incorrect truncation. The proposed change fixes the problem for both LTR and RTL and the snapping matches the logic we use for snapping rtl content elsewhere. I'll updated the patch to include a test for RTL content.
Comment 15 Emil A Eklund 2012-12-27 10:37:15 PST
Created attachment 180811 [details]
Patch for landing
Comment 16 Emil A Eklund 2012-12-28 10:34:39 PST
Committed r138543: <http://trac.webkit.org/changeset/138543>