Chromium Code Reviews| 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 // TODO(chadarmstrong) think about having one function here that just returned a vector | |
| 342 // with the whole tree's stacking contexts in order. This would keep the concept of hit testing | |
| 343 // and painting abstracted from this class. | |
|
Julien - ping for review
2015/06/05 00:46:55
This is better in a bug IMHO (see other comment).
chadarmstrong
2015/06/05 17:24:34
Added bug 497219
| |
| 344 bool DeprecatedPaintLayerStackingNode::hitTest(HitTestResult& result) | |
| 345 { | |
| 346 return hitTest(result.hitTestRequest(), result.hitTestLocation(), result); | |
| 347 } | |
| 348 | |
| 349 bool DeprecatedPaintLayerStackingNode::hitTest(const HitTestRequest& request, co nst HitTestLocation& hitTestLocation, HitTestResult& result) | |
| 350 { | |
| 351 ASSERT(layer()->isSelfPaintingLayer() || layer()->hasSelfPaintingLayerDescen dant()); | |
|
Julien - ping for review
2015/06/05 00:46:55
The hit testing code only calls this function on L
chadarmstrong
2015/06/05 17:24:34
That should be a different CL
| |
| 352 | |
| 353 // LayoutView should make sure to update layout before entering hit testing | |
| 354 ASSERT(!layoutObject()->frame()->view()->layoutPending()); | |
| 355 ASSERT(!layoutObject()->document().layoutView()->needsLayout()); | |
| 356 | |
| 357 // Start with frameVisibleRect to ensure we include the scrollbars. | |
| 358 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); | |
| 359 if (request.ignoreClipping()) | |
| 360 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); | |
| 361 | |
| 362 DeprecatedPaintLayer* insideLayer = layer()->hitTestLayer(layer(), 0, result , hitTestArea, hitTestLocation, false); | |
| 363 if (!insideLayer) { | |
| 364 // We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down, | |
| 365 // return ourselves. We do this so mouse events continue getting deliver ed after a drag has | |
| 366 // exited the WebView, and so hit testing over a scrollbar hits the cont ent document. | |
| 367 // In addtion, it is possible for the mouse to stay in the document but there is no element. | |
| 368 // At that time, the events of the mouse should be fired. | |
| 369 LayoutPoint hitPoint = hitTestLocation.point(); | |
| 370 if (!request.isChildFrameHitTest() && ((request.active() || request.rele ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y()))) && layer()->isRootLayer()) { | |
| 371 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec t())->flipForWritingMode(hitTestLocation.point())); | |
| 372 insideLayer = layer(); | |
| 373 } | |
| 374 } | |
| 375 | |
| 376 // Now determine if the result is inside an anchor - if the urlElement isn't already set. | |
| 377 Node* node = result.innerNode(); | |
| 378 if (node && !result.URLElement()) | |
| 379 result.setURLElement(node->enclosingLinkEventParentOrSelf()); | |
| 380 | |
| 381 // Now return whether we were inside this layer (this will always be true fo r the root | |
| 382 // layer). | |
| 383 return insideLayer; | |
| 384 } | |
| 385 | |
| 329 } // namespace blink | 386 } // namespace blink |
| OLD | NEW |