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

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

Issue 1331053002: Propagate resource-triggered repaints to text node children of <text> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Name/comment updates. Created 5 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/PaintInvalidationState.h ('k') | Source/core/layout/svg/LayoutSVGInline.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/DeprecatedPaintLayer.h" 12 #include "core/paint/DeprecatedPaintLayer.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_ancestorHadPaintInvalidationForLocationChange(false) 19 , m_forcedSubtreeInvalidationWithinContainer(false)
20 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation()) 20 , m_paintInvalidationContainer(*layoutView.containerForPaintInvalidation())
21 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations) 21 , m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations)
22 { 22 {
23 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer; 23 bool establishesPaintInvalidationContainer = layoutView == m_paintInvalidati onContainer;
24 if (!establishesPaintInvalidationContainer) { 24 if (!establishesPaintInvalidationContainer) {
25 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled) 25 if ((ownerPaintInvalidationState && !ownerPaintInvalidationState->m_cach edOffsetsEnabled)
26 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) { 26 || !layoutView.supportsPaintInvalidationStateCachedOffsets()) {
27 m_cachedOffsetsEnabled = false; 27 m_cachedOffsetsEnabled = false;
28 return; 28 return;
29 } 29 }
30 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_ancest orHadPaintInvalidationForLocationChange) 30 if (ownerPaintInvalidationState && ownerPaintInvalidationState->m_forced SubtreeInvalidationWithinContainer)
31 m_ancestorHadPaintInvalidationForLocationChange = true; 31 m_forcedSubtreeInvalidationWithinContainer = true;
32 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai ntInvalidationContainer, TraverseDocumentBoundaries); 32 FloatPoint point = layoutView.localToContainerPoint(FloatPoint(), &m_pai ntInvalidationContainer, TraverseDocumentBoundaries);
33 m_paintOffset = LayoutSize(point.x(), point.y()); 33 m_paintOffset = LayoutSize(point.x(), point.y());
34 } 34 }
35 m_clipRect = layoutView.viewRect(); 35 m_clipRect = layoutView.viewRect();
36 m_clipRect.move(m_paintOffset); 36 m_clipRect.move(m_paintOffset);
37 m_clipped = true; 37 m_clipped = true;
38 } 38 }
39 39
40 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer) 40 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, Lay outBoxModelObject& layoutObject, const LayoutBoxModelObject& paintInvalidationCo ntainer)
41 : m_clipped(false) 41 : m_clipped(false)
42 , m_cachedOffsetsEnabled(true) 42 , m_cachedOffsetsEnabled(true)
43 , m_ancestorHadPaintInvalidationForLocationChange(next.m_ancestorHadPaintInv alidationForLocationChange) 43 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
44 , m_paintInvalidationContainer(paintInvalidationContainer) 44 , m_paintInvalidationContainer(paintInvalidationContainer)
45 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 45 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
46 { 46 {
47 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054 47 // FIXME: SVG could probably benefit from a stack-based optimization like ht ml does. crbug.com/391054
48 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer; 48 bool establishesPaintInvalidationContainer = layoutObject == m_paintInvalida tionContainer;
49 bool fixed = layoutObject.style()->position() == FixedPosition; 49 bool fixed = layoutObject.style()->position() == FixedPosition;
50 50
51 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled) 51 if (!layoutObject.supportsPaintInvalidationStateCachedOffsets() || !next.m_c achedOffsetsEnabled)
52 m_cachedOffsetsEnabled = false; 52 m_cachedOffsetsEnabled = false;
53 if (establishesPaintInvalidationContainer) { 53 if (establishesPaintInvalidationContainer) {
54 // When we hit a new paint invalidation container, we don't need to 54 // When we hit a new paint invalidation container, we don't need to
55 // continue forcing a check for paint invalidation because movement 55 // continue forcing a check for paint invalidation, since we're
56 // from our parents will just move the whole invalidation container. 56 // descending into a different invalidation container. (For instance if
57 m_ancestorHadPaintInvalidationForLocationChange = false; 57 // our parents were moved, the entire container will just move.)
58 m_forcedSubtreeInvalidationWithinContainer = false;
58 } else { 59 } else {
59 if (m_cachedOffsetsEnabled) { 60 if (m_cachedOffsetsEnabled) {
60 if (fixed) { 61 if (fixed) {
61 FloatPoint fixedOffset = layoutObject.localToContainerPoint(Floa tPoint(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); 62 FloatPoint fixedOffset = layoutObject.localToContainerPoint(Floa tPoint(), &m_paintInvalidationContainer, TraverseDocumentBoundaries);
62 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); 63 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y());
63 } else { 64 } else {
64 LayoutSize offset = layoutObject.isBox() && !layoutObject.isTabl eRow() ? toLayoutBox(layoutObject).locationOffset() : LayoutSize(); 65 LayoutSize offset = layoutObject.isBox() && !layoutObject.isTabl eRow() ? toLayoutBox(layoutObject).locationOffset() : LayoutSize();
65 m_paintOffset = next.m_paintOffset + offset; 66 m_paintOffset = next.m_paintOffset + offset;
66 } 67 }
67 68
(...skipping 21 matching lines...) Expand all
89 } 90 }
90 91
91 applyClipIfNeeded(layoutObject); 92 applyClipIfNeeded(layoutObject);
92 93
93 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 94 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
94 } 95 }
95 96
96 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject) 97 PaintInvalidationState::PaintInvalidationState(PaintInvalidationState& next, con st LayoutSVGModelObject& layoutObject)
97 : m_clipped(next.m_clipped) 98 : m_clipped(next.m_clipped)
98 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled) 99 , m_cachedOffsetsEnabled(next.m_cachedOffsetsEnabled)
99 , m_ancestorHadPaintInvalidationForLocationChange(next.m_ancestorHadPaintInv alidationForLocationChange) 100 , m_forcedSubtreeInvalidationWithinContainer(next.m_forcedSubtreeInvalidatio nWithinContainer)
100 , m_clipRect(next.m_clipRect) 101 , m_clipRect(next.m_clipRect)
101 , m_paintOffset(next.m_paintOffset) 102 , m_paintOffset(next.m_paintOffset)
102 , m_paintInvalidationContainer(next.m_paintInvalidationContainer) 103 , m_paintInvalidationContainer(next.m_paintInvalidationContainer)
103 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets()) 104 , m_pendingDelayedPaintInvalidations(next.pendingDelayedPaintInvalidationTar gets())
104 { 105 {
105 ASSERT(layoutObject != m_paintInvalidationContainer); 106 ASSERT(layoutObject != m_paintInvalidationContainer);
106 107
107 if (m_cachedOffsetsEnabled) 108 if (m_cachedOffsetsEnabled)
108 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo utObject.localToParentTransform())); 109 m_svgTransform = adoptPtr(new AffineTransform(next.svgTransform() * layo utObject.localToParentTransform()));
109 } 110 }
(...skipping 20 matching lines...) Expand all
130 // to be always invalidated in-time. 131 // to be always invalidated in-time.
131 if (box.usesCompositedScrolling()) 132 if (box.usesCompositedScrolling())
132 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited. 133 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited.
133 else 134 else
134 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); 135 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size()));
135 136
136 m_paintOffset -= box.scrolledContentOffset(); 137 m_paintOffset -= box.scrolledContentOffset();
137 } 138 }
138 139
139 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/PaintInvalidationState.h ('k') | Source/core/layout/svg/LayoutSVGInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698