Bug 140920 - Introduce Document::body() for call sites interested in the <body> element
Summary: Introduce Document::body() for call sites interested in the <body> element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-26 19:35 PST by Chris Dumez
Modified: 2015-01-26 23:05 PST (History)
4 users (show)

See Also:


Attachments
Patch (26.89 KB, patch)
2015-01-26 19:53 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (26.86 KB, patch)
2015-01-26 21:53 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (26.13 KB, patch)
2015-01-26 21:56 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.