Exemplo n.º 1
0
bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke)
{
    if (!strokeBoundingBox().contains(point))
        return false;

    Color fallbackColor;
    if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style(), fallbackColor))
        return false;

    const SVGRenderStyle* svgStyle = style()->svgStyle();
    for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
        ASSERT(style()->svgStyle()->hasStroke());
        float strokeWidth = this->strokeWidth();
        if (style()->svgStyle()->capStyle() == SquareCap) {
            if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point))
                return true;
        } else {
            ASSERT(style()->svgStyle()->capStyle() == RoundCap);
            FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].x(), point.y() -  m_zeroLengthLinecapLocations[i].y());
            if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
                return true;
        }
    }

    if (!svgStyle->strokeDashArray().isEmpty() || svgStyle->strokeMiterLimit() != svgStyle->initialStrokeMiterLimit()
        || svgStyle->joinStyle() != svgStyle->initialJoinStyle() || svgStyle->capStyle() != svgStyle->initialCapStyle()) {
        if (!m_path)
            RenderSVGShape::createShape();
        return RenderSVGShape::shapeDependentStrokeContains(point);
    }
    return shapeDependentStrokeContains(point);
}
Exemplo n.º 2
0
bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke)
{
    if (!strokeBoundingBox().contains(point))
        return false;

    Color fallbackColor;
    if (requiresStroke && !RenderSVGResource::strokePaintingResource(*this, style(), fallbackColor))
        return false;

    return shapeDependentStrokeContains(point);
}
Exemplo n.º 3
0
bool LayoutSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke)
{
    if (requiresStroke) {
        if (!strokeBoundingBox().contains(point))
            return false;

        if (!SVGPaintServer::existsForLayoutObject(*this, styleRef(), ApplyToStrokeMode))
            return false;
    } else {
        if (!hitTestStrokeBoundingBox().contains(point))
            return false;
    }

    return shapeDependentStrokeContains(point);
}