Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 81153002: Fix hover area for divs with css transforms Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: adding layout test that fails with this approach. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/transforms/3d/hit-testing/hover-rotated-with-children-negative-z-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 } 2722 }
2723 return false; 2723 return false;
2724 } 2724 }
2725 2725
2726 // Compute the z-offset of the point in the transformState. 2726 // Compute the z-offset of the point in the transformState.
2727 // This is effectively projecting a ray normal to the plane of ancestor, finding where that 2727 // This is effectively projecting a ray normal to the plane of ancestor, finding where that
2728 // ray intersects target, and computing the z delta between those two points. 2728 // ray intersects target, and computing the z delta between those two points.
2729 static double computeZOffset(const HitTestingTransformState& transformState) 2729 static double computeZOffset(const HitTestingTransformState& transformState)
2730 { 2730 {
2731 // We got an affine transform, so no z-offset 2731 // We got an affine transform, so no z-offset
2732 if (transformState.m_accumulatedTransform.isAffine()) 2732 if (transformState.m_accumulatedTransform.isAffine()) {
2733 return 0; 2733 // Non transformed layers are being hit last, not through or in-between transformed layers.
2734 // The paint order says that the divs creating stacking contexts (includ ing transforms) are painted after the
2735 // other siblings so they should be hit tested in the reverse order. Als o, a rotated div in a non-rotated parent
2736 // should be hit in its entire area, not hit its parent's background, ev en if the z-coordinate is negative where
2737 // the mouse is located.
2738 return -std::numeric_limits<int>::max();
2739 }
2734 2740
2735 // Flatten the point into the target plane 2741 // Flatten the point into the target plane
2736 FloatPoint targetPoint = transformState.mappedPoint(); 2742 FloatPoint targetPoint = transformState.mappedPoint();
2737 2743
2738 // Now map the point back through the transform, which computes Z. 2744 // Now map the point back through the transform, which computes Z.
2739 FloatPoint3D backmappedPoint = transformState.m_accumulatedTransform.mapPoin t(FloatPoint3D(targetPoint)); 2745 FloatPoint3D backmappedPoint = transformState.m_accumulatedTransform.mapPoin t(FloatPoint3D(targetPoint));
2740 return backmappedPoint.z(); 2746 return backmappedPoint.z();
2741 } 2747 }
2742 2748
2743 PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(Rend erLayer* rootLayer, RenderLayer* containerLayer, 2749 PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(Rend erLayer* rootLayer, RenderLayer* containerLayer,
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 } 4181 }
4176 } 4182 }
4177 4183
4178 void showLayerTree(const WebCore::RenderObject* renderer) 4184 void showLayerTree(const WebCore::RenderObject* renderer)
4179 { 4185 {
4180 if (!renderer) 4186 if (!renderer)
4181 return; 4187 return;
4182 showLayerTree(renderer->enclosingLayer()); 4188 showLayerTree(renderer->enclosingLayer());
4183 } 4189 }
4184 #endif 4190 #endif
OLDNEW
« no previous file with comments | « LayoutTests/transforms/3d/hit-testing/hover-rotated-with-children-negative-z-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698