Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 ForcedSubtreeFullInvalidationForStackedContents); | 426 ForcedSubtreeFullInvalidationForStackedContents); |
| 424 break; | 427 break; |
| 425 case PaintInvalidationSVGResourceChange: | 428 case PaintInvalidationSVGResourceChange: |
| 426 context.forcedSubtreeInvalidationFlags |= | 429 context.forcedSubtreeInvalidationFlags |= |
| 427 PaintInvalidatorContext::ForcedSubtreeSVGResourceChange; | 430 PaintInvalidatorContext::ForcedSubtreeSVGResourceChange; |
| 428 break; | 431 break; |
| 429 default: | 432 default: |
| 430 break; | 433 break; |
| 431 } | 434 } |
| 432 | 435 |
| 433 if (context.oldLocation != context.newLocation) | 436 if (context.oldLocation != context.newLocation || |
| 437 (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | |
| 438 context.oldPaintOffset != context.newPaintOffset)) { | |
| 434 context.forcedSubtreeInvalidationFlags |= | 439 context.forcedSubtreeInvalidationFlags |= |
| 435 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; | 440 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; |
| 441 } | |
| 436 | 442 |
| 437 // TODO(crbug.com/533277): This is a workaround for the bug. Remove when we | 443 // TODO(crbug.com/533277): This is a workaround for the bug. Remove when we |
|
pdr.
2016/11/10 07:35:32
WDYT about adding a little more info to this comme
Xianzhu
2016/11/10 17:41:10
Done.
| |
| 438 // detect paint offset change. | 444 // detect paint offset change. |
| 439 if (reason != PaintInvalidationNone && | 445 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
|
chrishtr
2016/11/10 18:42:00
How was this fixed for SPv2?
Xianzhu
2016/11/10 22:51:50
Good question. To answer your question, at first I
| |
| 440 hasPercentageTransform(object.styleRef())) | 446 reason != PaintInvalidationNone && |
| 447 hasPercentageTransform(object.styleRef())) { | |
| 441 context.forcedSubtreeInvalidationFlags |= | 448 context.forcedSubtreeInvalidationFlags |= |
| 442 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; | 449 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; |
| 450 } | |
| 443 | 451 |
| 444 // TODO(crbug.com/490725): This is a workaround for the bug, to force | 452 // TODO(crbug.com/490725): This is a workaround for the bug, to force |
| 445 // descendant to update visual rects on clipping change. | 453 // descendant to update visual rects on clipping change. |
| 446 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 454 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 447 context.oldVisualRect != context.newVisualRect | 455 context.oldVisualRect != context.newVisualRect |
| 448 // Note that isLayoutView() below becomes unnecessary after the launch of | 456 // Note that isLayoutView() below becomes unnecessary after the launch of |
| 449 // root layer scrolling. | 457 // root layer scrolling. |
| 450 && (object.hasOverflowClip() || object.isLayoutView()) && | 458 && (object.hasOverflowClip() || object.isLayoutView()) && |
| 451 !toLayoutBox(object).usesCompositedScrolling()) | 459 !toLayoutBox(object).usesCompositedScrolling()) |
| 452 context.forcedSubtreeInvalidationFlags |= | 460 context.forcedSubtreeInvalidationFlags |= |
| 453 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; | 461 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; |
| 454 | 462 |
| 455 object.getMutableForPainting().clearPaintInvalidationFlags(); | 463 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 456 } | 464 } |
| 457 | 465 |
| 458 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 466 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
| 459 for (auto target : m_pendingDelayedPaintInvalidations) | 467 for (auto target : m_pendingDelayedPaintInvalidations) |
| 460 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 468 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 461 PaintInvalidationDelayedFull); | 469 PaintInvalidationDelayedFull); |
| 462 } | 470 } |
| 463 | 471 |
| 464 } // namespace blink | 472 } // namespace blink |
| OLD | NEW |