Bug 180729

Summary: Update the SVG use element's shadow trees explicitly before the style recalc
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: SVGAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, koivisto, sabouhallawa, simon.fraser, webkit-bug-importer, zalan, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 180769    
Attachments:
Description Flags
Patch
koivisto: review+
Patch for landing none

Description Ryosuke Niwa 2017-12-12 17:12:43 PST
We should update the shadow trees of a SVG use element before starting style resolution
instead of doing it as a part of willRecalc calls.
Comment 1 Radar WebKit Bug Importer 2017-12-12 17:13:23 PST
<rdar://problem/36009806>
Comment 2 Ryosuke Niwa 2017-12-12 20:37:29 PST
Created attachment 329196 [details]
Patch
Comment 3 Antti Koivisto 2017-12-13 00:38:41 PST
Comment on attachment 329196 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329196&action=review

Nice. I think you could also remove this from Style::TreeResolver::resolveComposedTree:

    // FIXME: SVG <use> element may cause tree mutations during style recalc.
    it.dropAssertions();

> Source/WebCore/svg/SVGUseElement.cpp:197
>  void SVGUseElement::willRecalcStyle(Style::Change change)
>  {
> -    // FIXME: Shadow tree should be updated before style recalc.
> -    if (m_shadowTreeNeedsUpdate)
> -        updateShadowTree();
>      SVGGraphicsElement::willRecalcStyle(change);
>  }

This function can be removed completely.
Comment 4 Ryosuke Niwa 2017-12-13 01:22:08 PST
Thanks for the review! This was a surprisingly easy/small patch. We should have done it ages ago given how small this patch is!

(In reply to Antti Koivisto from comment #3)
> Comment on attachment 329196 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=329196&action=review
> 
> Nice. I think you could also remove this from
> Style::TreeResolver::resolveComposedTree:
> 
>     // FIXME: SVG <use> element may cause tree mutations during style recalc.
>     it.dropAssertions();

Oh, that's a good point. I'd try running the tests with that.

> > Source/WebCore/svg/SVGUseElement.cpp:197
> >  void SVGUseElement::willRecalcStyle(Style::Change change)
> >  {
> > -    // FIXME: Shadow tree should be updated before style recalc.
> > -    if (m_shadowTreeNeedsUpdate)
> > -        updateShadowTree();
> >      SVGGraphicsElement::willRecalcStyle(change);
> >  }
> 
> This function can be removed completely.

Good point.
Comment 5 Ryosuke Niwa 2017-12-13 11:20:09 PST
Created attachment 329238 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2017-12-13 13:12:46 PST
Comment on attachment 329238 [details]
Patch for landing

Clearing flags on attachment: 329238

Committed r225868: <https://trac.webkit.org/changeset/225868>
Comment 7 WebKit Commit Bot 2017-12-13 13:12:47 PST
All reviewed patches have been landed.  Closing bug.