bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // Give RenderSVGViewportContainer a chance to apply its viewport clip if (!pointIsInsideViewportClip(pointInParent)) return false; FloatPoint localPoint; if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, localToParentTransform(), pointInParent, localPoint)) return false; for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { updateHitTestResult(result, roundedLayoutPoint(localPoint)); return true; } } // pointer-events=boundingBox makes it possible for containers to be direct targets if (style()->pointerEvents() == PE_BOUNDINGBOX) { ASSERT(isObjectBoundingBoxValid()); if (objectBoundingBox().contains(localPoint)) { updateHitTestResult(result, roundedLayoutPoint(localPoint)); return true; } } // 16.4: "If there are no graphics elements whose relevant graphics content is under the pointer (i.e., there is no target element), the event is not dispatched." return false; }
bool LayoutSVGContainer::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // Give LayoutSVGViewportContainer a chance to apply its viewport clip if (!pointIsInsideViewportClip(pointInParent)) return false; FloatPoint localPoint; if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping( *this, localToSVGParentTransform(), pointInParent, localPoint)) return false; for (LayoutObject* child = lastChild(); child; child = child->previousSibling()) { if (child->nodeAtFloatPoint(result, localPoint, hitTestAction)) { const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint); updateHitTestResult(result, localLayoutPoint); if (result.addNodeToListBasedTestResult( child->node(), localLayoutPoint) == StopHitTesting) return true; } } // pointer-events: bounding-box makes it possible for containers to be direct // targets. if (style()->pointerEvents() == PE_BOUNDINGBOX) { // Check for a valid bounding box because it will be invalid for empty // containers. if (isObjectBoundingBoxValid() && objectBoundingBox().contains(localPoint)) { const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint); updateHitTestResult(result, localLayoutPoint); if (result.addNodeToListBasedTestResult(element(), localLayoutPoint) == StopHitTesting) return true; } } // 16.4: "If there are no graphics elements whose relevant graphics content is // under the pointer (i.e., there is no target element), the event is not // dispatched." return false; }