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 "core/layout/PaintInvalidationState.h" | 5 #include "core/layout/PaintInvalidationState.h" |
6 | 6 |
7 #include "core/layout/LayoutInline.h" | 7 #include "core/layout/LayoutInline.h" |
8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.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 12 matching lines...) Expand all Loading... |
23 { | 23 { |
24 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati
onContainer; | 24 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati
onContainer; |
25 if (!establishesPaintInvalidationContainer) { | 25 if (!establishesPaintInvalidationContainer) { |
26 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach
edOffsetsEnabled) | 26 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach
edOffsetsEnabled) |
27 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { | 27 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { |
28 m_cachedOffsetsEnabled = false; | 28 m_cachedOffsetsEnabled = false; |
29 return; | 29 return; |
30 } | 30 } |
31 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced
SubtreeInvalidationWithinContainer) | 31 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced
SubtreeInvalidationWithinContainer) |
32 m_forcedSubtreeInvalidationWithinContainer = true; | 32 m_forcedSubtreeInvalidationWithinContainer = true; |
33 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai
ntInvalidationContainer, TraverseDocumentBoundaries); | 33 FloatPoint point = layoutView.localToAncestorPoint(FloatPoint(), &m_pain
tInvalidationContainer, TraverseDocumentBoundaries); |
34 m_paintOffset = LayoutSize(point.x(), point.y()); | 34 m_paintOffset = LayoutSize(point.x(), point.y()); |
35 } | 35 } |
36 m_clipRect = layoutView.viewRect(); | 36 m_clipRect = layoutView.viewRect(); |
37 m_clipRect.move(m_paintOffset); | 37 m_clipRect.move(m_paintOffset); |
38 m_clipped = true; | 38 m_clipped = true; |
39 } | 39 } |
40 | 40 |
41 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay
outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo
ntainer) | 41 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay
outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo
ntainer) |
42 : m_clipped(false) | 42 : m_clipped(false) |
43 , m_cachedOffsetsEnabled(true) | 43 , m_cachedOffsetsEnabled(true) |
(...skipping 11 matching lines...) Expand all Loading... |
55 m_cachedOffsetsEnabled = false; | 55 m_cachedOffsetsEnabled = false; |
56 if (establishesPaintInvalidationContainer) { | 56 if (establishesPaintInvalidationContainer) { |
57 // When we hit a new paint invalidation container, we don't need to | 57 // When we hit a new paint invalidation container, we don't need to |
58 // continue forcing a check for paint invalidation, since we're | 58 // continue forcing a check for paint invalidation, since we're |
59 // descending into a different invalidation container. (For instance if | 59 // descending into a different invalidation container. (For instance if |
60 // our parents were moved, the entire container will just move.) | 60 // our parents were moved, the entire container will just move.) |
61 m_forcedSubtreeInvalidationWithinContainer = false; | 61 m_forcedSubtreeInvalidationWithinContainer = false; |
62 } else { | 62 } else { |
63 if (m_cachedOffsetsEnabled) { | 63 if (m_cachedOffsetsEnabled) { |
64 if (fixed) { | 64 if (fixed) { |
65 FloatPoint fixedOffset = layoutObject.localToContainerPoint(Floa
tPoint(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); | 65 FloatPoint fixedOffset = layoutObject.localToAncestorPoint(Float
Point(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); |
66 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); | 66 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); |
67 } else { | 67 } else { |
68 LayoutSize offset = layoutObject.isBox() && !layoutObject.isTabl
eRow() ? toLayoutBox(layoutObject).locationOffset() : LayoutSize(); | 68 LayoutSize offset = layoutObject.isBox() && !layoutObject.isTabl
eRow() ? toLayoutBox(layoutObject).locationOffset() : LayoutSize(); |
69 m_paintOffset = next.m_paintOffset + offset; | 69 m_paintOffset = next.m_paintOffset + offset; |
70 } | 70 } |
71 | 71 |
72 if (layoutObject.isOutOfFlowPositioned() && !fixed) { | 72 if (layoutObject.isOutOfFlowPositioned() && !fixed) { |
73 if (LayoutObject* container = layoutObject.container()) { | 73 if (LayoutObject* container = layoutObject.container()) { |
74 if (container->style()->hasInFlowPosition() && container->is
LayoutInline()) | 74 if (container->style()->hasInFlowPosition() && container->is
LayoutInline()) |
75 m_paintOffset += toLayoutInline(container)->offsetForInF
lowPositionedInline(toLayoutBox(layoutObject)); | 75 m_paintOffset += toLayoutInline(container)->offsetForInF
lowPositionedInline(toLayoutBox(layoutObject)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // to be always invalidated in-time. | 136 // to be always invalidated in-time. |
137 if (box.usesCompositedScrolling()) | 137 if (box.usesCompositedScrolling()) |
138 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. | 138 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. |
139 else | 139 else |
140 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); | 140 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); |
141 | 141 |
142 m_paintOffset -= box.scrolledContentOffset(); | 142 m_paintOffset -= box.scrolledContentOffset(); |
143 } | 143 } |
144 | 144 |
145 } // namespace blink | 145 } // namespace blink |
OLD | NEW |