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

Side by Side Diff: sky/engine/core/rendering/RenderLayer.cpp

Issue 924273002: Remove HitTestFilter. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 10 months 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 | « sky/engine/core/rendering/RenderLayer.h ('k') | sky/engine/core/rendering/RenderObject.h » ('j') | 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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 // TODO(ojan): This call has no test coverage. 999 // TODO(ojan): This call has no test coverage.
1000 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation, 1000 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation,
1001 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants); 1001 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
1002 if (hitLayer) { 1002 if (hitLayer) {
1003 if (!depthSortDescendants) 1003 if (!depthSortDescendants)
1004 return hitLayer; 1004 return hitLayer;
1005 candidateLayer = hitLayer; 1005 candidateLayer = hitLayer;
1006 } 1006 }
1007 1007
1008 LayoutRect layerBounds; 1008 LayoutRect layerBounds;
1009 ClipRect backgroundRect, foregroundRect; 1009 // FIXME(sky): Remove foregroundRect. It's unused.
1010 ClipRect contentRect, foregroundRect;
1010 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects); 1011 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects);
1011 clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, backgro undRect, foregroundRect); 1012 clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, content Rect, foregroundRect);
1012 1013
1013 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. 1014 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer.
1014 if (isSelfPaintingLayer() && foregroundRect.intersects(hitTestLocation)) { 1015 if (isSelfPaintingLayer() && contentRect.intersects(hitTestLocation)) {
1015 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. 1016 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost.
1016 HitTestResult tempResult(result.hitTestLocation()); 1017 HitTestResult tempResult(result.hitTestLocation());
1017 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestDescendants) 1018 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation)
1018 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) { 1019 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) {
1019 if (result.isRectBasedTest()) 1020 if (result.isRectBasedTest())
1020 result.append(tempResult); 1021 result.append(tempResult);
1021 else 1022 else
1022 result = tempResult; 1023 result = tempResult;
1023 if (!depthSortDescendants) 1024 if (!depthSortDescendants)
1024 return this; 1025 return this;
1025 // Foreground can depth-sort with descendant layers, so keep this as a candidate. 1026 // Foreground can depth-sort with descendant layers, so keep this as a candidate.
1026 candidateLayer = this; 1027 candidateLayer = this;
1027 } else if (result.isRectBasedTest()) { 1028 } else if (result.isRectBasedTest()) {
1028 result.append(tempResult); 1029 result.append(tempResult);
1029 } 1030 }
1030 } 1031 }
1031 1032
1032 // If we found a layer, return. Child layers, and foreground always render i n front of background. 1033 return candidateLayer;
1033 if (candidateLayer)
1034 return candidateLayer;
1035
1036 if (isSelfPaintingLayer() && backgroundRect.intersects(hitTestLocation)) {
1037 HitTestResult tempResult(result.hitTestLocation());
1038 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestSelf)
1039 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) {
1040 if (result.isRectBasedTest())
1041 result.append(tempResult);
1042 else
1043 result = tempResult;
1044 return this;
1045 }
1046 if (result.isRectBasedTest())
1047 result.append(tempResult);
1048 }
1049
1050 return 0;
1051 } 1034 }
1052 1035
1053 RenderLayer* RenderLayer::hitTestLayerByApplyingTransform(RenderLayer* rootLayer , RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& res ult, 1036 RenderLayer* RenderLayer::hitTestLayerByApplyingTransform(RenderLayer* rootLayer , RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& res ult,
1054 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset, 1037 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset,
1055 const LayoutPoint& translationOffset) 1038 const LayoutPoint& translationOffset)
1056 { 1039 {
1057 // Create a transform state to accumulate this transform. 1040 // Create a transform state to accumulate this transform.
1058 RefPtr<HitTestingTransformState> newTransformState = createLocalTransformSta te(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, tran slationOffset); 1041 RefPtr<HitTestingTransformState> newTransformState = createLocalTransformSta te(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, tran slationOffset);
1059 1042
1060 // If the transform can't be inverted, then don't hit test this layer at all . 1043 // If the transform can't be inverted, then don't hit test this layer at all .
(...skipping 12 matching lines...) Expand all
1073 HitTestLocation newHitTestLocation; 1056 HitTestLocation newHitTestLocation;
1074 if (hitTestLocation.isRectBasedTest()) 1057 if (hitTestLocation.isRectBasedTest())
1075 newHitTestLocation = HitTestLocation(localPoint, localPointQuad); 1058 newHitTestLocation = HitTestLocation(localPoint, localPointQuad);
1076 else 1059 else
1077 newHitTestLocation = HitTestLocation(localPoint); 1060 newHitTestLocation = HitTestLocation(localPoint);
1078 1061
1079 // Now do a hit test with the root layer shifted to be us. 1062 // Now do a hit test with the root layer shifted to be us.
1080 return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset); 1063 return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset);
1081 } 1064 }
1082 1065
1083 bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, H itTestFilter hitTestFilter) const 1066 bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation) c onst
1084 { 1067 {
1085 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); 1068 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
1086 1069
1087 if (!renderer()->hitTest(request, result, hitTestLocation, toLayoutPoint(lay erBounds.location() - renderBoxLocation()), hitTestFilter)) { 1070 if (!renderer()->hitTest(request, result, hitTestLocation, toLayoutPoint(lay erBounds.location() - renderBoxLocation()))) {
1088 // It's wrong to set innerNode, but then claim that you didn't hit anyth ing, unless it is 1071 // It's wrong to set innerNode, but then claim that you didn't hit anyth ing, unless it is
1089 // a rect-based test. 1072 // a rect-based test.
1090 ASSERT(!result.innerNode() || (result.isRectBasedTest() && result.rectBa sedTestResult().size())); 1073 ASSERT(!result.innerNode() || (result.isRectBasedTest() && result.rectBa sedTestResult().size()));
1091 return false; 1074 return false;
1092 } 1075 }
1093 1076
1094 // For positioned generated content, we might still not have a 1077 // For positioned generated content, we might still not have a
1095 // node by the time we get to the layer level, since none of 1078 // node by the time we get to the layer level, since none of
1096 // the content in the layer has an element. So just walk up 1079 // the content in the layer has an element. So just walk up
1097 // the tree. 1080 // the tree.
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 } 1407 }
1425 } 1408 }
1426 1409
1427 void showLayerTree(const blink::RenderObject* renderer) 1410 void showLayerTree(const blink::RenderObject* renderer)
1428 { 1411 {
1429 if (!renderer) 1412 if (!renderer)
1430 return; 1413 return;
1431 showLayerTree(renderer->enclosingLayer()); 1414 showLayerTree(renderer->enclosingLayer());
1432 } 1415 }
1433 #endif 1416 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | sky/engine/core/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698