Index: Source/core/rendering/PaintInvalidationState.cpp |
diff --git a/Source/core/rendering/PaintInvalidationState.cpp b/Source/core/rendering/PaintInvalidationState.cpp |
index 96a6bf8aaff2808f557b513d6429e600d28d1943..2e547196cb496bff43e9cadfe55497f4eca16aaa 100644 |
--- a/Source/core/rendering/PaintInvalidationState.cpp |
+++ b/Source/core/rendering/PaintInvalidationState.cpp |
@@ -9,6 +9,7 @@ |
#include "core/rendering/RenderLayer.h" |
#include "core/rendering/RenderView.h" |
#include "core/rendering/svg/RenderSVGModelObject.h" |
+#include "core/rendering/svg/RenderSVGRoot.h" |
#include "platform/Partitions.h" |
namespace blink { |
@@ -76,11 +77,44 @@ PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex |
m_clipRect = next.m_clipRect; |
} |
+ if (m_cachedOffsetsEnabled && renderer.isSVGRoot()) { |
+ const RenderSVGRoot& svgRoot = toRenderSVGRoot(renderer); |
+ m_svgTransform = svgRoot.localToBorderBoxTransform(); |
+ if (svgRoot.shouldApplyViewportClip()) |
+ addClipRectRelativeToPaintOffset(svgRoot.pixelSnappedSize()); |
+ } |
+ |
applyClipIfNeeded(renderer); |
// FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. |
} |
+PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& next, const RenderSVGModelObject& renderer) |
+ : m_clipped(next.m_clipped) |
+ , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) |
+ , m_forceCheckForPaintInvalidation(next.m_forceCheckForPaintInvalidation) |
+ , m_clipRect(next.m_clipRect) |
+ , m_paintOffset(next.m_paintOffset) |
+ , m_paintInvalidationContainer(next.m_paintInvalidationContainer) |
+ , m_svgTransform(next.m_svgTransform) |
+{ |
+ ASSERT(renderer != m_paintInvalidationContainer); |
+ |
+ if (m_cachedOffsetsEnabled) |
+ m_svgTransform *= renderer.localToParentTransform(); |
+} |
+ |
+void PaintInvalidationState::addClipRectRelativeToPaintOffset(const LayoutSize& clipSize) |
+{ |
+ LayoutRect clipRect(toPoint(m_paintOffset), clipSize); |
+ if (m_clipped) { |
+ m_clipRect.intersect(clipRect); |
+ } else { |
+ m_clipRect = clipRect; |
+ m_clipped = true; |
+ } |
+} |
+ |
void PaintInvalidationState::applyClipIfNeeded(const RenderObject& renderer) |
{ |
if (!renderer.hasOverflowClip()) |
@@ -90,17 +124,10 @@ void PaintInvalidationState::applyClipIfNeeded(const RenderObject& renderer) |
// Do not clip scroll layer contents because the compositor expects the whole layer |
// to be always invalidated in-time. |
- if (box.usesCompositedScrolling()) { |
+ if (box.usesCompositedScrolling()) |
ASSERT(!m_clipped); // The box should establish paint invalidation container, so no m_clipped inherited. |
- } else { |
- LayoutRect clipRect(toPoint(m_paintOffset), box.layer()->size()); |
- if (m_clipped) { |
- m_clipRect.intersect(clipRect); |
- } else { |
- m_clipRect = clipRect; |
- m_clipped = true; |
- } |
- } |
+ else |
+ addClipRectRelativeToPaintOffset(box.layer()->size()); |
m_paintOffset -= box.scrolledContentOffset(); |
} |