Skip to content

Fix clip rect for iframes in hit testing code - #8557

Closed
mbrubeck wants to merge 2 commits into
servo:masterfrom
mbrubeck:iframe-hit-test
Closed

mbrubeck wants to merge 2 commits into
servo:masterfrom
mbrubeck:iframe-hit-test

Conversation

@mbrubeck

Copy link
Copy Markdown
Contributor

Fixes #8080. r? @glennw or @mrobinson

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 17, 2015
@mbrubeck

Copy link
Copy Markdown
Contributor Author

Any ideas how to write a test for this bug?

@pcwalton

Copy link
Copy Markdown
Contributor

Looks good to me.

In general event testing is pretty hard. See some of the testing issues around incremental restyling…

Comment thread components/compositing/compositor.rs Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether this case also needs to be changed... or why it is separate from the else case below it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

masks_to_bounds is only set when it's the root layer for an iframe, I think - but @mrobinson knows this stuff much better then me.

Comment thread components/compositing/compositor.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this needed to handle the scrolling case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. I'll go back to the drawing board and make sure the fix works when the parent and/or child documents are scrolled.

@mbrubeck mbrubeck added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 18, 2015
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 20, 2015
@mbrubeck mbrubeck assigned mrobinson and unassigned pcwalton Nov 20, 2015
@mbrubeck

Copy link
Copy Markdown
Contributor Author

Updated the patch to take scrolling into account. This now fixes #8080 even when the top-level document is scrolled, and sends the correct page coordinates to the script task. r? @mrobinson

There is still a pre-existing bug that causes incorrect hit testing inside the iframe if its inner document is scrolled, which is not fixed by this patch. I think this bug is in the hit-testing code in script and gfx.

Comment thread components/compositing/compositor.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would make sense to simply call this point_in_parent_layer and remove the comment.

@mbrubeck mbrubeck added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 20, 2015
@mbrubeck

Copy link
Copy Markdown
Contributor Author

There is still a pre-existing bug that causes incorrect hit testing inside the iframe if its inner document is scrolled, which is not fixed by this patch. I think this bug is in the hit-testing code in script and gfx.

Oops, I thought this was a pre-existing bug, but on further testing it looks like it's actually a regression from this patch.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 21, 2015
@mbrubeck

Copy link
Copy Markdown
Contributor Author

Okay, this time for sure! The problem above was caused by an existing bug in Document, which was treating the mouse event coordinates as both page coordinates and client coordinates, so for scrolled documents it was always wrong in at least one case.

find_topmost_layer_at_point now consistently returns client coordinates (layer coordinates, for the layer corresponding to the window or frame containing the returned layer). Script now correctly translates from client coordinates to page coordinates as needed, and a bunch of parameters have been renamed to clarify their coordinate system.

There's one remaining bug involving hit-testing of fixed-position elements in scrolled documents, but this is definitely a pre-existing bug. I added a FIXME comment for it. r? mrobinson

I'm going to be gone on PTO all next week, so if this needs fixups and someone wants to take it over, it would be appreciated.

@jdm jdm added the S-needs-rebase There are merge conflict errors. label Nov 21, 2015
@paulrouget

Copy link
Copy Markdown
Contributor

I'm going to be gone on PTO all next week, so if this needs fixups and someone wants to take it over, it would be appreciated.

This needs rebase. Here: #8671

@jdm jdm closed this Nov 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-gfx/compositing S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants