Bug 74196 - [chromium] Delegate scroll events to the main thread when needed
Summary: [chromium] Delegate scroll events to the main thread when needed
Status: RESOLVED DUPLICATE of bug 79155
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 73350
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-09 12:05 PST by Sami Kyostila
Modified: 2012-02-21 20:47 PST (History)
4 users (show)

See Also:


Attachments
Patch (17.49 KB, patch)
2011-12-09 12:09 PST, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (17.54 KB, patch)
2011-12-13 10:32 PST, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (15.42 KB, patch)
2011-12-14 13:40 PST, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (15.28 KB, patch)
2011-12-16 15:17 PST, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (15.61 KB, patch)
2011-12-20 13:02 PST, Sami Kyostila
no flags Details | Formatted Diff | Diff
Patch (15.61 KB, patch)
2011-12-20 13:24 PST, Sami Kyostila
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Kyostila 2011-12-09 12:05:50 PST
Register a scrollable region for each LayerChromium and delegate scroll events inside the region to the main thread for processing.

Note that this essentially splits out the Chromium-only changes from bug 71385.
Comment 1 Sami Kyostila 2011-12-09 12:09:11 PST
Created attachment 118606 [details]
Patch
Comment 2 Sami Kyostila 2011-12-13 10:32:09 PST
Created attachment 119033 [details]
Patch

- Rebased after latest changes to bug 73350.
Comment 3 Adrienne Walker 2011-12-13 12:06:02 PST
Comment on attachment 119033 [details]
Patch

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

Other than one small thing, this is looking good to me.  Thanks for the tests!

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:341
> +    IntPoint contentPoint(layerImpl->screenSpaceTransform().inverse().mapPoint(viewportPoint));
> +    // The content point for non-root layers must be scaled with the page scale. Note that the
> +    // page scale delta is already embedded in each layer's screen space transform.
> +    if (layerImpl != m_scrollLayerImpl)
> +        contentPoint.scale(m_pageScale, m_pageScale);

I know you're just moving code here, but I don't follow this logic and why the scroll layer behaves differently.  Would you mind explaining why this is? Don't all layers (root or no) have the page scale applied to them?

Also, do you need to apply the page scale delta? Maybe I'd feel more comfortable if there were more tests for this function that covered page scale.
Comment 4 Sami Kyostila 2011-12-14 12:53:02 PST
Comment on attachment 119033 [details]
Patch

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

Setting as review- until the preceding patch layer scrolling is updated.

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:341

> 
> I know you're just moving code here, but I don't follow this logic and why the scroll layer behaves differently.  Would you mind explaining why this is? Don't all layers (root or no) have the page scale applied to them?
> 
> Also, do you need to apply the page scale delta? Maybe I'd feel more comfortable if there were more tests for this function that covered page scale.

Turns out the code here is not entirely correct, so I'll rework it in the preceding patch. Actually there is no need to differentiate between layers or scale the content point, but instead visibleLayerRect() must be scaled with the inverse of the page scale to get unscaled css coordinates that match the coordinate system of contentPoint.

The reason why page scale delta is not needed is that while we are zooming, visibleLayerRect() is recomputed in terms of the original page scale. It never includes m_pageScaleDelta so there is no need to undo that here. I'm not really sure whether this is intended, though.
Comment 5 Sami Kyostila 2011-12-14 13:40:03 PST
Created attachment 119287 [details]
Patch
Comment 6 James Robinson 2011-12-14 15:32:14 PST
This seems to have quite a few merge conflicts on ToT, does it depend on https://bugs.webkit.org/show_bug.cgi?id=73350 ?
Comment 7 Sami Kyostila 2011-12-15 04:01:15 PST
(In reply to comment #6)
> This seems to have quite a few merge conflicts on ToT, does it depend on https://bugs.webkit.org/show_bug.cgi?id=73350 ?

Yes, this patch should be applied after the one you linked. Sorry, I should have mentioned that here.
Comment 8 Sami Kyostila 2011-12-16 15:17:49 PST
Created attachment 119684 [details]
Patch

- Rebased after changes to bug 73350 (no functional changes)
Comment 9 James Robinson 2011-12-19 16:18:22 PST
Comment on attachment 119684 [details]
Patch

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

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:486
> +    IntPoint contentPoint(layerImpl->screenSpaceTransform().inverse().mapPoint(viewportPoint));

if this layer's screen space transform is not invertible, you need to return false here - just calling .inverse().mapPoint() will map the point through an identity transform
Comment 10 Sami Kyostila 2011-12-20 13:02:11 PST
Created attachment 120064 [details]
Patch

 - Updating according to layer walking order changes in bug 73350.
Comment 11 Sami Kyostila 2011-12-20 13:24:05 PST
Created attachment 120068 [details]
Patch

 - Rebased.
Comment 12 James Robinson 2011-12-20 20:30:35 PST
Comment on attachment 120068 [details]
Patch

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

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:480
> +    if (!layerImpl)
> +        return false;

when can this parameter be null?

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:489
> +    if (!layerImpl->screenSpaceTransform().isInvertible())
> +        return false;
> +
> +    IntPoint contentPoint(layerImpl->screenSpaceTransform().inverse().mapPoint(viewportPoint));
> +    if (layerImpl->drawsContent() && !isContentPointWithinLayer(layerImpl, contentPoint))
> +        return false;
> +
> +    if (layerImpl->isInsideScrollableRegion(contentPoint))

there's not a whole lot (if anything) going on here that the CCLayerTreeHostImpl can do and the layer itself can't - all of the logic here is based on member functions of layerImpl. should this whole thing just be a member function of CCLayerImpl?

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:526
> +    if (!layerImpl->drawsContent() && (layerImpl->scrollable() || !layerImpl->scrollableRegion().isEmpty()))

at this point, this probably deserves at least a comment explaining why a given layer should or shouldn't be in the assembled list since it's no longer a list of non-drawable scrollable layers
Comment 13 James Robinson 2012-02-21 20:46:53 PST

*** This bug has been marked as a duplicate of bug 79155 ***