Bug 4695 - <span> in word-spaced text breaks width calculation, causes overflow
Summary: <span> in word-spaced text breaks width calculation, causes overflow
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-27 03:41 PDT by mitz
Modified: 2005-12-02 01:09 PST (History)
1 user (show)

See Also:


Attachments
testcase (374 bytes, text/html)
2005-08-27 03:42 PDT, mitz
no flags Details
check for non-whitespace ahead (2.12 KB, patch)
2005-11-08 13:38 PST, mitz
no flags Details | Formatted Diff | Diff
Proposed patch (7.05 KB, patch)
2005-11-09 15:09 PST, mitz
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2005-08-27 03:41:46 PDT
When there's a <span> that ends with a space in text with word-spacing!=0, some width calculations are 
wrong, and as a result the line breaks too late and text overflows. See testcase for example.
Comment 1 mitz 2005-08-27 03:42:45 PDT
Created attachment 3607 [details]
testcase
Comment 2 Oliver Hunt 2005-08-27 04:33:05 PDT
More wordspacing woes, confirmed in ToT as at 27/8
Comment 3 mitz 2005-09-01 10:13:36 PDT
The current way of handling word-spacing, which is to apply it a-postriori in many different places, seems 
somewhat problematic to me.

With the exception of negative word-spacing, I can't see what's wrong with applying it during text width 
calculation (i.e. in -[WebTextRenderer floatWidth...] and such ; whenever they decide that something is a 
space and has the width of a space, they should add word-spacing to its width). Currently, some spaces 
(mostly leading spaces) are initially given the width of a normal space.  I tried this approach in my first 
patch for bug 4672, but ran into problems with negative spacing. I think I'll give it another try, because I 
think it could simplify things significantly.
Comment 4 mitz 2005-11-08 13:38:33 PST
Created attachment 4629 [details]
check for non-whitespace ahead
Comment 5 mitz 2005-11-08 14:25:39 PST
Comment on attachment 4629 [details]
check for non-whitespace ahead

Bad idea
Comment 6 mitz 2005-11-09 15:09:34 PST
Created attachment 4654 [details]
Proposed patch

Add word spacing only when (and if) measuring the space that's responsible for
it.
Comment 7 mitz 2005-11-09 15:12:39 PST
Comment on attachment 4654 [details]
Proposed patch

Passes all layout tests except fast/css/word-space-extra.html, where the new
result is the correct one.
Comment 8 Dave Hyatt 2005-11-14 11:33:57 PST
Comment on attachment 4654 [details]
Proposed patch

r=me