| OLD | NEW |
| 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 Loading... |
| 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, | 1495 IntRect hitRect = hitTestLocation.boundingBox(); |
| 1496 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has | 1496 bool fallback = false; |
| 1497 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. | 1497 // If we didn't hit any layers but are still inside the document |
| 1498 // In addtion, it is possible for the mouse to stay in the document but
there is no element. | 1498 // bounds, then we should fallback to hitting the document. |
| 1499 // At that time, the events of the mouse should be fired. | 1499 // For rect-based hit test, we do the fallback only when the hit-rect |
| 1500 // is totally within the document bounds. |
| 1501 if (hitTestArea.contains(LayoutRect(hitRect))) { |
| 1502 fallback = true; |
| 1503 |
| 1504 // Mouse dragging outside the main document should also be |
| 1505 // delivered to the document. |
| 1506 // TODO(miletus): Capture behavior inconsistent with iframes |
| 1507 // crbug.com/522109. |
| 1500 // TODO(majidvp): This should apply more consistently across different e
vent types and we | 1508 // TODO(majidvp): This should apply more consistently across different e
vent types and we |
| 1501 // should not use RequestType for it. Perhaps best for it to be done at
a higher level. See | 1509 // should not use RequestType for it. Perhaps best for it to be done at
a higher level. See |
| 1502 // http://crbug.com/505825 | 1510 // http://crbug.com/505825 |
| 1503 LayoutPoint hitPoint = hitTestLocation.point(); | 1511 } else if ((request.active() || request.release()) && !request.isChildFr
ameHitTest()) { |
| 1504 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { | 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 Loading... |
| 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 |
| OLD | NEW |