Index: Source/core/rendering/PaintInvalidationState.cpp |
diff --git a/Source/core/rendering/PaintInvalidationState.cpp b/Source/core/rendering/PaintInvalidationState.cpp |
index 96a6bf8aaff2808f557b513d6429e600d28d1943..ea23a83849be1b53469ff767b5c31f42f7a1c890 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,43 @@ PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex |
m_clipRect = next.m_clipRect; |
} |
+ if (m_cachedOffsetsEnabled && renderer.isSVGRoot()) { |
+ const RenderSVGRoot& svgRoot = toRenderSVGRoot(renderer); |
+ m_svgTransform = adoptPtr(new AffineTransform(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) |
+{ |
+ ASSERT(renderer != m_paintInvalidationContainer); |
+ |
+ if (m_cachedOffsetsEnabled) |
+ m_svgTransform = adoptPtr(new AffineTransform(next.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 +123,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(); |
} |