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..b8ed55f1db63e3156d0b0fd9edc3be8fbc9c4ad1 100644 |
--- a/Source/core/rendering/svg/RenderSVGRoot.cpp |
+++ b/Source/core/rendering/svg/RenderSVGRoot.cpp |
@@ -228,6 +228,12 @@ void RenderSVGRoot::layout() |
clearNeedsLayout(); |
} |
+bool RenderSVGRoot::applyViewportClip() const |
esprehn
2014/04/05 20:19:22
this should be named with an "is" or "should" pref
|
+{ |
+ // the outermost svg is clipped if auto, and svg document roots are always clipped |
+ return style()->overflowX() == OHIDDEN || style()->overflowX() == OAUTO || this->isRoot(); |
+} |
+ |
void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
// An empty viewport disables rendering. |
@@ -256,8 +262,9 @@ void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint |
PaintInfo childPaintInfo(paintInfo); |
childPaintInfo.context->save(); |
- // Apply initial viewport clip - not affected by overflow handling |
- childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset))); |
+ // Apply initial viewport clip |
+ if (applyViewportClip()) |
+ childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset))); |
// Convert from container offsets (html renderers) to a relative transform (svg renderers). |
// Transform from our paint container's coordinate system to our local coords. |
@@ -364,8 +371,9 @@ void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* rep |
// and then call RenderBox's method to handle all the normal CSS Box model bits |
repaintRect = m_localToBorderBoxTransform.mapRect(repaintRect); |
- // Apply initial viewport clip - not affected by overflow settings |
- repaintRect.intersect(pixelSnappedBorderBoxRect()); |
+ // Apply initial viewport clip |
+ if (applyViewportClip()) |
+ repaintRect.intersect(pixelSnappedBorderBoxRect()); |
LayoutRect rect = enclosingIntRect(repaintRect); |
RenderReplaced::computeRectForRepaint(repaintContainer, rect, fixed); |