void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*) const { // this is called from paint() after the localTransform has already been applied IntRect contentRect = enclosingIntRect(paintInvalidationRectInLocalCoordinates()); if (!contentRect.isEmpty()) rects.append(contentRect); }
LayoutRect LayoutSVGRoot::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const { // This is an open-coded aggregate of SVGLayoutSupport::clippedOverflowRectForPaintInvalidation, // LayoutSVGRoot::mapToVisibleRectInContainerSpace and LayoutReplaced::clippedOverflowRectForPaintInvalidation. // The reason for this is to optimize/minimize the paint invalidation rect when the box is not "decorated" // (does not have background/border/etc.) // Return early for any cases where we don't actually paint. if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent()) return LayoutRect(); // Compute the paint invalidation rect of the content of the SVG in the border-box coordinate space. FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalCoordinates(); contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(contentPaintInvalidationRect); // Apply initial viewport clip, overflow:visible content is added to visualOverflow // but the most common case is that overflow is hidden, so always intersect. contentPaintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); LayoutRect paintInvalidationRect = enclosingLayoutRect(contentPaintInvalidationRect); // If the box is decorated or is overflowing, extend it to include the border-box and overflow. if (m_hasBoxDecorationBackground || hasOverflowModel()) { // The selectionRect can project outside of the overflowRect, so take their union // for paint invalidation to avoid selection painting glitches. LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect(), visualOverflowRect()); paintInvalidationRect.unite(decoratedPaintInvalidationRect); } // Compute the paint invalidation rect in the parent coordinate space. LayoutRect rect(enclosingIntRect(paintInvalidationRect)); LayoutReplaced::mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, paintInvalidationState); return rect; }
void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint&) const { // this is called from paint() after the localTransform has already been applied LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates()); if (!contentRect.isEmpty()) rects.append(contentRect); }
void RenderSVGRoot::layout() { ASSERT(needsLayout()); // Arbitrary affine transforms are incompatible with LayoutState. ForceHorriblySlowRectMapping slowRectMapping(*this); bool needsLayout = selfNeedsLayout(); LayoutSize oldSize = size(); updateLogicalWidth(); updateLogicalHeight(); buildLocalToBorderBoxTransform(); SVGRenderSupport::layoutResourcesIfNeeded(this); SVGSVGElement* svg = toSVGSVGElement(node()); ASSERT(svg); m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filtersForceContainerLayout(this)); if (m_needsBoundariesOrTransformUpdate) { updateCachedBoundaries(); m_needsBoundariesOrTransformUpdate = false; } m_overflow.clear(); addVisualEffectOverflow(); if (!shouldApplyViewportClip()) { FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates(); contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect); addVisualOverflow(enclosingLayoutRect(contentRepaintRect)); } updateLayerTransformAfterLayout(); m_hasBoxDecorationBackground = isDocumentElement() ? calculateHasBoxDecorations() : hasBoxDecorationBackground(); invalidateBackgroundObscurationStatus(); clearNeedsLayout(); }
void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&) { ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); if (paintInfo.phase != PaintPhaseForeground || style()->visibility() == HIDDEN || !m_imageResource->hasImage()) return; FloatRect boundingBox = paintInvalidationRectInLocalCoordinates(); if (!SVGRenderSupport::paintInfoIntersectsPaintInvalidationRect(boundingBox, m_localTransform, paintInfo)) return; PaintInfo childPaintInfo(paintInfo); GraphicsContextStateSaver stateSaver(*childPaintInfo.context, false); if (!m_localTransform.isIdentity()) { stateSaver.save(); childPaintInfo.applyTransform(m_localTransform, false); } if (!m_objectBoundingBox.isEmpty()) { // SVGRenderingContext may taint the state - make sure we're always saving. SVGRenderingContext renderingContext(this, childPaintInfo, stateSaver.saved() ? SVGRenderingContext::DontSaveGraphicsContext : SVGRenderingContext::SaveGraphicsContext); if (renderingContext.isRenderingPrepared()) { if (style()->svgStyle().bufferedRendering() == BR_STATIC && renderingContext.bufferForeground(m_bufferedForeground)) return; paintForeground(childPaintInfo); } } if (style()->outlineWidth()) paintOutline(childPaintInfo, IntRect(boundingBox)); }
// addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call void RenderSVGContainer::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*) const { LayoutRect paintRectInParent = LayoutRect(localToParentTransform().mapRect(paintInvalidationRectInLocalCoordinates())); if (!paintRectInParent.isEmpty()) rects.append(paintRectInParent); }
// This method is called from inside paintOutline() since we call paintOutline() // while transformed to our coord system, return local coords void LayoutSVGShape::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint&, IncludeBlockVisualOverflowOrNot) const { rects.append(LayoutRect(paintInvalidationRectInLocalCoordinates())); }
// The SVG addFocusRingRects() method adds rects in local coordinates so the default absoluteFocusRingQuads // returns incorrect values for SVG objects. Overriding this method provides access to the absolute bounds. void RenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) { quads.append(localToAbsoluteQuad(FloatQuad(paintInvalidationRectInLocalCoordinates()))); }
void LayoutSVGImage::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint&, IncludeBlockVisualOverflowOrNot) const { // this is called from paint() after the localTransform has already been applied rects.append(LayoutRect(paintInvalidationRectInLocalCoordinates())); }