RESOLVED FIXED 8969
REGRESSION: typing in textfield repaints whole web page at gamefaqs.com
https://bugs.webkit.org/show_bug.cgi?id=8969
Summary REGRESSION: typing in textfield repaints whole web page at gamefaqs.com
Dave Hyatt
Reported 2006-05-18 00:23:50 PDT
Another one of these repaint problems. Typing in the search field on www.gamefaqs.com repaints nearly the whole page. Turn on paint flashing to see the problem.
Attachments
Reduction (43 bytes, text/html)
2006-05-18 10:03 PDT, mitz
no flags
It can get sluggish because of layout (4.78 KB, text/html)
2006-05-18 11:05 PDT, mitz
no flags
Relayout only the subtree rooted at the text field (13.82 KB, patch)
2006-05-19 08:00 PDT, mitz
no flags
Relayout only the subtree rooted at the text field (13.82 KB, patch)
2006-05-19 09:12 PDT, mitz
no flags
Test case for the repaint issue (239 bytes, text/html)
2006-05-20 06:55 PDT, mitz
no flags
Revised patch (15.52 KB, patch)
2006-05-23 08:30 PDT, mitz
no flags
Revised patch (15.50 KB, patch)
2006-05-23 09:31 PDT, mitz
no flags
Updated patch (16.25 KB, patch)
2006-05-26 15:12 PDT, mitz
no flags
Patch (15.38 KB, patch)
2006-05-27 01:59 PDT, mitz
hyatt: review+
mitz
Comment 1 2006-05-18 10:03:20 PDT
Created attachment 8392 [details] Reduction This reduction shows full-page repainting, but with any text field you'll see some repainting outside the field, i.e. even <input> on its own on the page repaints outside for no apparent reason. I think that's the real problem.
mitz
Comment 2 2006-05-18 11:05:55 PDT
Created attachment 8394 [details] It can get sluggish because of layout This test case is exaggerated, but on a 1.8GHz iMac G5 the native text fields are noticeably slower even under normal circumstances. The problem illustrated by this test case is that typing in the text field causes layout all the way down from the frame to the inner div. Even with only children needing layout, relayout of the ancestors takes a while and causes unnecessary repainting. A way to schedule relayout of only a subtree would be helpful in this case, where you know that changes couldn't have propagated outside the input element (and perhaps in a few other cases to be identified later).
mitz
Comment 3 2006-05-18 11:08:52 PDT
Comment on attachment 8394 [details] It can get sluggish because of layout In shipping Safari (old text field implementation) both text fields are fast.
mitz
Comment 4 2006-05-19 08:00:03 PDT
Created attachment 8404 [details] Relayout only the subtree rooted at the text field First cut at a patch for the relayout issue.
mitz
Comment 5 2006-05-19 09:12:52 PDT
Created attachment 8405 [details] Relayout only the subtree rooted at the text field
mitz
Comment 6 2006-05-20 06:55:02 PDT
Created attachment 8434 [details] Test case for the repaint issue When you click Test, the entire 400px-tall div is repainted.
mitz
Comment 7 2006-05-20 06:56:06 PDT
Comment on attachment 8405 [details] Relayout only the subtree rooted at the text field I think the approach in the patch can be generalized to all clipping containers.
mitz
Comment 8 2006-05-20 07:19:02 PDT
The repaint is caused by layoutInlineChildren: // FIXME: Do something better when floats are present. bool fullLayout = !firstLineBox() || !firstChild() || selfNeedsLayout() || relayoutChildren || containsFloats(); ...and... if (hasFloat) fullLayout = true; // FIXME: Will need to find a way to optimize floats some day. (once fullLayout is true, the block is marked as needing layout, so everything gets repainted; I think that's actually the only effect of marking at that stage).
Dave Hyatt
Comment 9 2006-05-20 22:11:38 PDT
The patch looks good. One thing I thought of though... The recalcStyle step that is done only on the textfield node. I don't think you can get away with that, since if an ancestor style has changed, and you inherit from that ancestor, then doing a style recalc only on yourself will lead to you having incorrect style information while doing the layout. I think you have to just do the style recalc on the whole document.
mitz
Comment 10 2006-05-23 08:30:39 PDT
Created attachment 8481 [details] Revised patch
mitz
Comment 11 2006-05-23 09:31:51 PDT
Created attachment 8483 [details] Revised patch
Dave Hyatt
Comment 12 2006-05-24 12:17:21 PDT
Comment on attachment 8483 [details] Revised patch This is ready for text fields. I do see one issue if we do try to extend this to overflow sections... - root->updateWidgetPositions(); + if (!subtree) + static_cast<RenderCanvas*>(root)->updateWidgetPositions(); If the subtree contains widgets, then you'll need to run updateWidgetPositions but only on the widgets in the subtree.
mitz
Comment 13 2006-05-26 15:12:58 PDT
Created attachment 8565 [details] Updated patch Added an explicit layout request in RenderContainer::removeChildNode, since otherwise layout wouldn't happen when a text field is removed. This was actually detected by fast/forms/textfield-focus-out.html but I overlooked it!
mitz
Comment 14 2006-05-26 15:13:46 PDT
Comment on attachment 8483 [details] Revised patch Clearing review flag to remove bug from the commit queue.
Dave Hyatt
Comment 15 2006-05-26 17:16:46 PDT
I don't quite understand the RenderContainer addition. If a layout is targeted at the textfield itself, that should not be constrained to the subtree, so why is there a problem? The only layouts that should be constrained to subtrees are those that are scheduled by the children/descendants of the text field.
mitz
Comment 16 2006-05-27 01:59:47 PDT
Created attachment 8570 [details] Patch > If a layout is targeted at the textfield itself, that should > not be constrained to the subtree Now *that* was the real problem in all previous versions of the patch. I fixed it by moving the isTextField check in markContainingBlocksForRelayout so that it won't check the layout target, and everything seems to work.
Dave Hyatt
Comment 17 2006-05-29 23:02:40 PDT
Comment on attachment 8570 [details] Patch r=me
Note You need to log in before you can comment on or make changes to this bug.