Commit 4d776da5 authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Chromium LUCI CQ

Restore resource client notifications on layout attach/detach

We still need to handle cases like when display transitions from 'none'
to not-'none' since we might need to invalidate paint properties or
similar in those cases. Unlike previously though we can just call
MarkAllClientsForInvalidation().

Remove LayoutSVGResourceClipper::WillBeDestroyed() since it should no
longer be needed.

Bug: 1162093
Change-Id: Ic0073dd10f0043e11b6ed984b57ac122a8ec37fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2614430Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#841504}
parent 19349937
...@@ -305,11 +305,4 @@ void LayoutSVGResourceClipper::StyleDidChange(StyleDifference diff, ...@@ -305,11 +305,4 @@ void LayoutSVGResourceClipper::StyleDidChange(StyleDifference diff,
} }
} }
void LayoutSVGResourceClipper::WillBeDestroyed() {
NOT_DESTROYED();
MarkAllClientsForInvalidation(SVGResourceClient::kClipCacheInvalidation |
SVGResourceClient::kPaintInvalidation);
LayoutSVGResourceContainer::WillBeDestroyed();
}
} // namespace blink } // namespace blink
...@@ -57,11 +57,9 @@ class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer { ...@@ -57,11 +57,9 @@ class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer {
base::Optional<Path> AsPath(); base::Optional<Path> AsPath();
sk_sp<const PaintRecord> CreatePaintRecord(); sk_sp<const PaintRecord> CreatePaintRecord();
protected: private:
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
void WillBeDestroyed() override;
private:
void CalculateLocalClipBounds(); void CalculateLocalClipBounds();
bool FindCycleFromSelf(SVGResourcesCycleSolver&) const override; bool FindCycleFromSelf(SVGResourcesCycleSolver&) const override;
......
...@@ -55,6 +55,37 @@ void LayoutSVGResourceContainer::UpdateLayout() { ...@@ -55,6 +55,37 @@ void LayoutSVGResourceContainer::UpdateLayout() {
ClearInvalidationMask(); ClearInvalidationMask();
} }
void LayoutSVGResourceContainer::InvalidateClientsIfActiveResource() {
NOT_DESTROYED();
// If this is the 'active' resource (the first element with the specified 'id'
// in tree order), notify any clients that they need to reevaluate the
// resource's contents.
const LocalSVGResource* resource = ResourceForContainer(*this);
if (!resource || resource->Target() != GetElement())
return;
// Pass all available flags. This may be performing unnecessary invalidations
// in some cases.
MarkAllClientsForInvalidation(SVGResourceClient::kInvalidateAll);
}
void LayoutSVGResourceContainer::WillBeDestroyed() {
NOT_DESTROYED();
// The resource is being torn down.
InvalidateClientsIfActiveResource();
LayoutSVGHiddenContainer::WillBeDestroyed();
}
void LayoutSVGResourceContainer::StyleDidChange(
StyleDifference diff,
const ComputedStyle* old_style) {
NOT_DESTROYED();
LayoutSVGHiddenContainer::StyleDidChange(diff, old_style);
if (old_style)
return;
// The resource has been attached.
InvalidateClientsIfActiveResource();
}
bool LayoutSVGResourceContainer::FindCycle( bool LayoutSVGResourceContainer::FindCycle(
SVGResourcesCycleSolver& solver) const { SVGResourcesCycleSolver& solver) const {
NOT_DESTROYED(); NOT_DESTROYED();
......
...@@ -97,7 +97,12 @@ class LayoutSVGResourceContainer : public LayoutSVGHiddenContainer { ...@@ -97,7 +97,12 @@ class LayoutSVGResourceContainer : public LayoutSVGHiddenContainer {
static bool FindCycleInSubtree(SVGResourcesCycleSolver&, static bool FindCycleInSubtree(SVGResourcesCycleSolver&,
const LayoutObject& root); const LayoutObject& root);
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
void WillBeDestroyed() override;
private: private:
void InvalidateClientsIfActiveResource();
// Track global (markAllClientsForInvalidation) invalidations to avoid // Track global (markAllClientsForInvalidation) invalidations to avoid
// redundant crawls. // redundant crawls.
unsigned completed_invalidations_mask_ : 8; unsigned completed_invalidations_mask_ : 8;
......
...@@ -28,6 +28,9 @@ class CORE_EXPORT SVGResourceClient : public GarbageCollectedMixin { ...@@ -28,6 +28,9 @@ class CORE_EXPORT SVGResourceClient : public GarbageCollectedMixin {
kPaintPropertiesInvalidation = 1 << 3, kPaintPropertiesInvalidation = 1 << 3,
kClipCacheInvalidation = 1 << 4, kClipCacheInvalidation = 1 << 4,
kFilterCacheInvalidation = 1 << 5, kFilterCacheInvalidation = 1 << 5,
kInvalidateAll = kLayoutInvalidation | kBoundariesInvalidation |
kPaintInvalidation | kPaintPropertiesInvalidation |
kClipCacheInvalidation | kFilterCacheInvalidation,
}; };
virtual void ResourceContentChanged(InvalidationModeMask) = 0; virtual void ResourceContentChanged(InvalidationModeMask) = 0;
virtual void ResourceElementChanged() = 0; virtual void ResourceElementChanged() = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment