Bug 13443 - FIXME: computeAbsoluteRepaintRect() ignores control clip rects
Summary: FIXME: computeAbsoluteRepaintRect() ignores control clip rects
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P3 Minor
Assignee: Nobody
Depends on: 13453
  Show dependency treegraph
Reported: 2007-04-21 22:50 PDT by mitz
Modified: 2007-04-23 04:18 PDT (History)
0 users

See Also:

Controls only clip children's foreground (501 bytes, text/html)
2007-04-22 08:43 PDT, mitz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2007-04-21 22:50:06 PDT
[Following up on bug 13391].

RenderBox::computeAbsoluteRepaintRect() ignores the lightweight clip used by some form controls, the reason being that when it's called during layout, controlClipRect() returns a wrong result. In the context of a child of the control repainting during layout, you need the control's clip rect before layout. I have considered several ways to fix this:

1) Cache the clip rects in the controls themselves post layout(). This is a very fast and simple solution, but it increases the memory footprint of controls for information that's basically needed only during layout.

2) Cache the clip rects in a hash table kept in the RenderView. Controls can cache their current clip rect when entering layout() and delete it from the hash before returning from layout().

3) Similar to 2) but use a stack, so each control pushes its clip rect onto the stack. Since controls are very rarely nested, computeAbsoluteRepaintRect() could simply walk the stack looking for |o| (no need to pass the current stack pointer when recurring).

4) Maintain a true clipping rect stack in RenderView, including the "current clip", and pushing both control clip and layer clip. This will fix bug 11489 as well.

The disadvantage of 2-4 is the complexity, which includes having to keep a "during layout" code path separate from the "after layout" code path. I'd go with 1) or 2), assuming bug 11489 will be addressed by flexbox changes.
Comment 1 mitz 2007-04-21 22:54:47 PDT
On second thought, I like 3) better than 2).
Comment 2 mitz 2007-04-22 08:43:41 PDT
Created attachment 14136 [details]
Controls only clip children's foreground

I had written a patch and when I wanted to test it I realized that control clip is applied only to the children's foreground. I think it's a bug, but if it isn't, then this bug is INVALID.
Comment 3 mitz 2007-04-23 04:18:13 PDT
(In reply to comment #2)
> I think it's a bug

Bug 13453.