Bug 147977

Summary: First line box in paragraph using initial-letter overflows.
Product: WebKit Reporter: Dave Cramer <dauwhe>
Component: CSSAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eoconnor, esprehn+autocc, glenn, hendry, hyatt, jensimmons, kondapallykalyan, mmaxfield, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.9   
Attachments:
Description Flags
HTML file showing horizontal scrollbar when initial-letter is used.
none
Patch
none
Patch none

Description Dave Cramer 2015-08-13 08:22:36 PDT
Created attachment 258890 [details]
HTML file showing horizontal scrollbar when initial-letter is used.

When a paragraph contains an initial-letter, it appears the line box containing the first line of ordinary text is not shortened by the width of the initial letter. This results in the first line of text overflowing, and a horizontal scrollbar is always present regardless of the width of the window. 

Test file attached; the problem is more obvious when the paragraph is justified. 

Dave
Comment 1 Radar WebKit Bug Importer 2015-09-29 12:22:48 PDT
<rdar://problem/22901553>
Comment 2 Kai Hendry 2015-10-13 16:39:31 PDT
Hi there, I have this issue too on my blog:
http://s.natalian.org/2015-10-11/cutoff.png

http://natalian.org/style.css
Comment 3 zalan 2015-10-16 12:06:15 PDT
Created attachment 263305 [details]
Patch
Comment 4 Dave Hyatt 2015-10-16 12:11:18 PDT
Comment on attachment 263305 [details]
Patch

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

r=me

> Source/WebCore/ChangeLog:11
> +        This because of the sunken behaviour of initial-letter. 

"This is because of"

> Source/WebCore/rendering/line/LineWidth.cpp:86
> +    const RenderStyle& style = newFloat.renderer().style();

auto.

> Source/WebCore/rendering/line/LineWidth.cpp:105
> +        float newLeft = m_block.logicalRightForFloat(&newFloat);

Could keep going and make logicalRight/LeftForFloat take references instead of pointers, but I guess that could be another patch. :)
Comment 5 zalan 2015-10-16 12:22:21 PDT
Created attachment 263309 [details]
Patch
Comment 6 WebKit Commit Bot 2015-10-16 12:53:55 PDT
Comment on attachment 263309 [details]
Patch

Clearing flags on attachment: 263309

Committed r191195: <http://trac.webkit.org/changeset/191195>
Comment 7 WebKit Commit Bot 2015-10-16 12:54:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 zalan 2015-10-16 13:12:44 PDT
This needs some iOS and Win rebaselining.
Comment 9 Jen Simmons 2016-03-21 16:49:22 PDT
Dang. I'm quite disappointed that this did not make it into Safari 9.1. I'd started teaching it in my 2016 conference talk on layouts, and people are excited about drop and raised caps. There's no way we can use Initial Letter until this bug fix ships. I'm going to have to pull it from my talk, since Fall 2016 is the earliest I'd expect this to ship now...

:/

Anything any of us can do to help? Are there additional bugs that have to be fixed first? Any reason that someone can reveal about why this fix was not shipped? I'm all for using things early, when few browsers support, with progressive enhancement techniques. But this bug is a blocker. There's no way to use -webkit-initial-letter until this is fixed in Safari.
Comment 10 Simon Fraser (smfr) 2016-03-22 13:17:53 PDT
(In reply to comment #9)
> Anything any of us can do to help?

The main thing you can do is to file bugs, either here or (more effectively) at bugreport.apple.com expressing your desire to have this bug fixed. The report should describe the impact of not fixing the bug to allow us to judge impact.