Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 1406133005: Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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)
21 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation()) 22 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation())
22 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) 23 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations)
23 { 24 {
24 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer; 25 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer;
25 if (!establishesPaintInvalidationContainer) { 26 if (!establishesPaintInvalidationContainer) {
26 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled) 27 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled)
27 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { 28 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) {
28 m_cachedOffsetsEnabled = false; 29 m_cachedOffsetsEnabled = false;
29 return; 30 return;
30 } 31 }
31 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer) 32 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer)
32 m_forcedSubtreeInvalidationWithinContainer = true; 33 m_forcedSubtreeInvalidationWithinContainer = true;
33 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai ntInvalidationContainer, TraverseDocumentBoundaries); 34 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai ntInvalidationContainer, TraverseDocumentBoundaries);
34 m_paintOffset = LayoutSize(point.x(), point.y()); 35 m_paintOffset = LayoutSize(point.x(), point.y());
35 } 36 }
36 m_clipRect = layoutView.viewRect(); 37 m_clipRect = layoutView.viewRect();
37 m_clipRect.move(m_paintOffset); 38 m_clipRect.move(m_paintOffset);
38 m_clipped = true; 39 m_clipped = true;
39 } 40 }
40 41
41 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer) 42 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer)
42 : m_clipped(false) 43 : m_clipped(false)
43 , m_cachedOffsetsEnabled(true) 44 , m_cachedOffsetsEnabled(true)
44 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer) 45 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
45 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer) 46 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer)
47 , m_viewClippingAndScrollOffsetDisabled(false)
46 , m_paintInvalidationContainer(paintInvalidationContainer) 48 , m_paintInvalidationContainer(paintInvalidationContainer)
47 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 49 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
48 { 50 {
49 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054 51 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054
50 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer; 52 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer;
51 bool fixed = layoutObject.style()->position() == FixedPosition; 53 bool fixed = layoutObject.style()->position() == FixedPosition;
52 54
53 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled) 55 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled)
54 m_cachedOffsetsEnabled = false; 56 m_cachedOffsetsEnabled = false;
55 if (establishesPaintInvalidationContainer) { 57 if (establishesPaintInvalidationContainer) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 applyClipIfNeeded(layoutObject); 96 applyClipIfNeeded(layoutObject);
95 97
96 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 98 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
97 } 99 }
98 100
99 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject) 101 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject)
100 : m_clipped(next.m_clipped) 102 : m_clipped(next.m_clipped)
101 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) 103 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled)
102 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer) 104 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
103 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer) 105 , m_forcedSubtreeInvalidationRectUpdateWithinContainer(next.m_forcedSubtreeI nvalidationRectUpdateWithinContainer)
106 , m_viewClippingAndScrollOffsetDisabled(false)
104 , m_clipRect(next.m_clipRect) 107 , m_clipRect(next.m_clipRect)
105 , m_paintOffset(next.m_paintOffset) 108 , m_paintOffset(next.m_paintOffset)
106 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) 109 , m_paintInvalidationContainer(next.m_paintInvalidationContainer)
107 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 110 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
108 { 111 {
109 ASSERT(layoutObject != m_paintInvalidationContainer); 112 ASSERT(layoutObject != m_paintInvalidationContainer);
110 113
111 if (m_cachedOffsetsEnabled) 114 if (m_cachedOffsetsEnabled)
112 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo utObject.localToParentTransform())); 115 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo utObject.localToParentTransform()));
113 } 116 }
(...skipping 20 matching lines...) Expand all
134 // to be always invalidated in-time. 137 // to be always invalidated in-time.
135 if (box.usesCompositedScrolling()) 138 if (box.usesCompositedScrolling())
136 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited. 139 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited.
137 else 140 else
138 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); 141 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size()));
139 142
140 m_paintOffset -= box.scrolledContentOffset(); 143 m_paintOffset -= box.scrolledContentOffset();
141 } 144 }
142 145
143 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698