Chromium Code Reviews| Index: Source/core/rendering/svg/RenderSVGRoot.cpp |
| diff --git a/Source/core/rendering/svg/RenderSVGRoot.cpp b/Source/core/rendering/svg/RenderSVGRoot.cpp |
| index dc5383605f90f1e035c503033a73375a4bb788b1..3935a67a4c71a58490546fcbcf5677537fab4bf9 100644 |
| --- a/Source/core/rendering/svg/RenderSVGRoot.cpp |
| +++ b/Source/core/rendering/svg/RenderSVGRoot.cpp |
| @@ -231,6 +231,14 @@ void RenderSVGRoot::layout() |
| clearNeedsLayout(); |
| } |
| +bool RenderSVGRoot::shouldApplyViewportClip() const |
| +{ |
| + // the outermost svg is clipped if auto, and svg document roots are always clipped |
| + // When the svg is standalone (isRoot() == true) the viewport clipping should always |
| + // be applied, noting that the window scrollbars should be hidden if overflow=hidden. |
| + return style()->overflowX() == OHIDDEN || style()->overflowX() == OAUTO || this->isRoot(); |
|
fs
2014/04/15 15:43:07
isRoot() was recently renamed isDocumentElement().
Erik Dahlström (inactive)
2014/04/16 15:53:49
Fixed.
|
| +} |
| + |
| void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| { |
| // An empty viewport disables rendering. |
| @@ -259,8 +267,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 (shouldApplyViewportClip()) |
| + 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. |
| @@ -399,8 +408,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 (shouldApplyViewportClip()) |
| + repaintRect.intersect(pixelSnappedBorderBoxRect()); |
| LayoutRect rect = enclosingIntRect(repaintRect); |
| RenderReplaced::computeRectForRepaint(repaintContainer, rect, fixed); |