| 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/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "core/layout/svg/LayoutSVGModelObject.h" | 10 #include "core/layout/svg/LayoutSVGModelObject.h" |
| 11 #include "core/layout/svg/LayoutSVGRoot.h" | 11 #include "core/layout/svg/LayoutSVGRoot.h" |
| 12 #include "core/paint/PaintLayer.h" | 12 #include "core/paint/PaintLayer.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec
tor<LayoutObject*>& pendingDelayedPaintInvalidations, PaintInvalidationState* ow
nerPaintInvalidationState) | 16 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec
tor<LayoutObject*>& pendingDelayedPaintInvalidations, PaintInvalidationState* ow
nerPaintInvalidationState) |
| 17 : m_clipped(false) | 17 : m_clipped(false) |
| 18 , m_cachedOffsetsEnabled(true) | 18 , m_cachedOffsetsEnabled(true) |
| 19 , m_forcedSubtreeInvalidationWithinContainer(false) | 19 , m_forcedSubtreeInvalidationWithinContainer(false) |
| 20 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false) | 20 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false) |
| 21 , m_viewClippingAndScrollOffsetDisabled(false) | |
| 22 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation()) | 21 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation()) |
| 23 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) | 22 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) |
| 24 { | 23 { |
| 25 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati
onContainer; | 24 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati
onContainer; |
| 26 if (!establishesPaintInvalidationContainer) { | 25 if (!establishesPaintInvalidationContainer) { |
| 27 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach
edOffsetsEnabled) | 26 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach
edOffsetsEnabled) |
| 28 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { | 27 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { |
| 29 m_cachedOffsetsEnabled = false; | 28 m_cachedOffsetsEnabled = false; |
| 30 return; | 29 return; |
| 31 } | 30 } |
| 32 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced
SubtreeInvalidationWithinContainer) | 31 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced
SubtreeInvalidationWithinContainer) |
| 33 m_forcedSubtreeInvalidationWithinContainer = true; | 32 m_forcedSubtreeInvalidationWithinContainer = true; |
| 34 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai
ntInvalidationContainer, TraverseDocumentBoundaries); | 33 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai
ntInvalidationContainer, TraverseDocumentBoundaries); |
| 35 m_paintOffset = LayoutSize(point.x(), point.y()); | 34 m_paintOffset = LayoutSize(point.x(), point.y()); |
| 36 } | 35 } |
| 37 m_clipRect = layoutView.viewRect(); | 36 m_clipRect = layoutView.viewRect(); |
| 38 m_clipRect.move(m_paintOffset); | 37 m_clipRect.move(m_paintOffset); |
| 39 m_clipped = true; | 38 m_clipped = true; |
| 40 } | 39 } |
| 41 | 40 |
| 42 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay
outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo
ntainer) | 41 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay
outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo
ntainer) |
| 43 : m_clipped(false) | 42 : m_clipped(false) |
| 44 , m_cachedOffsetsEnabled(true) | 43 , m_cachedOffsetsEnabled(true) |
| 45 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio
nWithinContainer) | 44 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio
nWithinContainer) |
| 46 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI
nvalidationRectUpdateWithinContainer) | 45 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI
nvalidationRectUpdateWithinContainer) |
| 47 , m_viewClippingAndScrollOffsetDisabled(false) | |
| 48 , m_paintInvalidationContainer(paintInvalidationContainer) | 46 , m_paintInvalidationContainer(paintInvalidationContainer) |
| 49 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar
gets()) | 47 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar
gets()) |
| 50 { | 48 { |
| 51 // FIXME: SVG could probably benefit from a stack-based optimization like ht
ml does. crbug.com/391054 | 49 // FIXME: SVG could probably benefit from a stack-based optimization like ht
ml does. crbug.com/391054 |
| 52 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida
tionContainer; | 50 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida
tionContainer; |
| 53 bool fixed = layoutObject.style()->position() == FixedPosition; | 51 bool fixed = layoutObject.style()->position() == FixedPosition; |
| 54 | 52 |
| 55 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c
achedOffsetsEnabled) | 53 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c
achedOffsetsEnabled) |
| 56 m_cachedOffsetsEnabled = false; | 54 m_cachedOffsetsEnabled = false; |
| 57 if (establishesPaintInvalidationContainer) { | 55 if (establishesPaintInvalidationContainer) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 applyClipIfNeeded(layoutObject); | 94 applyClipIfNeeded(layoutObject); |
| 97 | 95 |
| 98 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip
if present. | 96 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip
if present. |
| 99 } | 97 } |
| 100 | 98 |
| 101 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con
st LayoutSVGModelObject& layoutObject) | 99 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con
st LayoutSVGModelObject& layoutObject) |
| 102 : m_clipped(next.m_clipped) | 100 : m_clipped(next.m_clipped) |
| 103 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) | 101 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) |
| 104 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio
nWithinContainer) | 102 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio
nWithinContainer) |
| 105 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI
nvalidationRectUpdateWithinContainer) | 103 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI
nvalidationRectUpdateWithinContainer) |
| 106 , m_viewClippingAndScrollOffsetDisabled(false) | |
| 107 , m_clipRect(next.m_clipRect) | 104 , m_clipRect(next.m_clipRect) |
| 108 , m_paintOffset(next.m_paintOffset) | 105 , m_paintOffset(next.m_paintOffset) |
| 109 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) | 106 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) |
| 110 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar
gets()) | 107 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar
gets()) |
| 111 { | 108 { |
| 112 ASSERT(layoutObject != m_paintInvalidationContainer); | 109 ASSERT(layoutObject != m_paintInvalidationContainer); |
| 113 | 110 |
| 114 if (m_cachedOffsetsEnabled) | 111 if (m_cachedOffsetsEnabled) |
| 115 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo
utObject.localToParentTransform())); | 112 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo
utObject.localToParentTransform())); |
| 116 } | 113 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 137 // to be always invalidated in-time. | 134 // to be always invalidated in-time. |
| 138 if (box.usesCompositedScrolling()) | 135 if (box.usesCompositedScrolling()) |
| 139 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. | 136 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. |
| 140 else | 137 else |
| 141 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); | 138 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); |
| 142 | 139 |
| 143 m_paintOffset -= box.scrolledContentOffset(); | 140 m_paintOffset -= box.scrolledContentOffset(); |
| 144 } | 141 } |
| 145 | 142 |
| 146 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |