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

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

Issue 791933004: Fix hit-testing (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebased Created 6 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 | « no previous file | sky/tests/layout/document-elementFromPoint.sky » ('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 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 return hitLayer; 1504 return hitLayer;
1505 candidateLayer = hitLayer; 1505 candidateLayer = hitLayer;
1506 } 1506 }
1507 1507
1508 LayoutRect layerBounds; 1508 LayoutRect layerBounds;
1509 ClipRect backgroundRect, foregroundRect, outlineRect; 1509 ClipRect backgroundRect, foregroundRect, outlineRect;
1510 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects); 1510 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects);
1511 clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, backgro undRect, foregroundRect, outlineRect); 1511 clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, backgro undRect, foregroundRect, outlineRect);
1512 1512
1513 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. 1513 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer.
1514 if (isSelfPaintingLayer() && !foregroundRect.intersects(hitTestLocation)) { 1514 if (isSelfPaintingLayer() && foregroundRect.intersects(hitTestLocation)) {
1515 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. 1515 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost.
1516 HitTestResult tempResult(result.hitTestLocation()); 1516 HitTestResult tempResult(result.hitTestLocation());
1517 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestDescendants) 1517 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestDescendants)
1518 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) { 1518 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) {
1519 if (result.isRectBasedTest()) 1519 if (result.isRectBasedTest())
1520 result.append(tempResult); 1520 result.append(tempResult);
1521 else 1521 else
1522 result = tempResult; 1522 result = tempResult;
1523 if (!depthSortDescendants) 1523 if (!depthSortDescendants)
1524 return this; 1524 return this;
(...skipping 10 matching lines...) Expand all
1535 if (hitLayer) { 1535 if (hitLayer) {
1536 if (!depthSortDescendants) 1536 if (!depthSortDescendants)
1537 return hitLayer; 1537 return hitLayer;
1538 candidateLayer = hitLayer; 1538 candidateLayer = hitLayer;
1539 } 1539 }
1540 1540
1541 // If we found a layer, return. Child layers, and foreground always render i n front of background. 1541 // If we found a layer, return. Child layers, and foreground always render i n front of background.
1542 if (candidateLayer) 1542 if (candidateLayer)
1543 return candidateLayer; 1543 return candidateLayer;
1544 1544
1545 if (isSelfPaintingLayer() && !backgroundRect.intersects(hitTestLocation)) { 1545 if (isSelfPaintingLayer() && backgroundRect.intersects(hitTestLocation)) {
1546 HitTestResult tempResult(result.hitTestLocation()); 1546 HitTestResult tempResult(result.hitTestLocation());
1547 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestSelf) 1547 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestSelf)
1548 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) { 1548 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) {
1549 if (result.isRectBasedTest()) 1549 if (result.isRectBasedTest())
1550 result.append(tempResult); 1550 result.append(tempResult);
1551 else 1551 else
1552 result = tempResult; 1552 result = tempResult;
1553 return this; 1553 return this;
1554 } 1554 }
1555 if (result.isRectBasedTest()) 1555 if (result.isRectBasedTest())
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 } 2055 }
2056 } 2056 }
2057 2057
2058 void showLayerTree(const blink::RenderObject* renderer) 2058 void showLayerTree(const blink::RenderObject* renderer)
2059 { 2059 {
2060 if (!renderer) 2060 if (!renderer)
2061 return; 2061 return;
2062 showLayerTree(renderer->enclosingLayer()); 2062 showLayerTree(renderer->enclosingLayer());
2063 } 2063 }
2064 #endif 2064 #endif
OLDNEW
« no previous file with comments | « no previous file | sky/tests/layout/document-elementFromPoint.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698