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

Side by Side Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

Issue 2699593006: Refactor to remove need for infiniteIntRect when computing rects in pre-paint (Closed)
Patch Set: none Created 3 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/paint/PrePaintTreeWalk.h" 5 #include "core/paint/PrePaintTreeWalk.h"
6 6
7 #include "core/dom/DocumentLifecycle.h" 7 #include "core/dom/DocumentLifecycle.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Returns whether |a| is an ancestor of or equal to |b|. 99 // Returns whether |a| is an ancestor of or equal to |b|.
100 static bool isAncestorOfOrEqualTo(const ClipPaintPropertyNode* a, 100 static bool isAncestorOfOrEqualTo(const ClipPaintPropertyNode* a,
101 const ClipPaintPropertyNode* b) { 101 const ClipPaintPropertyNode* b) {
102 while (b && b != a) { 102 while (b && b != a) {
103 b = b->parent(); 103 b = b->parent();
104 } 104 }
105 return b == a; 105 return b == a;
106 } 106 }
107 107
108 ClipRect PrePaintTreeWalk::clipRectForContext( 108 FloatClipRect PrePaintTreeWalk::clipRectForContext(
109 const PaintPropertyTreeBuilderContext::ContainingBlockContext& context, 109 const PaintPropertyTreeBuilderContext::ContainingBlockContext& context,
110 const EffectPaintPropertyNode* effect, 110 const EffectPaintPropertyNode* effect,
111 const PropertyTreeState& ancestorState, 111 const PropertyTreeState& ancestorState,
112 const LayoutPoint& ancestorPaintOffset, 112 const LayoutPoint& ancestorPaintOffset,
113 bool& hasClip) { 113 bool& hasClip) {
114 // Only return a non-infinite clip if clips differ, or the "ancestor" state is 114 // Only return a non-infinite clip if clips differ, or the "ancestor" state is
115 // actually an ancestor clip. This ensures no accuracy issues due to 115 // actually an ancestor clip. This ensures no accuracy issues due to
116 // transforms applied to infinite rects. 116 // transforms applied to infinite rects.
117 if (isAncestorOfOrEqualTo(context.clip, ancestorState.clip())) 117 if (isAncestorOfOrEqualTo(context.clip, ancestorState.clip()))
118 return ClipRect(LayoutRect(LayoutRect::infiniteIntRect())); 118 return FloatClipRect();
119 119
120 hasClip = true; 120 hasClip = true;
121 121
122 PropertyTreeState localState(context.transform, context.clip, effect); 122 PropertyTreeState localState(context.transform, context.clip, effect);
123 123
124 // TODO(chrishtr): remove need for this. 124 FloatClipRect rect(
125 LayoutRect localRect(LayoutRect::infiniteIntRect()); 125 m_geometryMapper.sourceToDestinationClipRect(localState, ancestorState));
126 126
127 LayoutRect rect(m_geometryMapper 127 rect.moveBy(-FloatPoint(ancestorPaintOffset));
128 .sourceToDestinationVisualRect(FloatRect(localRect),
129 localState, ancestorState)
130 .rect());
131 rect.moveBy(-ancestorPaintOffset);
132 return rect; 128 return rect;
133 } 129 }
134 130
135 void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded( 131 void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded(
136 const LayoutObject& object, 132 const LayoutObject& object,
137 const PaintLayer& ancestorTransformedOrRootPaintLayer, 133 const PaintLayer& ancestorTransformedOrRootPaintLayer,
138 PaintPropertyTreeBuilderContext& context) { 134 PaintPropertyTreeBuilderContext& context) {
139 if (!object.hasLayer()) 135 if (!object.hasLayer())
140 return; 136 return;
141 137
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 roundedIntPoint(context.treeBuilderContext.current.paintOffset); 263 roundedIntPoint(context.treeBuilderContext.current.paintOffset);
268 walk(*toFrameView(widget), context); 264 walk(*toFrameView(widget), context);
269 } 265 }
270 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). 266 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281).
271 } 267 }
272 268
273 object.getMutableForPainting().clearPaintFlags(); 269 object.getMutableForPainting().clearPaintFlags();
274 } 270 }
275 271
276 } // namespace blink 272 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698