Bug 11570

Summary: REGRESSION (r16122): min/max widths incorrectly calculated for contentEditable text
Product: WebKit Reporter: Graham Dennis <Graham.Dennis>
Component: HTML EditingAssignee: Graham Dennis <Graham.Dennis>
Severity: Normal CC: dwood, mitz
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Description Flags
hyatt: review-
patch 2
mitz: review+
followup patch hyatt: review+

Description Graham Dennis 2006-11-11 02:53:35 PST
In revision r16122, all spaces in editable text nodes were changed to be non-breaking spaces instead of space/non-breaking space pairs as necessary. However, RenderText calculates its min/max widths assuming that non-breaking spaces cannot be broken independent of -webkit-nbsp-mode. This causes a problem when a contentEditable div is absolutely positioned to the right, then as text is typed into the div, once the amount of text inserted is longer than one line, there will be a run of characters which RenderText thinks cannot be broken, and so the width of the editable div will increase.

Patch forthcoming.
Comment 1 Graham Dennis 2006-11-11 03:03:01 PST
Created attachment 11479 [details]

I don't really like the huge number of editing delegate messages generated by the layout test for this bug, but I couldn't reproduce the bug by replacing the typeCharacterCommand()'s by a single document.execCommand('InsertText', ...).

All other layout tests pass.
Comment 2 Graham Dennis 2006-11-11 03:47:21 PST
Created attachment 11480 [details]
patch 2

Patch 2.

Testcase no longer uses editing code, and hence has been moved to fast/text/whitespace/nbsp-mode-and-linewraps.html.
Comment 3 mitz 2006-11-11 04:00:39 PST
Comment on attachment 11480 [details]
patch 2

Comment 4 Graham Dennis 2006-11-11 04:13:57 PST
Committed in r17724.
Comment 5 Dave Hyatt 2006-11-11 04:15:13 PST
Comment on attachment 11479 [details]

RenderStyle is not an appropriate spot for an isSpace helper like this.
Comment 6 Graham Dennis 2006-11-11 04:29:23 PST
Created attachment 11482 [details]
followup patch

Follow patch to remove the helper function from RenderStyle
Comment 7 Dave Hyatt 2006-11-11 04:40:40 PST
Comment on attachment 11482 [details]
followup patch