bool RenderSVGPath::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // We only draw in the forground phase, so we only hit-test then. if (hitTestAction != HitTestForeground) return false; FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent); if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) return false; PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, style()->pointerEvents()); bool isVisible = (style()->visibility() == VISIBLE); if (isVisible || !hitRules.requireVisible) { const SVGRenderStyle* svgStyle = style()->svgStyle(); WindRule fillRule = svgStyle->fillRule(); if (request.svgClipContent()) fillRule = svgStyle->clipRule(); if ((hitRules.canHitStroke && (svgStyle->hasStroke() || !hitRules.requireStroke) && strokeContains(localPoint, hitRules.requireStroke)) || (hitRules.canHitFill && (svgStyle->hasFill() || !hitRules.requireFill) && fillContains(localPoint, hitRules.requireFill, fillRule))) { updateHitTestResult(result, roundedIntPoint(localPoint)); return true; } } return false; }
bool LayoutSVGShape::nodeAtFloatPointInternal(const HitTestRequest& request, const FloatPoint& localPoint, PointerEventsHitRules hitRules) { bool isVisible = (style()->visibility() == VISIBLE); if (isVisible || !hitRules.requireVisible) { const SVGComputedStyle& svgStyle = style()->svgStyle(); WindRule fillRule = svgStyle.fillRule(); if (request.svgClipContent()) fillRule = svgStyle.clipRule(); if ((hitRules.canHitBoundingBox && objectBoundingBox().contains(localPoint)) || (hitRules.canHitStroke && (svgStyle.hasStroke() || !hitRules.requireStroke) && strokeContains(localPoint, hitRules.requireStroke)) || (hitRules.canHitFill && (svgStyle.hasFill() || !hitRules.requireFill) && fillContains(localPoint, hitRules.requireFill, fillRule))) return true; } return false; }