Skip to content

Commit

Permalink
Move paint offset paint invalidation into PaintPropertyTreeBuilder
Browse files Browse the repository at this point in the history
Paint offset changes should cause full paint invalidation in SPV2,
but this tracking logic can be squirreled away in
PaintPropertyTreeBuilder. This removes SPV2-specific paint offset
code from PrePaintTreeWalk::walk which was visibile on profiles
of the blink_perf.paint paint-offset-changes test.

This approach also lets us use the paint offset under-invalidation
checking in FindPropertiesNeedingUpdate which would miss changes
to a LayoutObject's paint offset outside the under-invalidation
checking scopes in PaintPropertyTreeBuilder.

BUG=678597
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2644453002
Cr-Commit-Position: refs/heads/master@{#444411}
  • Loading branch information
progers authored and Commit bot committed Jan 18, 2017
1 parent 070aa33 commit 4c680a2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 2 additions & 6 deletions third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,17 +378,13 @@ void PaintInvalidator::invalidatePaintIfNeeded(

void PaintInvalidator::invalidatePaintIfNeeded(
const LayoutObject& object,
const LayoutPoint& oldPaintOffset,
PaintInvalidatorContext& context) {
object.getMutableForPainting().ensureIsReadyForPaintInvalidation();

// The paint offset should already be updated through
// PaintPropertyTreeBuilder::updatePropertiesForSelf.
DCHECK(context.treeBuilderContext.current.paintOffset ==
object.paintOffset());
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
object.paintOffset() != oldPaintOffset) {
object.getMutableForPainting().setShouldDoFullPaintInvalidation(
PaintInvalidationLocationChange);
}

if (!context.forcedSubtreeInvalidationFlags &&
!object
Expand Down
4 changes: 1 addition & 3 deletions third_party/WebKit/Source/core/paint/PaintInvalidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ struct PaintInvalidatorContext {
class PaintInvalidator {
public:
void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&);
void invalidatePaintIfNeeded(const LayoutObject&,
const LayoutPoint& oldPaintOffset,
PaintInvalidatorContext&);
void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&);

// Process objects needing paint invalidation on the next frame.
// See the definition of PaintInvalidationDelayedFull for more details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,14 @@ void PaintPropertyTreeBuilder::updatePropertiesForSelf(
updateScrollbarPaintOffset(object, context);
}

if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate)
if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
object.paintOffset() != context.current.paintOffset) {
object.getMutableForPainting().setShouldDoFullPaintInvalidation(
PaintInvalidationLocationChange);
}
object.getMutableForPainting().setPaintOffset(context.current.paintOffset);
}
}

void PaintPropertyTreeBuilder::updatePropertiesForChildren(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class PaintPropertyTreeBuilder {
PaintPropertyTreeBuilderContext&);

// Update the paint properties that affect this object (e.g., properties like
// paint offset translation) and ensure the context is up to date.
// paint offset translation) and ensure the context is up to date. Also
// handles updating the object's paintOffset.
void updatePropertiesForSelf(const LayoutObject&,
PaintPropertyTreeBuilderContext&);
// Update the paint properties that affect children of this object (e.g.,
Expand Down
3 changes: 1 addition & 2 deletions third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ bool PrePaintTreeWalk::walk(const LayoutObject& object,
// Ensure the current context takes into account the box's position. This can
// force a subtree update due to paint offset changes and must precede any
// early out from the treewalk.
LayoutPoint oldPaintOffset = object.paintOffset();
m_propertyTreeBuilder.updateContextForBoxPosition(object,
context.treeBuilderContext);

Expand All @@ -121,7 +120,7 @@ bool PrePaintTreeWalk::walk(const LayoutObject& object,

m_propertyTreeBuilder.updatePropertiesForSelf(object,
context.treeBuilderContext);
m_paintInvalidator.invalidatePaintIfNeeded(object, oldPaintOffset,
m_paintInvalidator.invalidatePaintIfNeeded(object,
context.paintInvalidatorContext);
m_propertyTreeBuilder.updatePropertiesForChildren(object,
context.treeBuilderContext);
Expand Down

0 comments on commit 4c680a2

Please sign in to comment.