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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1289753006: Fallback to root layer if hit-testing does not hit anything in iframe (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove "active" hack for wheel event hit-test & using document.documentElement.scrollTop for scroll… Created 5 years, 4 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
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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 1484
1485 const HitTestRequest& request = result.hitTestRequest(); 1485 const HitTestRequest& request = result.hitTestRequest();
1486 const HitTestLocation& hitTestLocation = result.hitTestLocation(); 1486 const HitTestLocation& hitTestLocation = result.hitTestLocation();
1487 1487
1488 // Start with frameVisibleRect to ensure we include the scrollbars. 1488 // Start with frameVisibleRect to ensure we include the scrollbars.
1489 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); 1489 LayoutRect hitTestArea = frameVisibleRect(layoutObject());
1490 if (request.ignoreClipping()) 1490 if (request.ignoreClipping())
1491 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); 1491 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect()));
1492 1492
1493 DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestAre a, hitTestLocation, false); 1493 DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestAre a, hitTestLocation, false);
1494 if (!insideLayer) { 1494 if (!insideLayer && isRootLayer()) {
1495 // We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down,
1496 // return ourselves. We do this so mouse events continue getting deliver ed after a drag has
1497 // exited the WebView, and so hit testing over a scrollbar hits the cont ent document.
1498 // In addtion, it is possible for the mouse to stay in the document but there is no element.
1499 // At that time, the events of the mouse should be fired.
1500 // TODO(majidvp): This should apply more consistently across different e vent types and we 1495 // TODO(majidvp): This should apply more consistently across different e vent types and we
Rick Byers 2015/08/20 19:28:22 nit: please move this TODO to your second case - i
Yufeng Shen (Slow to review) 2015/08/20 20:28:19 Done.
1501 // should not use RequestType for it. Perhaps best for it to be done at a higher level. See 1496 // should not use RequestType for it. Perhaps best for it to be done at a higher level. See
1502 // http://crbug.com/505825 1497 // http://crbug.com/505825
1503 LayoutPoint hitPoint = hitTestLocation.point(); 1498
1504 if (!request.isChildFrameHitTest() && ((request.active() || request.rele ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y()))) && isRootLayer()) { 1499 IntRect hitRect = hitTestLocation.boundingBox();
1500 bool fallback = false;
1501 // If we didn't hit any layers but are still inside the document
1502 // bounds, then we should fallback to hitting the document.
1503 // For rect-based hit test, we do the fallback only when the hit-rect
1504 // is totally within the document bounds.
1505 if (hitTestArea.contains(LayoutRect(hitRect))) {
1506 fallback = true;
1507 // Mouse dragging outside the main document should also be
Rick Byers 2015/08/20 19:28:22 nit: add a newline above here to make the separati
Yufeng Shen (Slow to review) 2015/08/20 20:28:19 Done.
1508 // delivered to the document.
1509 // TODO(miletus): Capture behavior inconsistent with iframes
1510 // crbug.com/522109.
1511 } else if ((request.active() || request.release()) && !request.isChildFr ameHitTest()) {
1512 fallback = true;
1513 }
1514 if (fallback) {
1505 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec t())->flipForWritingMode(hitTestLocation.point())); 1515 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec t())->flipForWritingMode(hitTestLocation.point()));
1506 insideLayer = this; 1516 insideLayer = this;
1507 1517
1508 // Don't cache this result since it really wasn't a true hit. 1518 // Don't cache this result since it really wasn't a true hit.
1509 result.setCacheable(false); 1519 result.setCacheable(false);
1510 } 1520 }
1511 } 1521 }
1512 1522
1513 // Now determine if the result is inside an anchor - if the urlElement isn't already set. 1523 // Now determine if the result is inside an anchor - if the urlElement isn't already set.
1514 Node* node = result.innerNode(); 1524 Node* node = result.innerNode();
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 2681
2672 void showLayerTree(const blink::LayoutObject* layoutObject) 2682 void showLayerTree(const blink::LayoutObject* layoutObject)
2673 { 2683 {
2674 if (!layoutObject) { 2684 if (!layoutObject) {
2675 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2685 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2676 return; 2686 return;
2677 } 2687 }
2678 showLayerTree(layoutObject->enclosingLayer()); 2688 showLayerTree(layoutObject->enclosingLayer());
2679 } 2689 }
2680 #endif 2690 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698