| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
| 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // don't clip to the viewport, the visual overflow rect. | 389 // don't clip to the viewport, the visual overflow rect. |
| 390 // FIXME: This should be an intersection when rect-based hit tests are suppo
rted by nodeAtFloatPoint. | 390 // FIXME: This should be an intersection when rect-based hit tests are suppo
rted by nodeAtFloatPoint. |
| 391 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip
() && visualOverflowRect().contains(pointInBorderBox))) { | 391 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip
() && visualOverflowRect().contains(pointInBorderBox))) { |
| 392 const AffineTransform& localToParentTransform = this->localToParentTrans
form(); | 392 const AffineTransform& localToParentTransform = this->localToParentTrans
form(); |
| 393 if (localToParentTransform.isInvertible()) { | 393 if (localToParentTransform.isInvertible()) { |
| 394 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl
oatPoint(pointInParent)); | 394 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl
oatPoint(pointInParent)); |
| 395 | 395 |
| 396 for (LayoutObject* child = lastChild(); child; child = child->previo
usSibling()) { | 396 for (LayoutObject* child = lastChild(); child; child = child->previo
usSibling()) { |
| 397 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests
yet. | 397 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests
yet. |
| 398 if (child->nodeAtFloatPoint(result, localPoint, hitTestAction))
{ | 398 if (child->nodeAtFloatPoint(result, localPoint, hitTestAction))
{ |
| 399 updateHitTestResult(result, pointInBorderBox); | 399 updateHitTestResult(result, pointInBorderBox, boundingRect(l
ocationInContainer.point())); |
| 400 if (!result.addNodeToListBasedTestResult(child->node(), loca
tionInContainer)) | 400 if (!result.addNodeToListBasedTestResult(child->node(), loca
tionInContainer)) |
| 401 return true; | 401 return true; |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 // If we didn't early exit above, we've just hit the container <svg> element
. Unlike SVG 1.1, 2nd Edition allows container elements to be hit. | 407 // If we didn't early exit above, we've just hit the container <svg> element
. Unlike SVG 1.1, 2nd Edition allows container elements to be hit. |
| 408 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil
dBlockBackground) && visibleToHitTestRequest(result.hitTestRequest())) { | 408 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil
dBlockBackground) && visibleToHitTestRequest(result.hitTestRequest())) { |
| 409 // Only return true here, if the last hit testing phase 'BlockBackground
' (or 'ChildBlockBackground' - depending on context) is executed. | 409 // Only return true here, if the last hit testing phase 'BlockBackground
' (or 'ChildBlockBackground' - depending on context) is executed. |
| 410 // If we'd return true in the 'Foreground' phase, hit testing would stop
immediately. For SVG only trees this doesn't matter. | 410 // If we'd return true in the 'Foreground' phase, hit testing would stop
immediately. For SVG only trees this doesn't matter. |
| 411 // Though when we have a <foreignObject> subtree we need to be able to d
etect hits on the background of a <div> element. | 411 // Though when we have a <foreignObject> subtree we need to be able to d
etect hits on the background of a <div> element. |
| 412 // If we'd return true here in the 'Foreground' phase, we are not able t
o detect these hits anymore. | 412 // If we'd return true here in the 'Foreground' phase, we are not able t
o detect these hits anymore. |
| 413 LayoutRect boundsRect(accumulatedOffset + location(), size()); | 413 LayoutRect boundsRect(accumulatedOffset + location(), size()); |
| 414 if (locationInContainer.intersects(boundsRect)) { | 414 if (locationInContainer.intersects(boundsRect)) { |
| 415 updateHitTestResult(result, pointInBorderBox); | 415 updateHitTestResult(result, pointInBorderBox, boundsRect); |
| 416 if (!result.addNodeToListBasedTestResult(node(), locationInContainer
, boundsRect)) | 416 if (!result.addNodeToListBasedTestResult(node(), locationInContainer
, boundsRect)) |
| 417 return true; | 417 return true; |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 return false; | 421 return false; |
| 422 } | 422 } |
| 423 | 423 |
| 424 } | 424 } |
| OLD | NEW |