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/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/layout/LayoutInline.h" | 9 #include "core/layout/LayoutInline.h" |
10 #include "core/layout/LayoutPart.h" | 10 #include "core/layout/LayoutPart.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 , m_forcedSubtreeInvalidationWithinContainer(false) | 32 , m_forcedSubtreeInvalidationWithinContainer(false) |
33 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false) | 33 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(false) |
34 , m_clipped(false) | 34 , m_clipped(false) |
35 , m_clippedForAbsolutePosition(false) | 35 , m_clippedForAbsolutePosition(false) |
36 , m_cachedOffsetsEnabled(true) | 36 , m_cachedOffsetsEnabled(true) |
37 , m_cachedOffsetsForAbsolutePositionEnabled(true) | 37 , m_cachedOffsetsForAbsolutePositionEnabled(true) |
38 , m_paintInvalidationContainer(&layoutView.containerForPaintInvalidation()) | 38 , m_paintInvalidationContainer(&layoutView.containerForPaintInvalidation()) |
39 , m_paintInvalidationContainerForStackedContents(m_paintInvalidationContaine
r) | 39 , m_paintInvalidationContainerForStackedContents(m_paintInvalidationContaine
r) |
40 , m_containerForAbsolutePosition(layoutView) | 40 , m_containerForAbsolutePosition(layoutView) |
41 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) | 41 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) |
42 , m_enclosingSelfPaintingLayer(*layoutView.layer()) | 42 , m_paintingLayer(*layoutView.layer()) |
43 #if ENABLE(ASSERT) | 43 #if ENABLE(ASSERT) |
44 , m_didUpdateForChildren(false) | 44 , m_didUpdateForChildren(false) |
45 #endif | 45 #endif |
46 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 46 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
47 , m_canCheckFastPathSlowPathEquality(layoutView == m_paintInvalidationContai
ner) | 47 , m_canCheckFastPathSlowPathEquality(layoutView == m_paintInvalidationContai
ner) |
48 #endif | 48 #endif |
49 { | 49 { |
50 if (!supportsCachedOffsets(layoutView)) { | 50 if (!supportsCachedOffsets(layoutView)) { |
51 m_cachedOffsetsEnabled = false; | 51 m_cachedOffsetsEnabled = false; |
52 return; | 52 return; |
(...skipping 14 matching lines...) Expand all Loading... |
67 , m_clipRectForAbsolutePosition(parentState.m_clipRectForAbsolutePosition) | 67 , m_clipRectForAbsolutePosition(parentState.m_clipRectForAbsolutePosition) |
68 , m_paintOffset(parentState.m_paintOffset) | 68 , m_paintOffset(parentState.m_paintOffset) |
69 , m_paintOffsetForAbsolutePosition(parentState.m_paintOffsetForAbsolutePosit
ion) | 69 , m_paintOffsetForAbsolutePosition(parentState.m_paintOffsetForAbsolutePosit
ion) |
70 , m_cachedOffsetsEnabled(parentState.m_cachedOffsetsEnabled) | 70 , m_cachedOffsetsEnabled(parentState.m_cachedOffsetsEnabled) |
71 , m_cachedOffsetsForAbsolutePositionEnabled(parentState.m_cachedOffsetsForAb
solutePositionEnabled) | 71 , m_cachedOffsetsForAbsolutePositionEnabled(parentState.m_cachedOffsetsForAb
solutePositionEnabled) |
72 , m_paintInvalidationContainer(parentState.m_paintInvalidationContainer) | 72 , m_paintInvalidationContainer(parentState.m_paintInvalidationContainer) |
73 , m_paintInvalidationContainerForStackedContents(parentState.m_paintInvalida
tionContainerForStackedContents) | 73 , m_paintInvalidationContainerForStackedContents(parentState.m_paintInvalida
tionContainerForStackedContents) |
74 , m_containerForAbsolutePosition(currentObject.canContainAbsolutePositionObj
ects() ? currentObject : parentState.m_containerForAbsolutePosition) | 74 , m_containerForAbsolutePosition(currentObject.canContainAbsolutePositionObj
ects() ? currentObject : parentState.m_containerForAbsolutePosition) |
75 , m_svgTransform(parentState.m_svgTransform) | 75 , m_svgTransform(parentState.m_svgTransform) |
76 , m_pendingDelayedPaintInvalidations(parentState.pendingDelayedPaintInvalida
tionTargets()) | 76 , m_pendingDelayedPaintInvalidations(parentState.pendingDelayedPaintInvalida
tionTargets()) |
77 , m_enclosingSelfPaintingLayer(parentState.enclosingSelfPaintingLayer(curren
tObject)) | 77 , m_paintingLayer(currentObject.hasLayer() && toLayoutBoxModelObject(current
Object).hasSelfPaintingLayer() ? *toLayoutBoxModelObject(currentObject).layer()
: parentState.m_paintingLayer) |
78 #if ENABLE(ASSERT) | 78 #if ENABLE(ASSERT) |
79 , m_didUpdateForChildren(false) | 79 , m_didUpdateForChildren(false) |
80 #endif | 80 #endif |
81 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 81 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
82 , m_canCheckFastPathSlowPathEquality(parentState.m_canCheckFastPathSlowPathE
quality) | 82 , m_canCheckFastPathSlowPathEquality(parentState.m_canCheckFastPathSlowPathE
quality) |
83 #endif | 83 #endif |
84 { | 84 { |
| 85 ASSERT(&m_paintingLayer == currentObject.paintingLayer()); |
| 86 |
85 if (currentObject == parentState.m_currentObject) { | 87 if (currentObject == parentState.m_currentObject) { |
86 // Sometimes we create a new PaintInvalidationState from parentState on
the same object | 88 // Sometimes we create a new PaintInvalidationState from parentState on
the same object |
87 // (e.g. LayoutView, and the HorriblySlowRectMapping cases in LayoutBloc
k::invalidatePaintOfSubtreesIfNeeded()). | 89 // (e.g. LayoutView, and the HorriblySlowRectMapping cases in LayoutBloc
k::invalidatePaintOfSubtreesIfNeeded()). |
88 // TODO(wangxianzhu): Avoid this for RuntimeEnabledFeatures::slimmingPai
ntInvalidationEnabled(). | 90 // TODO(wangxianzhu): Avoid this for RuntimeEnabledFeatures::slimmingPai
ntInvalidationEnabled(). |
89 #if ENABLE(ASSERT) | 91 #if ENABLE(ASSERT) |
90 m_didUpdateForChildren = parentState.m_didUpdateForChildren; | 92 m_didUpdateForChildren = parentState.m_didUpdateForChildren; |
91 #endif | 93 #endif |
92 return; | 94 return; |
93 } | 95 } |
94 | 96 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 LayoutRect clipRect = localClipRect; | 410 LayoutRect clipRect = localClipRect; |
409 clipRect.move(m_paintOffset); | 411 clipRect.move(m_paintOffset); |
410 if (m_clipped) { | 412 if (m_clipped) { |
411 m_clipRect.intersect(clipRect); | 413 m_clipRect.intersect(clipRect); |
412 } else { | 414 } else { |
413 m_clipRect = clipRect; | 415 m_clipRect = clipRect; |
414 m_clipped = true; | 416 m_clipped = true; |
415 } | 417 } |
416 } | 418 } |
417 | 419 |
418 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec
t& layoutObject) const | 420 PaintLayer& PaintInvalidationState::paintingLayer() const |
419 { | 421 { |
420 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP
aintingLayer()) | 422 ASSERT(&m_paintingLayer == m_currentObject.paintingLayer()); |
421 return *toLayoutBoxModelObject(layoutObject).layer(); | 423 return m_paintingLayer; |
422 | |
423 return m_enclosingSelfPaintingLayer; | |
424 } | 424 } |
425 | 425 |
426 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 426 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
427 | 427 |
428 static bool mayHaveBeenSaturated(LayoutUnit value) | 428 static bool mayHaveBeenSaturated(LayoutUnit value) |
429 { | 429 { |
430 // This is not accurate, just to avoid too big values. | 430 // This is not accurate, just to avoid too big values. |
431 return value.abs() >= LayoutUnit::max() / 2; | 431 return value.abs() >= LayoutUnit::max() / 2; |
432 } | 432 } |
433 | 433 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast
: %s vs slow: %s", | 469 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast
: %s vs slow: %s", |
470 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii().
data()); | 470 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii().
data()); |
471 showLayoutTree(&m_currentObject); | 471 showLayoutTree(&m_currentObject); |
472 | 472 |
473 ASSERT_NOT_REACHED(); | 473 ASSERT_NOT_REACHED(); |
474 } | 474 } |
475 | 475 |
476 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 476 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
477 | 477 |
478 } // namespace blink | 478 } // namespace blink |
OLD | NEW |