Bug 140920

Summary: Introduce Document::body() for call sites interested in the <body> element
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, kling, koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Chris Dumez 2015-01-26 19:35:52 PST
Introduce Document::body() for call sites interested in the <body> element only (not <frameset> like Document::bodyOrFrameset() does).
Comment 1 Chris Dumez 2015-01-26 19:53:35 PST
Created attachment 245404 [details]
Patch
Comment 2 Darin Adler 2015-01-26 21:41:57 PST
Comment on attachment 245404 [details]
Patch

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

> Source/WebCore/rendering/RenderLayerBacking.cpp:1793
> +        auto* rootObject = renderer().document().documentElement() ? renderer().document().documentElement()->renderer() : nullptr;

Surprised you didn’t add a local variable for documentElement here given what you did everywhere else

> Source/WebCore/rendering/RenderLayerBacking.cpp:1806
> +        auto* bodyRenderer = body ? body->renderer() : nullptr;
> +        if (!bodyRenderer)
>              return false;

Could just return false one more time a line earlier instead of using ? : here
Comment 3 Chris Dumez 2015-01-26 21:50:03 PST
Comment on attachment 245404 [details]
Patch

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

>> Source/WebCore/rendering/RenderLayerBacking.cpp:1793
>> +        auto* rootObject = renderer().document().documentElement() ? renderer().document().documentElement()->renderer() : nullptr;
> 
> Surprised you didn’t add a local variable for documentElement here given what you did everywhere else

documentElement() is a trivial getter. I cached the return value of body() and bodyOrFrameset() because those do tree traversal.

>> Source/WebCore/rendering/RenderLayerBacking.cpp:1806
>>              return false;
> 
> Could just return false one more time a line earlier instead of using ? : here

Ok.
Comment 4 Chris Dumez 2015-01-26 21:53:10 PST
Created attachment 245418 [details]
Patch
Comment 5 Chris Dumez 2015-01-26 21:56:16 PST
Created attachment 245419 [details]
Patch
Comment 6 WebKit Commit Bot 2015-01-26 23:05:10 PST
Comment on attachment 245419 [details]
Patch

Clearing flags on attachment: 245419

Committed r179172: <http://trac.webkit.org/changeset/179172>
Comment 7 WebKit Commit Bot 2015-01-26 23:05:16 PST
All reviewed patches have been landed.  Closing bug.