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

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

Issue 2476813002: Move LayoutObject::m_previousPosition... into a global map in ObjectPaintInvalidator (Closed)
Patch Set: doc Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/PaintInvalidator.h" 5 #include "core/paint/PaintInvalidator.h"
6 6
7 #include "core/editing/FrameSelection.h" 7 #include "core/editing/FrameSelection.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/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const PaintInvalidatorContext& context) { 144 const PaintInvalidatorContext& context) {
145 FloatRect localRect; 145 FloatRect localRect;
146 if (object.isSVG() && !object.isSVGRoot()) 146 if (object.isSVG() && !object.isSVGRoot())
147 localRect = SVGLayoutSupport::localVisualRect(object); 147 localRect = SVGLayoutSupport::localVisualRect(object);
148 else 148 else
149 localRect = FloatRect(object.localVisualRect()); 149 localRect = FloatRect(object.localVisualRect());
150 150
151 return mapLocalRectToPaintInvalidationBacking(object, localRect, context); 151 return mapLocalRectToPaintInvalidationBacking(object, localRect, context);
152 } 152 }
153 153
154 LayoutPoint PaintInvalidator::computeLocationFromPaintInvalidationBacking( 154 LayoutPoint PaintInvalidator::computeLocationInBacking(
155 const LayoutObject& object, 155 const LayoutObject& object,
156 const PaintInvalidatorContext& context) { 156 const PaintInvalidatorContext& context) {
157 // Use visual rect location for LayoutTexts because it suffices to check
158 // visual rect change for layout caused invalidation.
159 if (object.isText())
160 return context.newVisualRect.location();
161
157 FloatPoint point; 162 FloatPoint point;
158 if (object != context.paintInvalidationContainer) { 163 if (object != context.paintInvalidationContainer) {
159 point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); 164 point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset));
160 165
161 PropertyTreeState currentTreeState( 166 PropertyTreeState currentTreeState(
162 context.treeBuilderContext.current.transform, 167 context.treeBuilderContext.current.transform,
163 context.treeBuilderContext.current.clip, 168 context.treeBuilderContext.current.clip,
164 context.treeBuilderContext.currentEffect, 169 context.treeBuilderContext.currentEffect,
165 context.treeBuilderContext.current.scroll); 170 context.treeBuilderContext.current.scroll);
166 const auto* containerPaintProperties = 171 const auto* containerPaintProperties =
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 context.forcedSubtreeInvalidationFlags |= 320 context.forcedSubtreeInvalidationFlags |=
316 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; 321 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking;
317 322
318 // TODO(crbug.com/637313): This is temporary before we support filters in 323 // TODO(crbug.com/637313): This is temporary before we support filters in
319 // paint property tree. 324 // paint property tree.
320 // TODO(crbug.com/648274): This is a workaround for multi-column contents. 325 // TODO(crbug.com/648274): This is a workaround for multi-column contents.
321 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread()) 326 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread())
322 context.forcedSubtreeInvalidationFlags |= 327 context.forcedSubtreeInvalidationFlags |=
323 PaintInvalidatorContext::ForcedSubtreeSlowPathRect; 328 PaintInvalidatorContext::ForcedSubtreeSlowPathRect;
324 329
330 ObjectPaintInvalidator objectPaintInvalidator(object);
325 context.oldVisualRect = object.previousVisualRect(); 331 context.oldVisualRect = object.previousVisualRect();
326 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); 332 context.oldLocation = objectPaintInvalidator.previousLocationInBacking();
327 context.newVisualRect = computeVisualRectInBacking(object, context); 333 context.newVisualRect = computeVisualRectInBacking(object, context);
328 context.newLocation = 334 context.newLocation = computeLocationInBacking(object, context);
329 computeLocationFromPaintInvalidationBacking(object, context);
330 335
331 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation( 336 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(
332 *context.paintInvalidationContainer); 337 *context.paintInvalidationContainer);
333 context.newLocation.move(adjustment); 338 context.newLocation.move(adjustment);
334 context.newVisualRect.move(adjustment); 339 context.newVisualRect.move(adjustment);
335 340
336 object.getMutableForPainting().setPreviousVisualRect(context.newVisualRect); 341 object.getMutableForPainting().setPreviousVisualRect(context.newVisualRect);
337 object.getMutableForPainting() 342 objectPaintInvalidator.setPreviousLocationInBacking(context.newLocation);
338 .setPreviousPositionFromPaintInvalidationBacking(context.newLocation);
339 } 343 }
340 344
341 void PaintInvalidator::invalidatePaintIfNeeded( 345 void PaintInvalidator::invalidatePaintIfNeeded(
342 FrameView& frameView, 346 FrameView& frameView,
343 PaintInvalidatorContext& context) { 347 PaintInvalidatorContext& context) {
344 LayoutView* layoutView = frameView.layoutView(); 348 LayoutView* layoutView = frameView.layoutView();
345 CHECK(layoutView); 349 CHECK(layoutView);
346 350
347 context.paintInvalidationContainer = 351 context.paintInvalidationContainer =
348 context.paintInvalidationContainerForStackedContents = 352 context.paintInvalidationContainerForStackedContents =
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 object.getMutableForPainting().clearPaintInvalidationFlags(); 455 object.getMutableForPainting().clearPaintInvalidationFlags();
452 } 456 }
453 457
454 void PaintInvalidator::processPendingDelayedPaintInvalidations() { 458 void PaintInvalidator::processPendingDelayedPaintInvalidations() {
455 for (auto target : m_pendingDelayedPaintInvalidations) 459 for (auto target : m_pendingDelayedPaintInvalidations)
456 target->getMutableForPainting().setShouldDoFullPaintInvalidation( 460 target->getMutableForPainting().setShouldDoFullPaintInvalidation(
457 PaintInvalidationDelayedFull); 461 PaintInvalidationDelayedFull);
458 } 462 }
459 463
460 } // namespace blink 464 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698