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/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
11 #include "core/layout/LayoutPart.h" | 11 #include "core/layout/LayoutPart.h" |
12 #include "core/layout/LayoutView.h" | 12 #include "core/layout/LayoutView.h" |
13 #include "core/layout/svg/LayoutSVGRoot.h" | 13 #include "core/layout/svg/LayoutSVGRoot.h" |
14 #include "core/layout/svg/SVGLayoutSupport.h" | 14 #include "core/layout/svg/SVGLayoutSupport.h" |
15 #include "core/paint/PaintLayer.h" | 15 #include "core/paint/PaintLayer.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 static bool supportsCachedOffsets(const LayoutObject& object) | 19 static bool supportsCachedOffsets(const LayoutObject& object) |
20 { | 20 { |
21 return !object.hasTransformRelatedProperty() | 21 return !object.hasTransformRelatedProperty() |
22 && !object.hasReflection() | 22 && !object.hasReflection() |
23 && !object.hasFilterInducingProperty() | 23 && !object.hasFilterInducingProperty() |
24 && !object.isLayoutFlowThread() | 24 && !object.isLayoutFlowThread() |
25 && !object.isLayoutMultiColumnSpannerPlaceholder() | 25 && !object.isLayoutMultiColumnSpannerPlaceholder() |
26 && !object.styleRef().isFlippedBlocksWritingMode() | 26 && !object.styleRef().isFlippedBlocksWritingMode() |
27 && !(object.isLayoutBlock() && object.isSVG()); | 27 && !(object.isLayoutBlock() && object.isSVG()); |
28 } | 28 } |
29 | 29 |
30 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec
tor<LayoutObject*>& pendingDelayedPaintInvalidations) | 30 PaintInvalidationState::PaintInvalidationState(const LayoutView& layoutView, Vec
tor<const LayoutObject*>& pendingDelayedPaintInvalidations) |
31 : m_currentObject(layoutView) | 31 : m_currentObject(layoutView) |
32 , m_forcedSubtreeInvalidationFlags(0) | 32 , m_forcedSubtreeInvalidationFlags(0) |
33 , m_clipped(false) | 33 , m_clipped(false) |
34 , m_clippedForAbsolutePosition(false) | 34 , m_clippedForAbsolutePosition(false) |
35 , m_cachedOffsetsEnabled(true) | 35 , m_cachedOffsetsEnabled(true) |
36 , m_cachedOffsetsForAbsolutePositionEnabled(true) | 36 , m_cachedOffsetsForAbsolutePositionEnabled(true) |
37 , m_paintInvalidationContainer(&layoutView.containerForPaintInvalidation()) | 37 , m_paintInvalidationContainer(&layoutView.containerForPaintInvalidation()) |
38 , m_paintInvalidationContainerForStackedContents(m_paintInvalidationContaine
r) | 38 , m_paintInvalidationContainerForStackedContents(m_paintInvalidationContaine
r) |
39 , m_containerForAbsolutePosition(layoutView) | 39 , m_containerForAbsolutePosition(layoutView) |
40 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) | 40 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) |
(...skipping 23 matching lines...) Expand all Loading... |
64 , m_clipRect(parentState.m_clipRect) | 64 , m_clipRect(parentState.m_clipRect) |
65 , m_clipRectForAbsolutePosition(parentState.m_clipRectForAbsolutePosition) | 65 , m_clipRectForAbsolutePosition(parentState.m_clipRectForAbsolutePosition) |
66 , m_paintOffset(parentState.m_paintOffset) | 66 , m_paintOffset(parentState.m_paintOffset) |
67 , m_paintOffsetForAbsolutePosition(parentState.m_paintOffsetForAbsolutePosit
ion) | 67 , m_paintOffsetForAbsolutePosition(parentState.m_paintOffsetForAbsolutePosit
ion) |
68 , m_cachedOffsetsEnabled(parentState.m_cachedOffsetsEnabled) | 68 , m_cachedOffsetsEnabled(parentState.m_cachedOffsetsEnabled) |
69 , m_cachedOffsetsForAbsolutePositionEnabled(parentState.m_cachedOffsetsForAb
solutePositionEnabled) | 69 , m_cachedOffsetsForAbsolutePositionEnabled(parentState.m_cachedOffsetsForAb
solutePositionEnabled) |
70 , m_paintInvalidationContainer(parentState.m_paintInvalidationContainer) | 70 , m_paintInvalidationContainer(parentState.m_paintInvalidationContainer) |
71 , m_paintInvalidationContainerForStackedContents(parentState.m_paintInvalida
tionContainerForStackedContents) | 71 , m_paintInvalidationContainerForStackedContents(parentState.m_paintInvalida
tionContainerForStackedContents) |
72 , m_containerForAbsolutePosition(currentObject.canContainAbsolutePositionObj
ects() ? currentObject : parentState.m_containerForAbsolutePosition) | 72 , m_containerForAbsolutePosition(currentObject.canContainAbsolutePositionObj
ects() ? currentObject : parentState.m_containerForAbsolutePosition) |
73 , m_svgTransform(parentState.m_svgTransform) | 73 , m_svgTransform(parentState.m_svgTransform) |
74 , m_pendingDelayedPaintInvalidations(parentState.pendingDelayedPaintInvalida
tionTargets()) | 74 , m_pendingDelayedPaintInvalidations(parentState.m_pendingDelayedPaintInvali
dations) |
75 , m_paintingLayer(currentObject.hasLayer() && toLayoutBoxModelObject(current
Object).hasSelfPaintingLayer() ? *toLayoutBoxModelObject(currentObject).layer()
: parentState.m_paintingLayer) | 75 , m_paintingLayer(currentObject.hasLayer() && toLayoutBoxModelObject(current
Object).hasSelfPaintingLayer() ? *toLayoutBoxModelObject(currentObject).layer()
: parentState.m_paintingLayer) |
76 #if ENABLE(ASSERT) | 76 #if ENABLE(ASSERT) |
77 , m_didUpdateForChildren(false) | 77 , m_didUpdateForChildren(false) |
78 #endif | 78 #endif |
79 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 79 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
80 , m_canCheckFastPathSlowPathEquality(parentState.m_canCheckFastPathSlowPathE
quality) | 80 , m_canCheckFastPathSlowPathEquality(parentState.m_canCheckFastPathSlowPathE
quality) |
81 #endif | 81 #endif |
82 { | 82 { |
83 ASSERT(&m_paintingLayer == currentObject.paintingLayer()); | 83 ASSERT(&m_paintingLayer == currentObject.paintingLayer()); |
84 | 84 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 void PaintInvalidationState::updateForChildren(PaintInvalidationReason reason) | 238 void PaintInvalidationState::updateForChildren(PaintInvalidationReason reason) |
239 { | 239 { |
240 #if ENABLE(ASSERT) | 240 #if ENABLE(ASSERT) |
241 ASSERT(!m_didUpdateForChildren); | 241 ASSERT(!m_didUpdateForChildren); |
242 m_didUpdateForChildren = true; | 242 m_didUpdateForChildren = true; |
243 #endif | 243 #endif |
244 | 244 |
245 switch (reason) { | 245 switch (reason) { |
246 case PaintInvalidationDelayedFull: | 246 case PaintInvalidationDelayedFull: |
247 pushDelayedPaintInvalidationTarget(const_cast<LayoutObject&>(m_currentOb
ject)); | 247 m_pendingDelayedPaintInvalidations.append(&m_currentObject); |
248 break; | 248 break; |
249 case PaintInvalidationSubtree: | 249 case PaintInvalidationSubtree: |
250 m_forcedSubtreeInvalidationFlags |= (FullInvalidation | FullInvalidation
ForStackedContents); | 250 m_forcedSubtreeInvalidationFlags |= (FullInvalidation | FullInvalidation
ForStackedContents); |
251 break; | 251 break; |
252 case PaintInvalidationSVGResourceChange: | 252 case PaintInvalidationSVGResourceChange: |
253 setForceSubtreeInvalidationCheckingWithinContainer(); | 253 setForceSubtreeInvalidationCheckingWithinContainer(); |
254 break; | 254 break; |
255 default: | 255 default: |
256 break; | 256 break; |
257 } | 257 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast
: %s vs slow: %s", | 487 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast
: %s vs slow: %s", |
488 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii().
data()); | 488 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii().
data()); |
489 showLayoutTree(&m_currentObject); | 489 showLayoutTree(&m_currentObject); |
490 | 490 |
491 ASSERT_NOT_REACHED(); | 491 ASSERT_NOT_REACHED(); |
492 } | 492 } |
493 | 493 |
494 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 494 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
495 | 495 |
496 } // namespace blink | 496 } // namespace blink |
OLD | NEW |