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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 { | 385 { |
386 return LayoutReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; | 386 return LayoutReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; |
387 } | 387 } |
388 | 388 |
389 void LayoutSVGRoot::updateCachedBoundaries() | 389 void LayoutSVGRoot::updateCachedBoundaries() |
390 { | 390 { |
391 SVGLayoutSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); | 391 SVGLayoutSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); |
392 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintI
nvalidationBoundingBox); | 392 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintI
nvalidationBoundingBox); |
393 } | 393 } |
394 | 394 |
395 bool LayoutSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated
Offset, HitTestAction hitTestAction) | 395 bool LayoutSVGRoot::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo
cationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAc
tion) |
396 { | 396 { |
397 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum
ulatedOffset); | 397 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum
ulatedOffset); |
398 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); | 398 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); |
399 | 399 |
400 // Only test SVG content if the point is in our content box, or in case we | 400 // Only test SVG content if the point is in our content box, or in case we |
401 // don't clip to the viewport, the visual overflow rect. | 401 // don't clip to the viewport, the visual overflow rect. |
402 // FIXME: This should be an intersection when rect-based hit tests are suppo
rted by nodeAtFloatPoint. | 402 // FIXME: This should be an intersection when rect-based hit tests are suppo
rted by nodeAtFloatPoint. |
403 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip
() && visualOverflowRect().contains(pointInBorderBox))) { | 403 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip
() && visualOverflowRect().contains(pointInBorderBox))) { |
404 const AffineTransform& localToParentTransform = this->localToParentTrans
form(); | 404 const AffineTransform& localToParentTransform = this->localToParentTrans
form(); |
405 if (localToParentTransform.isInvertible()) { | 405 if (localToParentTransform.isInvertible()) { |
406 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl
oatPoint(pointInParent)); | 406 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl
oatPoint(pointInParent)); |
407 | 407 |
408 for (LayoutObject* child = lastChild(); child; child = child->previo
usSibling()) { | 408 for (LayoutObject* child = lastChild(); child; child = child->previo
usSibling()) { |
409 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests
yet. | 409 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests
yet. |
410 if (child->nodeAtFloatPoint(request, result, localPoint, hitTest
Action)) { | 410 if (child->nodeAtFloatPoint(result, localPoint, hitTestAction))
{ |
411 updateHitTestResult(result, pointInBorderBox); | 411 updateHitTestResult(result, pointInBorderBox); |
412 if (!result.addNodeToListBasedTestResult(child->node(), requ
est, locationInContainer)) | 412 if (!result.addNodeToListBasedTestResult(child->node(), loca
tionInContainer)) |
413 return true; | 413 return true; |
414 } | 414 } |
415 } | 415 } |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 // 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. | 419 // 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. |
420 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil
dBlockBackground) && visibleToHitTestRequest(request)) { | 420 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil
dBlockBackground) && visibleToHitTestRequest(result.hitTestRequest())) { |
421 // Only return true here, if the last hit testing phase 'BlockBackground
' (or 'ChildBlockBackground' - depending on context) is executed. | 421 // Only return true here, if the last hit testing phase 'BlockBackground
' (or 'ChildBlockBackground' - depending on context) is executed. |
422 // If we'd return true in the 'Foreground' phase, hit testing would stop
immediately. For SVG only trees this doesn't matter. | 422 // If we'd return true in the 'Foreground' phase, hit testing would stop
immediately. For SVG only trees this doesn't matter. |
423 // Though when we have a <foreignObject> subtree we need to be able to d
etect hits on the background of a <div> element. | 423 // Though when we have a <foreignObject> subtree we need to be able to d
etect hits on the background of a <div> element. |
424 // If we'd return true here in the 'Foreground' phase, we are not able t
o detect these hits anymore. | 424 // If we'd return true here in the 'Foreground' phase, we are not able t
o detect these hits anymore. |
425 LayoutRect boundsRect(accumulatedOffset + location(), size()); | 425 LayoutRect boundsRect(accumulatedOffset + location(), size()); |
426 if (locationInContainer.intersects(boundsRect)) { | 426 if (locationInContainer.intersects(boundsRect)) { |
427 updateHitTestResult(result, pointInBorderBox); | 427 updateHitTestResult(result, pointInBorderBox); |
428 if (!result.addNodeToListBasedTestResult(node(), request, locationIn
Container, boundsRect)) | 428 if (!result.addNodeToListBasedTestResult(node(), locationInContainer
, boundsRect)) |
429 return true; | 429 return true; |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 return false; | 433 return false; |
434 } | 434 } |
435 | 435 |
436 } | 436 } |
OLD | NEW |