Index: Source/core/rendering/svg/RenderSVGRoot.cpp |
diff --git a/Source/core/rendering/svg/RenderSVGRoot.cpp b/Source/core/rendering/svg/RenderSVGRoot.cpp |
index f63f5f9a8c9583b583577bff16721aabd575d66e..91d6ceea364bf586ea2b95d8e242102229e37fd6 100644 |
--- a/Source/core/rendering/svg/RenderSVGRoot.cpp |
+++ b/Source/core/rendering/svg/RenderSVGRoot.cpp |
@@ -29,6 +29,7 @@ |
#include "core/rendering/HitTestResult.h" |
#include "core/rendering/LayoutRectRecorder.h" |
#include "core/rendering/LayoutRepainter.h" |
+#include "core/rendering/RenderLayer.h" |
#include "core/rendering/RenderPart.h" |
#include "core/rendering/RenderView.h" |
#include "core/rendering/svg/RenderSVGResourceContainer.h" |
@@ -221,10 +222,12 @@ void RenderSVGRoot::layout() |
m_needsBoundariesOrTransformUpdate = false; |
} |
+ m_overflow.clear(); |
f(malita)
2014/04/02 20:45:48
Not the fault of this CL I think, but poking at th
fs
2014/04/03 07:58:59
Yes, this pattern seemed to be used in a few place
|
+ addVisualEffectOverflow(); |
updateLayerTransform(); |
+ invalidateBackgroundObscurationStatus(); |
repainter.repaintAfterLayout(); |
- |
clearNeedsLayout(); |
} |
@@ -353,9 +356,53 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const |
return m_localToParentTransform; |
} |
+bool RenderSVGRoot::needToRepaintBorderBox() const |
+{ |
+ // Check if the box has any overflow defined (includes outline and |
+ // box-shadow for instance.) |
+ if (hasRenderOverflow()) |
+ return true; |
+ // If it's the document root, then include the border-box in the repaint |
+ // rect if it's got a background or a border specified. The reason for not |
+ // using the flag in this case is because said flag is unconditionally set |
+ // to 'true' for the document root. |
+ if (isRoot()) |
+ return calculateHasBoxDecorations(); |
+ // Otherwise, consider all box decorations. |
+ return hasBoxDecorations(); |
+} |
+ |
LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const |
{ |
- return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); |
+ // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectForRepaint, |
+ // RenderSVGRoot::computeFloatRectForRepaint and RenderReplaced::clippedOverflowRectForRepaint. |
+ // The reason for this is to optimize/minimize the repaint 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 repaint rect of the content of the SVG in the border-box coordinate space. |
+ FloatRect contentRepaintRect = repaintRectInLocalCoordinates(); |
+ contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect); |
+ |
+ // Apply initial viewport clip - not affected by overflow settings |
+ contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); |
+ |
+ LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); |
+ // If the box is decorated, extend it to include the border-box. |
+ if (needToRepaintBorderBox()) { |
+ // The selectionRect can project outside of the overflowRect, so take their union |
+ // for repainting to avoid selection painting glitches. |
+ LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), visualOverflowRect()); |
+ repaintRect.unite(decoratedRepaintRect); |
+ } |
+ |
+ // Compute the repaint rect in the parent coordinate space. |
+ LayoutRect rect = enclosingIntRect(repaintRect); |
+ RenderReplaced::computeRectForRepaint(repaintContainer, rect); |
+ return rect; |
} |
void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const |
@@ -392,7 +439,6 @@ void RenderSVGRoot::updateCachedBoundaries() |
{ |
SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); |
SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox); |
- m_repaintBoundingBox.inflate(borderAndPaddingWidth().toFloat()); |
} |
bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |