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/rendering/PaintInvalidationState.h" | 6 #include "core/rendering/PaintInvalidationState.h" |
7 | 7 |
8 #include "core/layout/Layer.h" | 8 #include "core/layout/Layer.h" |
9 #include "core/rendering/RenderInline.h" | 9 #include "core/rendering/RenderInline.h" |
10 #include "core/rendering/RenderView.h" | 10 #include "core/rendering/RenderView.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() ?
toRenderBox(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 (RenderObject* 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(toRenderBox(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; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 { | 107 { |
108 LayoutRect clipRect(toPoint(m_paintOffset), clipSize); | 108 LayoutRect clipRect(toPoint(m_paintOffset), clipSize); |
109 if (m_clipped) { | 109 if (m_clipped) { |
110 m_clipRect.intersect(clipRect); | 110 m_clipRect.intersect(clipRect); |
111 } else { | 111 } else { |
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 RenderObject& 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 RenderBox& box = toRenderBox(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 |