示例#1
0
void SVGRenderSupport::computeFloatRectForRepaint(const RenderElement& renderer, const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed)
{
    const SVGRenderStyle& svgStyle = renderer.style().svgStyle();
    if (const ShadowData* shadow = svgStyle.shadow())
        shadow->adjustRectForShadow(repaintRect);
    repaintRect.inflate(renderer.style().outlineWidth());

    // Translate to coords in our parent renderer, and then call computeFloatRectForRepaint() on our parent.
    repaintRect = renderer.localToParentTransform().mapRect(repaintRect);
    renderer.parent()->computeFloatRectForRepaint(repaintContainer, repaintRect, fixed);
}
示例#2
0
void SVGRenderSupport::mapLocalToContainer(const RenderElement& renderer, const RenderLayerModelObject* repaintContainer, TransformState& transformState, bool* wasFixed)
{
    transformState.applyTransform(renderer.localToParentTransform());

    ASSERT(renderer.parent());
    auto& parent = *renderer.parent();
    
    // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform 
    // to map an element from SVG viewport coordinates to CSS box coordinates.
    // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates.
    if (parent.isSVGRoot())
        transformState.applyTransform(toRenderSVGRoot(parent).localToBorderBoxTransform());

    MapCoordinatesFlags mode = UseTransforms;
    parent.mapLocalToContainer(repaintContainer, transformState, mode, wasFixed);
}