| 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 26 matching lines...) Expand all Loading... |
| 37 * version of this file under the LGPL, indicate your decision by | 37 * version of this file under the LGPL, indicate your decision by |
| 38 * deletingthe provisions above and replace them with the notice and | 38 * deletingthe provisions above and replace them with the notice and |
| 39 * other provisions required by the MPL or the GPL, as the case may be. | 39 * other provisions required by the MPL or the GPL, as the case may be. |
| 40 * If you do not delete the provisions above, a recipient may use your | 40 * If you do not delete the provisions above, a recipient may use your |
| 41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
| 42 */ | 42 */ |
| 43 | 43 |
| 44 #include "config.h" | 44 #include "config.h" |
| 45 #include "core/paint/DeprecatedPaintLayerStackingNode.h" | 45 #include "core/paint/DeprecatedPaintLayerStackingNode.h" |
| 46 | 46 |
| 47 #include "core/layout/HitTestLocation.h" |
| 48 #include "core/layout/HitTestRequest.h" |
| 49 #include "core/layout/HitTestResult.h" |
| 47 #include "core/layout/LayoutView.h" | 50 #include "core/layout/LayoutView.h" |
| 48 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 51 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| 49 #include "core/paint/DeprecatedPaintLayer.h" | 52 #include "core/paint/DeprecatedPaintLayer.h" |
| 50 #include "public/platform/Platform.h" | 53 #include "public/platform/Platform.h" |
| 51 | 54 |
| 52 namespace blink { | 55 namespace blink { |
| 53 | 56 |
| 54 // FIXME: This should not require DeprecatedPaintLayer. There is currently a cyc
le where | 57 // FIXME: This should not require DeprecatedPaintLayer. There is currently a cyc
le where |
| 55 // in order to determine if we shoulBeNormalFlowOnly() we have to ask the paint | 58 // in order to determine if we shoulBeNormalFlowOnly() we have to ask the paint |
| 56 // layer about some of its state. | 59 // layer about some of its state. |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNode::ancestorStac
kingContextNode() const | 317 DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNode::ancestorStac
kingContextNode() const |
| 315 { | 318 { |
| 316 for (DeprecatedPaintLayer* ancestor = layer()->parent(); ancestor; ancestor
= ancestor->parent()) { | 319 for (DeprecatedPaintLayer* ancestor = layer()->parent(); ancestor; ancestor
= ancestor->parent()) { |
| 317 DeprecatedPaintLayerStackingNode* stackingNode = ancestor->stackingNode(
); | 320 DeprecatedPaintLayerStackingNode* stackingNode = ancestor->stackingNode(
); |
| 318 if (stackingNode->isStackingContext()) | 321 if (stackingNode->isStackingContext()) |
| 319 return stackingNode; | 322 return stackingNode; |
| 320 } | 323 } |
| 321 return 0; | 324 return 0; |
| 322 } | 325 } |
| 323 | 326 |
| 327 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) |
| 328 { |
| 329 FrameView* frameView = layoutObject->document().view(); |
| 330 if (!frameView) |
| 331 return LayoutRect(); |
| 332 |
| 333 return LayoutRect(frameView->visibleContentRect()); |
| 334 } |
| 335 |
| 324 LayoutBoxModelObject* DeprecatedPaintLayerStackingNode::layoutObject() const | 336 LayoutBoxModelObject* DeprecatedPaintLayerStackingNode::layoutObject() const |
| 325 { | 337 { |
| 326 return m_layer->layoutObject(); | 338 return m_layer->layoutObject(); |
| 327 } | 339 } |
| 328 | 340 |
| 341 bool DeprecatedPaintLayerStackingNode::hitTest(HitTestResult& result) |
| 342 { |
| 343 return hitTest(result.hitTestRequest(), result.hitTestLocation(), result); |
| 344 } |
| 345 |
| 346 bool DeprecatedPaintLayerStackingNode::hitTest(const HitTestRequest& request, co
nst HitTestLocation& hitTestLocation, HitTestResult& result) |
| 347 { |
| 348 ASSERT(layer()->isSelfPaintingLayer() || layer()->hasSelfPaintingLayerDescen
dant()); |
| 349 |
| 350 // LayoutView should make sure to update layout before entering hit testing |
| 351 ASSERT(!layoutObject()->frame()->view()->layoutPending()); |
| 352 ASSERT(!layoutObject()->document().layoutView()->needsLayout()); |
| 353 |
| 354 // Start with frameVisibleRect to ensure we include the scrollbars. |
| 355 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); |
| 356 if (request.ignoreClipping()) |
| 357 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); |
| 358 |
| 359 DeprecatedPaintLayer* insideLayer = layer()->hitTestLayer(layer(), 0, result
, hitTestArea, hitTestLocation, false); |
| 360 if (!insideLayer) { |
| 361 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, |
| 362 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has |
| 363 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. |
| 364 // In addtion, it is possible for the mouse to stay in the document but
there is no element. |
| 365 // At that time, the events of the mouse should be fired. |
| 366 LayoutPoint hitPoint = hitTestLocation.point(); |
| 367 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& layer()->isRootLayer()) { |
| 368 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec
t())->flipForWritingMode(hitTestLocation.point())); |
| 369 insideLayer = layer(); |
| 370 } |
| 371 } |
| 372 |
| 373 // Now determine if the result is inside an anchor - if the urlElement isn't
already set. |
| 374 Node* node = result.innerNode(); |
| 375 if (node && !result.URLElement()) |
| 376 result.setURLElement(node->enclosingLinkEventParentOrSelf()); |
| 377 |
| 378 // Now return whether we were inside this layer (this will always be true fo
r the root |
| 379 // layer). |
| 380 return insideLayer; |
| 381 } |
| 382 |
| 329 } // namespace blink | 383 } // namespace blink |
| OLD | NEW |