RESOLVED FIXED Bug 51119
REGRESSION: Element with rotation does not respond to mouse events after r73385
https://bugs.webkit.org/show_bug.cgi?id=51119
Summary REGRESSION: Element with rotation does not respond to mouse events after r73385
Mihai Parparita
Reported 2010-12-15 10:32:59 PST
Test case: http://persistent.info/webkit/test-cases/crbug-67004.html The third div (which has -webkit-transform: rotate(180deg)) does not turn green when hovered over. This happened between r73372 and r73408, r73385 is the most likely cause. Reported on the Chromium side as http://crbug.com/67004
Attachments
Testcase (602 bytes, text/html)
2010-12-15 10:50 PST, Simon Fraser (smfr)
no flags
Patch (1.33 KB, patch)
2010-12-15 11:26 PST, Dave Hyatt
no flags
Test case with mouse event (396 bytes, text/html)
2010-12-28 10:45 PST, Erik Arvidsson
no flags
LayoutTests portion. (2.01 KB, patch)
2011-01-10 14:49 PST, Dave Hyatt
simon.fraser: review+
Simon Fraser (smfr)
Comment 1 2010-12-15 10:50:08 PST
Created attachment 76667 [details] Testcase
Simon Fraser (smfr)
Comment 2 2010-12-15 10:50:36 PST
Dave Hyatt
Comment 3 2010-12-15 11:26:49 PST
Mihai Parparita
Comment 4 2010-12-15 11:29:39 PST
Seems like this could have a layout test (using eventSender).
Simon Fraser (smfr)
Comment 5 2010-12-15 11:42:08 PST
elementFromPoint() could be used to test, without any need for events. I would like to understand the rounding issues, and why they are new.
Dave Hyatt
Comment 6 2010-12-15 11:54:18 PST
They aren't new. The old code used to use the entire layer bounds as the hit test area. This area was a rect of 0, 0, rightOverflow(), bottomOverflow(). Since that isn't right for RTL documents or for vertical writing modes that could have left and top overflow, I opted to try to tighten up the hit test area to just be the point. Tightening up to a 1x1 rect though exposed rounding issues with the mapping into localHitTestRect in hitTestLayer. The patch is basically going back to what the old code did, but also incorporating left and top overflow into the hit test area.
Dave Hyatt
Comment 7 2010-12-15 12:21:25 PST
Comment on attachment 76674 [details] Patch I'll add a test.
Simon Fraser (smfr)
Comment 8 2010-12-15 13:18:04 PST
I think the problem is that localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox(); maps the point outside the 1x1 hitTestRect when there's a flip.
Simon Fraser (smfr)
Comment 9 2010-12-15 13:25:18 PST
Specifically, say I hover over the lower right corner of a 200x200 box. The local point is 195, 195, and the hitTestRest is a 195,195 1x1 rectangle. When that rectangle is mapped through the 180deg rotation, it becomes a 5, 5 -1x-1 rectangle, which gets bounded as 4,4 1x1. So the point at 5,5 is no longer inside.
Simon Fraser (smfr)
Comment 10 2010-12-15 13:26:49 PST
I agree with the attached patch; mapping a point inside a 1x1 rectangle through transforms is not going to work.
Erik Arvidsson
Comment 11 2010-12-28 10:45:19 PST
Created attachment 77561 [details] Test case with mouse event
Beth Dakin
Comment 12 2011-01-10 14:39:22 PST
Dave Hyatt
Comment 13 2011-01-10 14:49:02 PST
Created attachment 78453 [details] LayoutTests portion.
Simon Fraser (smfr)
Comment 14 2011-01-10 14:51:17 PST
Comment on attachment 78453 [details] LayoutTests portion. View in context: https://bugs.webkit.org/attachment.cgi?id=78453&action=review > LayoutTests/fast/transforms/transform-hit-test-flipped.html:4 > +<meta charset="utf-8" /> Whu? > LayoutTests/fast/transforms/transform-hit-test-flipped.html:5 > +<title>Untitled</title> Double whu? > LayoutTests/fast/transforms/transform-hit-test-flipped.html:23 > + var elt = document.elementFromPoint(50, 50); I'm pretty sure document.elementFromPoint() will update layout. > LayoutTests/fast/transforms/transform-hit-test-flipped.html:37 > +</html> > \ No newline at end of file Boo!
Beth Dakin
Comment 15 2011-01-10 20:17:19 PST
I committed Hyatt's patch with: http://trac.webkit.org/changeset/75472
WebKit Review Bot
Comment 16 2011-01-10 21:13:37 PST
http://trac.webkit.org/changeset/75472 might have broken GTK Linux 64-bit Debug The following tests are not passing: media/adopt-node-crash.html
Andy Estes
Comment 17 2011-01-12 15:51:26 PST
*** Bug 51808 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.