OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/layout/PaintInvalidationState.h" | 6 #include "core/layout/PaintInvalidationState.h" |
7 | 7 |
8 #include "core/layout/Layer.h" | 8 #include "core/layout/Layer.h" |
| 9 #include "core/layout/svg/LayoutSVGModelObject.h" |
| 10 #include "core/layout/svg/LayoutSVGRoot.h" |
9 #include "core/rendering/RenderInline.h" | 11 #include "core/rendering/RenderInline.h" |
10 #include "core/rendering/RenderView.h" | 12 #include "core/rendering/RenderView.h" |
11 #include "core/rendering/svg/RenderSVGModelObject.h" | |
12 #include "core/rendering/svg/RenderSVGRoot.h" | |
13 #include "platform/Partitions.h" | 13 #include "platform/Partitions.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 PaintInvalidationState::PaintInvalidationState(const RenderView& renderView) | 17 PaintInvalidationState::PaintInvalidationState(const RenderView& renderView) |
18 : m_clipped(false) | 18 : m_clipped(false) |
19 , m_cachedOffsetsEnabled(true) | 19 , m_cachedOffsetsEnabled(true) |
20 , m_forceCheckForPaintInvalidation(false) | 20 , m_forceCheckForPaintInvalidation(false) |
21 , m_paintInvalidationContainer(*renderView.containerForPaintInvalidation()) | 21 , m_paintInvalidationContainer(*renderView.containerForPaintInvalidation()) |
22 { | 22 { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (renderer.style()->hasInFlowPosition() && renderer.hasLayer()) | 71 if (renderer.style()->hasInFlowPosition() && renderer.hasLayer()) |
72 m_paintOffset += renderer.layer()->offsetForInFlowPosition(); | 72 m_paintOffset += renderer.layer()->offsetForInFlowPosition(); |
73 } | 73 } |
74 | 74 |
75 m_clipped = !fixed && next.m_clipped; | 75 m_clipped = !fixed && next.m_clipped; |
76 if (m_clipped) | 76 if (m_clipped) |
77 m_clipRect = next.m_clipRect; | 77 m_clipRect = next.m_clipRect; |
78 } | 78 } |
79 | 79 |
80 if (m_cachedOffsetsEnabled && renderer.isSVGRoot()) { | 80 if (m_cachedOffsetsEnabled && renderer.isSVGRoot()) { |
81 const RenderSVGRoot& svgRoot = toRenderSVGRoot(renderer); | 81 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(renderer); |
82 m_svgTransform = adoptPtr(new AffineTransform(svgRoot.localToBorderBoxTr
ansform())); | 82 m_svgTransform = adoptPtr(new AffineTransform(svgRoot.localToBorderBoxTr
ansform())); |
83 if (svgRoot.shouldApplyViewportClip()) | 83 if (svgRoot.shouldApplyViewportClip()) |
84 addClipRectRelativeToPaintOffset(LayoutSize(svgRoot.pixelSnappedSize
())); | 84 addClipRectRelativeToPaintOffset(LayoutSize(svgRoot.pixelSnappedSize
())); |
85 } | 85 } |
86 | 86 |
87 applyClipIfNeeded(renderer); | 87 applyClipIfNeeded(renderer); |
88 | 88 |
89 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip
if present. | 89 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip
if present. |
90 } | 90 } |
91 | 91 |
92 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex
t, const RenderSVGModelObject& renderer) | 92 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex
t, const LayoutSVGModelObject& renderer) |
93 : m_clipped(next.m_clipped) | 93 : m_clipped(next.m_clipped) |
94 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) | 94 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) |
95 , m_forceCheckForPaintInvalidation(next.m_forceCheckForPaintInvalidation) | 95 , m_forceCheckForPaintInvalidation(next.m_forceCheckForPaintInvalidation) |
96 , m_clipRect(next.m_clipRect) | 96 , m_clipRect(next.m_clipRect) |
97 , m_paintOffset(next.m_paintOffset) | 97 , m_paintOffset(next.m_paintOffset) |
98 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) | 98 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) |
99 { | 99 { |
100 ASSERT(renderer != m_paintInvalidationContainer); | 100 ASSERT(renderer != m_paintInvalidationContainer); |
101 | 101 |
102 if (m_cachedOffsetsEnabled) | 102 if (m_cachedOffsetsEnabled) |
(...skipping 22 matching lines...) Expand all Loading... |
125 // to be always invalidated in-time. | 125 // to be always invalidated in-time. |
126 if (box.usesCompositedScrolling()) | 126 if (box.usesCompositedScrolling()) |
127 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. | 127 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. |
128 else | 128 else |
129 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); | 129 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); |
130 | 130 |
131 m_paintOffset -= box.scrolledContentOffset(); | 131 m_paintOffset -= box.scrolledContentOffset(); |
132 } | 132 } |
133 | 133 |
134 } // namespace blink | 134 } // namespace blink |
OLD | NEW |