Bug 46219 - [chromium] invalidateRootLayerRect needs to schedule compositor
Summary: [chromium] invalidateRootLayerRect needs to schedule compositor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-21 14:48 PDT by Nat Duca
Modified: 2010-09-28 16:05 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.15 KB, patch)
2010-09-21 15:48 PDT, Nat Duca
no flags Details | Formatted Diff | Diff
Add comments to LayerChromium::setNeedsDisplay (3.21 KB, patch)
2010-09-22 13:23 PDT, Nat Duca
no flags Details | Formatted Diff | Diff
Minimally-controversial approach (I hope) to root layer damage tracking. (9.30 KB, patch)
2010-09-22 18:18 PDT, Nat Duca
no flags Details | Formatted Diff | Diff
Patch (9.30 KB, patch)
2010-09-24 15:00 PDT, Nat Duca
no flags Details | Formatted Diff | Diff
Make it commitable. (9.29 KB, patch)
2010-09-28 15:05 PDT, Nat Duca
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nat Duca 2010-09-21 14:48:27 PDT
When a root layer invalidation occurs, we need to schedule a compositor run.

Without this, selecting text on the root layer appears to be broken.
Comment 1 Nat Duca 2010-09-21 15:48:03 PDT
Created attachment 68296 [details]
Patch
Comment 2 James Robinson 2010-09-21 16:18:06 PDT
Why do we need this?  LayerChromium::setNeedsDisplay() should call setNeedsCommit() which should call notifySyncRequired() which do the same thing.  In fact there's this comment in setNeedsCommit():

    // Call notifySyncRequired(), which in this implementation plumbs through to
    // call setRootLayerNeedsDisplay() on the WebView, which will cause LayerRendererChromium
    // to render a frame.
Comment 3 Nat Duca 2010-09-21 16:22:20 PDT
Good question.

In the current implementation, the root layer behaves differently than all other layers, and does not actually call notifySyncRequired.
Comment 4 James Robinson 2010-09-21 16:23:23 PDT
(In reply to comment #3)
> Good question.
> 
> In the current implementation, the root layer behaves differently than all other layers, and does not actually call notifySyncRequired.

Isn't that the actual bug, then?
Comment 5 Nat Duca 2010-09-21 16:30:09 PDT
Yes and no. The current compositor architecture intentionally treats the root layer the same as non-root layers. I have been making incremental changes to get the root layer more-and-more similar to the other layers, but we're not to the point of unification yet.

As things stand right now, the root layer is broken when you for example highlight text on it.

So, yes, the current architecture is flawed. But, fixing the flaw is something we might want to hit in another changelist.
Comment 6 Nat Duca 2010-09-21 16:34:42 PDT
Erm, mistake in typing --- "The current compositor architecture intentionally treats the root layer the same as non-root layers" should read "The current compositor architecture intentionally treats the root layer ***differently*** from non-root layers"

Hahah
Comment 7 Nat Duca 2010-09-21 18:51:18 PDT
As far as I can tell, that is by design of the overall compositor. E.g. the code shared with Safari Windows, treats root & child layers differently as well.

If you want me to update the comment you saw to say something like "except on root layer," that would be fine, since the comment is a lie.
Comment 8 Nat Duca 2010-09-22 13:23:43 PDT
Created attachment 68429 [details]
Add comments to LayerChromium::setNeedsDisplay
Comment 9 Vangelis Kokkevis 2010-09-22 17:01:46 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > Good question.
> > 
> > In the current implementation, the root layer behaves differently than all other layers, and does not actually call notifySyncRequired.
> 
> Isn't that the actual bug, then?

I think Nat's solution is correct here.  The root layer does behave differently from the rest of the layers so it isn't that surprising that it needs to notify the window to repaint somewhat differently from other layers.
Comment 10 Nat Duca 2010-09-22 18:18:21 PDT
Created attachment 68487 [details]
Minimally-controversial approach (I hope) to root layer damage tracking.
Comment 11 James Robinson 2010-09-22 18:22:28 PDT
Looks OK to me - will r+ if Vangelis agrees.
Comment 12 Nat Duca 2010-09-22 18:31:40 PDT
I think James has brought up a good point, though, in his reviews, which is essentially that our current use of the LayerChromium is extremely hacky. The reason for this is because root vs non-root layers behave differently in WebKit.

What I have done in the new patch is to stop the root layer damage logic from piggybacking on the LayerChromium code. By pulling it into the WebView, we keep our code clear.

My guess is that iframe handling will end up driving us to resolve root vs non-root issues. A bug for this exists at http://code.google.com/p/chromium/issues/detail?id=54758. I think that bug will ensure that the root-non-root concerns brought up in this discussion will not get swept under the rug.
Comment 13 Vangelis Kokkevis 2010-09-24 14:20:47 PDT
Comment on attachment 68487 [details]
Minimally-controversial approach (I hope) to root layer damage tracking.

View in context: https://bugs.webkit.org/attachment.cgi?id=68487&action=review

> WebKit/chromium/src/WebViewImpl.cpp:2290
> +    IntRect contentRect = view->windowToContents(rect);

Is this transformation necessary?  It seems to me that both regular and scroll damage rects are in viewport space.

> WebKit/chromium/src/WebViewImpl.cpp:2412
> +    m_rootLayerDirtyRect = WebRect();

WebRect() -> IntRect() ?
Comment 14 Nat Duca 2010-09-24 14:55:24 PDT
Use of content space is still necessary to deal with scrolls mixed with dirty rects; otherwise, I'd have to scroll the content dirty rect when we scroll. However, I'd rather not touch this as I have to rip this all out and write yet another version to fix the scrollbars issue.

Will upload fix for the webrect now.
Comment 15 Nat Duca 2010-09-24 15:00:25 PDT
Created attachment 68760 [details]
Patch
Comment 16 Nat Duca 2010-09-27 14:08:06 PDT
Vangelis - any feedback or are you good?
Comment 17 Vangelis Kokkevis 2010-09-27 14:13:43 PDT
(In reply to comment #16)
> Vangelis - any feedback or are you good?

Oops, sorry for not responding earlier.  I like the latest patch. No issues here.
Comment 18 WebKit Commit Bot 2010-09-28 12:20:30 PDT
Comment on attachment 68760 [details]
Patch

Rejecting patch 68760 from commit-queue.

Failed to run "['./WebKitTools/Scripts/webkit-patch', '--status-host=queues.webkit.org', 'apply-attachment', '--force-clean', '--non-interactive', '--quiet', 68760]" exit_code: 2
Cleaning working directory
Updating working directory
Logging in as commit-queue@webkit.org...
Fetching: https://bugs.webkit.org/attachment.cgi?id=68760&action=edit
Fetching: https://bugs.webkit.org/show_bug.cgi?id=46219&ctype=xml
Processing 1 patch from 1 bug.
Processing patch 68760 from bug 46219.
Failed to run "[u'/Users/abarth/git/webkit-queue/WebKitTools/Scripts/svn-apply', u'--reviewer', u'James Robinson', u'--force']" exit_code: 1

Full output: http://queues.webkit.org/results/4144001
Comment 19 Nat Duca 2010-09-28 15:05:58 PDT
Created attachment 69116 [details]
Make it commitable.
Comment 20 WebKit Commit Bot 2010-09-28 16:04:56 PDT
Comment on attachment 69116 [details]
Make it commitable.

Clearing flags on attachment: 69116

Committed r68604: <http://trac.webkit.org/changeset/68604>
Comment 21 WebKit Commit Bot 2010-09-28 16:05:02 PDT
All reviewed patches have been landed.  Closing bug.