Closed Bug 1543482 Opened 6 years ago Closed 6 years ago

Hit-testing produces incorrect result with clip-path over iframe element

Categories

(Core :: Panning and Zooming, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

Attachments

(3 files)

Attached file testcase (deleted) —

STR:

  • load attached file
  • move mouse to over the blue area
  • scroll with wheel/trackpad

Expected:

  • iframe scrolls (blue rect will move)

Actual:

  • root document scrolls, mostly. sometimes on first load it will scroll the iframe.

When the scrollframe for the iframe is inactive, we do a main-thread hit-test and it produces the right result. Once the scrollframe is activated, there is a hit-region in the layer tree for the bounding box of the clipped element, and so APZ always hits the wrong thing without waiting for the main thread.

As far as I can tell this has been broken since the original event regions code landed, which probably means that this scenario isn't exercised very much in the wild.

Also the testcase works correctly when WR is enabled, because we add the eIrregularArea flag for the clip-path element here which forces APZ to do main-thread lookup.

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #2)

Also the testcase works correctly when WR is enabled, because we add the eIrregularArea flag for the clip-path element here which forces APZ to do main-thread lookup.

That's not true. The testcase does work correctly for WR, but it's because clip-path gets turned into an nsDisplayMasksAndClipPath item which goes directly into a WR clip item, and so WR can do precise hit-testing against it.

The eIrregularArea thing only happens for SVGs, so I should probably write a separate testcase for that.

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)

That's not true. The testcase does work correctly for WR, but it's because clip-path gets turned into an nsDisplayMasksAndClipPath item which goes directly into a WR clip item, and so WR can do precise hit-testing against it.

Sadly, that's also not true. Only some nsDisplayMasksAndClipPath items (simple shapes) get precisely hit-tested. Anything that ends up as a mask clip looks like it gets turned into a bounding box here in WR and so we'll actually get incorrect results from WR in that case. The testcase I posted is a simple shape and so it works fine.

This will force APZ to do a main-thread hit-test for the cases where the
shapes are too complex to easily send to the compositor.

Depends on D27454

Assignee: nobody → kats

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)

The eIrregularArea thing only happens for SVGs, so I should probably write a separate testcase for that.

Filed bug 1544451 for that.

Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7d9507696389 Extract a helper to identify clip paths WR can handle without masks. r=mattwoodrow https://hg.mozilla.org/integration/autoland/rev/7d6cd4e20705 Add the irregular-area flag for frames with masks and clip paths. r=mattwoodrow,botond
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68

I don't think there's a pressing need to uplift this. It's a correctness improvement but not one we've run into in the wild.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: