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

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

Issue 2489893002: [SPv2] Track paint offset change (Closed)
Patch Set: - 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
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // 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.
326 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread()) 326 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread())
327 context.forcedSubtreeInvalidationFlags |= 327 context.forcedSubtreeInvalidationFlags |=
328 PaintInvalidatorContext::ForcedSubtreeSlowPathRect; 328 PaintInvalidatorContext::ForcedSubtreeSlowPathRect;
329 329
330 ObjectPaintInvalidator objectPaintInvalidator(object); 330 ObjectPaintInvalidator objectPaintInvalidator(object);
331 context.oldVisualRect = object.previousVisualRect(); 331 context.oldVisualRect = object.previousVisualRect();
332 context.oldLocation = objectPaintInvalidator.previousLocationInBacking(); 332 context.oldLocation = objectPaintInvalidator.previousLocationInBacking();
333 context.newVisualRect = computeVisualRectInBacking(object, context); 333 context.newVisualRect = computeVisualRectInBacking(object, context);
334 context.newLocation = computeLocationInBacking(object, context); 334 context.newLocation = computeLocationInBacking(object, context);
335 context.oldPaintOffset = object.previousPaintOffset();
336 context.newPaintOffset = context.treeBuilderContext.current.paintOffset;
335 337
336 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation( 338 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(
337 *context.paintInvalidationContainer); 339 *context.paintInvalidationContainer);
338 context.newLocation.move(adjustment); 340 context.newLocation.move(adjustment);
339 context.newVisualRect.move(adjustment); 341 context.newVisualRect.move(adjustment);
340 342
341 object.getMutableForPainting().setPreviousVisualRect(context.newVisualRect); 343 object.getMutableForPainting().setPreviousVisualRect(context.newVisualRect);
342 objectPaintInvalidator.setPreviousLocationInBacking(context.newLocation); 344 objectPaintInvalidator.setPreviousLocationInBacking(context.newLocation);
345 object.getMutableForPainting().setPreviousPaintOffset(context.newPaintOffset);
343 } 346 }
344 347
345 void PaintInvalidator::invalidatePaintIfNeeded( 348 void PaintInvalidator::invalidatePaintIfNeeded(
346 FrameView& frameView, 349 FrameView& frameView,
347 PaintInvalidatorContext& context) { 350 PaintInvalidatorContext& context) {
348 LayoutView* layoutView = frameView.layoutView(); 351 LayoutView* layoutView = frameView.layoutView();
349 CHECK(layoutView); 352 CHECK(layoutView);
350 353
351 context.paintInvalidationContainer = 354 context.paintInvalidationContainer =
352 context.paintInvalidationContainerForStackedContents = 355 context.paintInvalidationContainerForStackedContents =
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 ForcedSubtreeFullInvalidationForStackedContents); 414 ForcedSubtreeFullInvalidationForStackedContents);
412 break; 415 break;
413 case PaintInvalidationSVGResourceChange: 416 case PaintInvalidationSVGResourceChange:
414 context.forcedSubtreeInvalidationFlags |= 417 context.forcedSubtreeInvalidationFlags |=
415 PaintInvalidatorContext::ForcedSubtreeSVGResourceChange; 418 PaintInvalidatorContext::ForcedSubtreeSVGResourceChange;
416 break; 419 break;
417 default: 420 default:
418 break; 421 break;
419 } 422 }
420 423
421 if (context.oldLocation != context.newLocation) 424 if (context.oldLocation != context.newLocation ||
425 (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
426 context.oldPaintOffset != context.newPaintOffset)) {
422 context.forcedSubtreeInvalidationFlags |= 427 context.forcedSubtreeInvalidationFlags |=
423 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; 428 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking;
429 }
424 430
425 // TODO(crbug.com/490725): This is a workaround for the bug, to force 431 // TODO(crbug.com/490725): This is a workaround for the bug, to force
426 // descendant to update visual rects on clipping change. 432 // descendant to update visual rects on clipping change.
427 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 433 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
428 context.oldVisualRect != context.newVisualRect 434 context.oldVisualRect != context.newVisualRect
429 // Note that isLayoutView() below becomes unnecessary after the launch of 435 // Note that isLayoutView() below becomes unnecessary after the launch of
430 // root layer scrolling. 436 // root layer scrolling.
431 && (object.hasOverflowClip() || object.isLayoutView()) && 437 && (object.hasOverflowClip() || object.isLayoutView()) &&
432 !toLayoutBox(object).usesCompositedScrolling()) 438 !toLayoutBox(object).usesCompositedScrolling())
433 context.forcedSubtreeInvalidationFlags |= 439 context.forcedSubtreeInvalidationFlags |=
434 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; 440 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate;
435 441
436 object.getMutableForPainting().clearPaintInvalidationFlags(); 442 object.getMutableForPainting().clearPaintInvalidationFlags();
437 } 443 }
438 444
439 void PaintInvalidator::processPendingDelayedPaintInvalidations() { 445 void PaintInvalidator::processPendingDelayedPaintInvalidations() {
440 for (auto target : m_pendingDelayedPaintInvalidations) 446 for (auto target : m_pendingDelayedPaintInvalidations)
441 target->getMutableForPainting().setShouldDoFullPaintInvalidation( 447 target->getMutableForPainting().setShouldDoFullPaintInvalidation(
442 PaintInvalidationDelayedFull); 448 PaintInvalidationDelayedFull);
443 } 449 }
444 450
445 } // namespace blink 451 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.h ('k') | third_party/WebKit/Source/core/paint/PartPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698