Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1656)

Unified Diff: Source/core/rendering/svg/RenderSVGRoot.cpp

Issue 220853002: SVG does not respect overflow:visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: overflow affects root svg's scrollbars Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« Source/core/css/resolver/StyleAdjuster.cpp ('K') | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698