Bug 242420 - ☂️ avoid invalidating SVG resources when referencing element changes layout
Summary: ☂️ avoid invalidating SVG resources when referencing element changes layout
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 242778 242421 242423
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-06 21:26 PDT by Cameron McCormack (:heycam)
Modified: 2022-07-14 17:51 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2022-07-06 21:26:02 PDT
In SVG RenderObject layout methods, we call SVGResourcesCache::clientLayoutChanged if any layout was performed.  Sometimes this is unnecessary work, as the specific changes that were made during layout do not affect the data that the SVGResourceContainer has cached.  In the dependent bugs I'll file under here, I'll make all of the SVG resource types able to respond to changes on referencing element lazily, without needing to eagerly remove and recreate all resources.
Comment 1 Cameron McCormack (:heycam) 2022-07-06 21:29:04 PDT
The pattern I will use for all of the resource classes is to store the dependencies that came from the referencing RenderElement (such as its object bounding box) on the data object we store in the HashMap of the resource container object.  Then, under applyResource, we compute those dependencies and compare them against the cached values.  If they differ, we invalidate the cached values (such as the RefPtr<Gradient> of a gradient resource or the RefPtr<ImageBuffer> of a mask resource) and recompute them.
Comment 2 Radar WebKit Bug Importer 2022-07-13 21:26:15 PDT
<rdar://problem/96991415>