Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hit test issue: 2 absolute divs create an opaque region for mouse events #8759

Closed
paulrouget opened this issue Dec 1, 2015 · 3 comments
Closed
Assignees
Labels
A-gfx/compositing I-wrong An incorrect behaviour is observed.

Comments

@paulrouget
Copy link
Contributor

<iframe src="http://paulrouget.com" mozbrowser="true" style="display: block; width: 500px; height: 500px; border: 0"></iframe>
<div style="position: absolute; top: 200px; height: 2px; width: 500px; background: #0F0;"></div>
<div style="position: absolute; top: 400px; height: 2px; width: 500px; background: #0F0;"></div>

screenflow

@paulrouget
Copy link
Contributor Author

/cc @mbrubeck

@mbrubeck mbrubeck self-assigned this Dec 1, 2015
@mbrubeck mbrubeck added I-wrong An incorrect behaviour is observed. A-gfx/compositing labels Dec 1, 2015
@mbrubeck
Copy link
Contributor

mbrubeck commented Dec 1, 2015

The two positioned divs are layerized into the same layer, so IOCompositor::find_topmost_layer_at_point correctly returns this layer. However, we don't actually want the topmost layer; we want the topmost element. If the point is in a region of the layer that contains no element, the hit test should fail. I'm not sure yet how to implement this without a round trip to the script task… /cc @pcwalton and @mrobinson

@mbrubeck
Copy link
Contributor

mbrubeck commented Dec 1, 2015

Note that this is only a problem when the layer is on top of an iframe, because that causes the compositor to send the mouse event message to the wrong document. Perhaps if this happens, the script task could detect it and forward the message to the child document.

mbrubeck added a commit to mbrubeck/servo that referenced this issue Dec 2, 2015
…nner window

Fixes servo#8759.

This adds a slow path for cases where the compositor's layer-based hit testing
is incorrect.  To optimize for this case, we could instead replace the
layer hit testing with display-list hit testing done in the paint task.
mbrubeck added a commit to mbrubeck/servo that referenced this issue Dec 2, 2015
…nner window

Fixes servo#8759.

This adds a slow path for cases where the compositor's layer-based hit testing
is incorrect.  To optimize for this case, we could instead replace the
layer hit testing with display-list hit testing done in the paint task.
mbrubeck added a commit to mbrubeck/servo that referenced this issue Dec 2, 2015
…nner window

Fixes servo#8759.

This adds a slow path for cases where the compositor's layer-based hit testing
is incorrect.  To optimize for this case, we could instead replace the
layer hit testing with display-list hit testing done in the paint task.
mbrubeck added a commit to mbrubeck/servo that referenced this issue Dec 2, 2015
…nner window

Fixes servo#8759.

This adds a slow path for cases where the compositor's layer-based hit testing
is incorrect.  To optimize for this case, we could instead replace the
layer hit testing with display-list hit testing done in the paint task.
mbrubeck added a commit to mbrubeck/servo that referenced this issue Dec 2, 2015
…nner window

Fixes servo#8759.

This adds a slow path for cases where the compositor's layer-based hit testing
is incorrect.  To optimize for this case, we could instead replace the
layer hit testing with display-list hit testing done in the paint task.
bors-servo pushed a commit that referenced this issue Dec 3, 2015
Add slow path for hit testing of iframe behind positioned content layer

Fixes browser.html blocker #8759. r? @pcwalton

This adds a slow path for cases where the compositor's layer-based hit testing is incorrect.  If the script task discovers that a mouse event should have been dispatched to an iframe, it bounces the event back to the constellation to be forwarded to the correct pipeline.

This isn't terribly slow (on the slow path, it adds one extra round-trip message between script and constellation), but if we want to optimize this better we could instead replace the compositor's layer hit testing with display list hit testing in the paint task.  This would be a more complicated change that I think we should save for a follow-up.

This only fixes mouse input for now.  A basically-identical change will be needed for touch-screen input, whether we stick with this approach or switch to the paint task.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8785)
<!-- Reviewable:end -->
mbrubeck added a commit to mbrubeck/servo that referenced this issue Dec 3, 2015
…nner window

Fixes servo#8759.

This adds a slow path for cases where the compositor's layer-based hit testing
is incorrect.  To optimize for this case, we could instead replace the
layer hit testing with display-list hit testing done in the paint task.
bors-servo pushed a commit that referenced this issue Dec 3, 2015
Add slow path for hit testing of iframe behind positioned content layer

Fixes browser.html blocker #8759. r? @pcwalton

This adds a slow path for cases where the compositor's layer-based hit testing is incorrect.  If the script task discovers that a mouse event should have been dispatched to an iframe, it bounces the event back to the constellation to be forwarded to the correct pipeline.

This isn't terribly slow (on the slow path, it adds one extra round-trip message between script and constellation), but if we want to optimize this better we could instead replace the compositor's layer hit testing with display list hit testing in the paint task.  This would be a more complicated change that I think we should save for a follow-up.

This only fixes mouse input for now.  A basically-identical change will be needed for touch-screen input, whether we stick with this approach or switch to the paint task.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8785)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-gfx/compositing I-wrong An incorrect behaviour is observed.
Projects
None yet
Development

No branches or pull requests

2 participants