| 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 781 } |
| 782 } | 782 } |
| 783 | 783 |
| 784 void RenderLayer::restoreClip(GraphicsContext* context, const LayoutRect& paintD
irtyRect, const ClipRect& clipRect) | 784 void RenderLayer::restoreClip(GraphicsContext* context, const LayoutRect& paintD
irtyRect, const ClipRect& clipRect) |
| 785 { | 785 { |
| 786 if (clipRect.rect() == paintDirtyRect && !clipRect.hasRadius()) | 786 if (clipRect.rect() == paintDirtyRect && !clipRect.hasRadius()) |
| 787 return; | 787 return; |
| 788 context->restore(); | 788 context->restore(); |
| 789 } | 789 } |
| 790 | 790 |
| 791 static inline LayoutRect frameVisibleRect(RenderObject* renderer) | |
| 792 { | |
| 793 FrameView* frameView = renderer->document().view(); | |
| 794 if (!frameView) | |
| 795 return LayoutRect(); | |
| 796 | |
| 797 return frameView->visibleContentRect(); | |
| 798 } | |
| 799 | |
| 800 bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestLocation&
hitTestLocation, HitTestResult& result) | |
| 801 { | |
| 802 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | |
| 803 | |
| 804 // RenderView should make sure to update layout before entering hit testing | |
| 805 ASSERT(!renderer()->frame()->view()->layoutPending()); | |
| 806 ASSERT(!renderer()->document().renderView()->needsLayout()); | |
| 807 | |
| 808 LayoutRect hitTestArea = renderer()->view()->documentRect(); | |
| 809 if (!request.ignoreClipping()) | |
| 810 hitTestArea.intersect(frameVisibleRect(renderer())); | |
| 811 | |
| 812 RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestAre
a, hitTestLocation); | |
| 813 if (!insideLayer) { | |
| 814 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, | |
| 815 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has | |
| 816 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. | |
| 817 if ((request.active() || request.release()) && isRootLayer()) { | |
| 818 renderer()->updateHitTestResult(result, hitTestLocation.point()); | |
| 819 insideLayer = this; | |
| 820 } | |
| 821 } | |
| 822 return insideLayer; | |
| 823 } | |
| 824 | |
| 825 Node* RenderLayer::enclosingElement() const | 791 Node* RenderLayer::enclosingElement() const |
| 826 { | 792 { |
| 827 for (RenderObject* r = renderer(); r; r = r->parent()) { | 793 for (RenderObject* r = renderer(); r; r = r->parent()) { |
| 828 if (Node* e = r->node()) | 794 if (Node* e = r->node()) |
| 829 return e; | 795 return e; |
| 830 } | 796 } |
| 831 ASSERT_NOT_REACHED(); | 797 ASSERT_NOT_REACHED(); |
| 832 return 0; | 798 return 0; |
| 833 } | 799 } |
| 834 | 800 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 } | 1357 } |
| 1392 } | 1358 } |
| 1393 | 1359 |
| 1394 void showLayerTree(const blink::RenderObject* renderer) | 1360 void showLayerTree(const blink::RenderObject* renderer) |
| 1395 { | 1361 { |
| 1396 if (!renderer) | 1362 if (!renderer) |
| 1397 return; | 1363 return; |
| 1398 showLayerTree(renderer->enclosingLayer()); | 1364 showLayerTree(renderer->enclosingLayer()); |
| 1399 } | 1365 } |
| 1400 #endif | 1366 #endif |
| OLD | NEW |