Bug 55720

Summary: Refactor createRendererIfNeeded to avoid premature nextRenderer calculation
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: New BugsAssignee: Eric Seidel (no email) <eric>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, darin, ddorwin, dglazkov, eric, jer.noble, koivisto, ossy, tkent
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 55626    
Attachments:
Description Flags
Patch
none
Fix ChangeLog typo none

Description Eric Seidel (no email) 2011-03-03 15:28:59 PST
Refactor createRendererIfNeeded to avoid premature nextRenderer calculation
Comment 1 Eric Seidel (no email) 2011-03-03 15:58:13 PST
Created attachment 84643 [details]
Patch
Comment 2 Eric Seidel (no email) 2011-03-03 15:58:51 PST
(the CC list is care of webkit-patch --suggest-reviewers, feel free to remove yourself if this change to Node.cpp does not interest you)
Comment 3 Eric Seidel (no email) 2011-03-03 16:01:27 PST
Created attachment 84644 [details]
Fix ChangeLog typo
Comment 4 Dimitri Glazkov (Google) 2011-03-03 16:12:43 PST
Comment on attachment 84644 [details]
Fix ChangeLog typo

great!
Comment 5 Darin Adler 2011-03-03 16:55:54 PST
Comment on attachment 84644 [details]
Fix ChangeLog typo

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

> Source/WebCore/dom/Node.cpp:1394
> +    newRenderer->setAnimatableStyle(style.release()); // setAnimatableStyle() can depend on renderer() already being set.

I don’t understand this comment.
Comment 6 Eric Seidel (no email) 2011-03-03 17:32:29 PST
(In reply to comment #5)
> (From update of attachment 84644 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=84644&action=review
> 
> > Source/WebCore/dom/Node.cpp:1394
> > +    newRenderer->setAnimatableStyle(style.release()); // setAnimatableStyle() can depend on renderer() already being set.
> 
> I don’t understand this comment.

I can dig up the callstack if you like.  But deep inside setAnimatable style it calls back through RenderLayer which grabs renderer() w/o checking for null.  So it's required to call setRenderer before setting the animatable style on the renderer it seems.
Comment 7 Darin Adler 2011-03-03 18:05:36 PST
(In reply to comment #6)
> (In reply to comment #5)
> > > Source/WebCore/dom/Node.cpp:1394
> > > +    newRenderer->setAnimatableStyle(style.release()); // setAnimatableStyle() can depend on renderer() already being set.
> > 
> > I don’t understand this comment.
> 
> I can dig up the callstack if you like. But deep inside setAnimatable style it calls back through RenderLayer which grabs renderer() w/o checking for null. So it's required to call setRenderer before setting the animatable style on the renderer it seems.

OK, but I am not sure this comment is helpful.

The code was setting the renderer and then setting the animatable style, and you added a comment that basically says “this has to be in this order”, but I don’t think that adds value.

Also the wording “can depend” gives me a feeling of fear, and since the comment doesn’t say why there is a dependency, I’m not sure it adds anything beyond what the test coverage already provides.
Comment 8 WebKit Commit Bot 2011-03-03 23:04:11 PST
Comment on attachment 84644 [details]
Fix ChangeLog typo

Clearing flags on attachment: 84644

Committed r80330: <http://trac.webkit.org/changeset/80330>
Comment 9 WebKit Commit Bot 2011-03-03 23:04:17 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Eric Seidel (no email) 2011-03-04 00:33:17 PST
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > > Source/WebCore/dom/Node.cpp:1394
> > > > +    newRenderer->setAnimatableStyle(style.release()); // setAnimatableStyle() can depend on renderer() already being set.
> > > 
> > > I don’t understand this comment.
> > 
> > I can dig up the callstack if you like. But deep inside setAnimatable style it calls back through RenderLayer which grabs renderer() w/o checking for null. So it's required to call setRenderer before setting the animatable style on the renderer it seems.
> 
> OK, but I am not sure this comment is helpful.
> 
> The code was setting the renderer and then setting the animatable style, and you added a comment that basically says “this has to be in this order”, but I don’t think that adds value.
> 
> Also the wording “can depend” gives me a feeling of fear, and since the comment doesn’t say why there is a dependency, I’m not sure it adds anything beyond what the test coverage already provides.

I'll remove it in a follow-up.