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" | 9 #include "core/layout/svg/LayoutSVGModelObject.h" |
10 #include "core/layout/svg/LayoutSVGRoot.h" | 10 #include "core/layout/svg/LayoutSVGRoot.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // When we hit a new paint invalidation container, we don't need to | 50 // When we hit a new paint invalidation container, we don't need to |
51 // continue forcing a check for paint invalidation because movement | 51 // continue forcing a check for paint invalidation because movement |
52 // from our parents will just move the whole invalidation container. | 52 // from our parents will just move the whole invalidation container. |
53 m_forceCheckForPaintInvalidation = false; | 53 m_forceCheckForPaintInvalidation = false; |
54 } else { | 54 } else { |
55 if (m_cachedOffsetsEnabled) { | 55 if (m_cachedOffsetsEnabled) { |
56 if (fixed) { | 56 if (fixed) { |
57 FloatPoint fixedOffset = renderer.localToContainerPoint(FloatPoi
nt(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); | 57 FloatPoint fixedOffset = renderer.localToContainerPoint(FloatPoi
nt(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); |
58 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); | 58 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); |
59 } else { | 59 } else { |
60 LayoutSize offset = renderer.isBox() && !renderer.isTableRow() ?
toRenderBox(renderer).locationOffset() : LayoutSize(); | 60 LayoutSize offset = renderer.isBox() && !renderer.isTableRow() ?
toLayoutBox(renderer).locationOffset() : LayoutSize(); |
61 m_paintOffset = next.m_paintOffset + offset; | 61 m_paintOffset = next.m_paintOffset + offset; |
62 } | 62 } |
63 | 63 |
64 if (renderer.isOutOfFlowPositioned() && !fixed) { | 64 if (renderer.isOutOfFlowPositioned() && !fixed) { |
65 if (LayoutObject* container = renderer.container()) { | 65 if (LayoutObject* container = renderer.container()) { |
66 if (container->style()->hasInFlowPosition() && container->is
RenderInline()) | 66 if (container->style()->hasInFlowPosition() && container->is
RenderInline()) |
67 m_paintOffset += toRenderInline(container)->offsetForInF
lowPositionedInline(toRenderBox(renderer)); | 67 m_paintOffset += toRenderInline(container)->offsetForInF
lowPositionedInline(toLayoutBox(renderer)); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
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; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 m_clipRect = clipRect; | 112 m_clipRect = clipRect; |
113 m_clipped = true; | 113 m_clipped = true; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void PaintInvalidationState::applyClipIfNeeded(const LayoutObject& renderer) | 117 void PaintInvalidationState::applyClipIfNeeded(const LayoutObject& renderer) |
118 { | 118 { |
119 if (!renderer.hasOverflowClip()) | 119 if (!renderer.hasOverflowClip()) |
120 return; | 120 return; |
121 | 121 |
122 const RenderBox& box = toRenderBox(renderer); | 122 const LayoutBox& box = toLayoutBox(renderer); |
123 | 123 |
124 // Do not clip scroll layer contents because the compositor expects the whol
e layer | 124 // Do not clip scroll layer contents because the compositor expects the whol
e layer |
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 |