Summary: | Paragraphs indented with :first-letter and text-align CSS render incorrectly | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Daniel G. Taylor <dan> | ||||||||||
Component: | Layout and Rendering | Assignee: | mitz | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | mitz, webkit | ||||||||||
Priority: | P2 | Keywords: | HasReduction | ||||||||||
Version: | 523.x (Safari 3) | ||||||||||||
Hardware: | All | ||||||||||||
OS: | All | ||||||||||||
URL: | http://programmer-art.org | ||||||||||||
Attachments: |
|
Description
Daniel G. Taylor
2008-02-02 11:12:08 PST
I have uploaded a simpler example with the two CSS rules and a few paragraphs here: http://programmer-art.org/dropbox/bug.html Created attachment 18888 [details]
test case
uploaded test case
I have just made things worse by changing numSpaces from int to unsigned. The real problem though is that line breaking results in totWidth > availableWidth in computeHorizontalPositionsForLine(). Created attachment 19365 [details]
Reduction showing the root cause
This shows that the problem is line breaking.
Created attachment 19368 [details]
Reduction showing the root cause
This is not even about first-letter. It is just the assumption expressed in findNextLineBreak():
bool appliedStartWidth = pos > 0; // If the span originated on a previous line,
// then assume the start width has been applied.
Created attachment 19370 [details]
Improve the logic for when to apply padding, border and margin before a text node
(In reply to comment #0) > When using the :first-letter CSS to indent paragraphs Out of curiosity, why would you do that instead of using the text-indent property? (In reply to comment #7) > (In reply to comment #0) > > When using the :first-letter CSS to indent paragraphs > > Out of curiosity, why would you do that instead of using the text-indent > property? > Good question. In all the years I've used CSS I never knew about that property! Using it on my site now as it seems to be the proper way to do things. Thanks for fixing the bug! |