Summary: | Extra white space at the end of right-aligned or justified text with -webkit-line-break: after-white-space | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | mitz | ||||||
Component: | Text | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | Keywords: | HasReduction | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Mac | ||||||||
OS: | OS X 10.5 | ||||||||
Attachments: |
|
Description
mitz
2008-03-18 13:52:30 PDT
Created attachment 19875 [details]
Test case
Note that since -webkit-line-break: after-white-space is the default for editable HTML, this affects editing. Firefox sort of agrees with WebKit's current behavior for pre-wrap, so maybe only -webkit-line-break needs fixing. Created attachment 20675 [details]
Correct trailing whitespace behavior
Comment on attachment 20675 [details]
Correct trailing whitespace behavior
This code is pretty hard for me to follow, but probably necessarily so.
I'd assert that run->m_previous is 0 in prependRun.
668 trailingSpaceWidth = (min(trailingSpaceRun->m_box->width(), (availableWidth - totWidth + 1) / 2));
This has an extra space and unneeded parentheses.
949 if (current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || lastText->style()->preserveNewline()) && (current != noBreakSpace || lastText->style()->nbspMode() == NBNORMAL))
It seems like this line would read better if there was a helper function for it.
957 bool shouldSeparateSpaces = style()->direction() == RTL || trailingSpaceRun != start.lastRun() || trailingSpaceRun->m_level % 2 || textAlign != LEFT && textAlign != WEBKIT_LEFT && textAlign != TAAUTO;
This is such a long condition that it might need some comments or be moved into an inline function or something. It also might be nice to make the common case faster -- I can't tell if this is so in the current version.
r=me
|