Bug 136746 - Use tighter typing for Document::ownerElement() return value
Summary: Use tighter typing for Document::ownerElement() return value
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: 2014-09-11 11:28 PDT by Chris Dumez
Modified: 2014-09-14 12:43 PDT (History)
17 users (show)

See Also:


Attachments
Patch (7.86 KB, patch)
2014-09-11 11:36 PDT, 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 2014-09-11 11:28:55 PDT
Use tighter typing for Document::ownerElement() return value to improve code readability and allow to compiler to generate slightly more efficient code is some cases.
Comment 1 Chris Dumez 2014-09-11 11:36:06 PDT
Created attachment 237970 [details]
Patch
Comment 2 Ryosuke Niwa 2014-09-11 11:42:43 PDT
Comment on attachment 237970 [details]
Patch

r=me
Comment 3 WebKit Commit Bot 2014-09-11 12:26:30 PDT
Comment on attachment 237970 [details]
Patch

Clearing flags on attachment: 237970

Committed r173528: <http://trac.webkit.org/changeset/173528>
Comment 4 WebKit Commit Bot 2014-09-11 12:26:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Darin Adler 2014-09-14 12:43:19 PDT
Comment on attachment 237970 [details]
Patch

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

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1464
> +    if (HTMLFrameOwnerElement* owner = document->ownerElement()) {

auto* is better than HTMLFrameOwnerElement here; if we had used auto before then the code would have been closer to correct without modifying it

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1466
> +            const AtomicString& title = owner->getAttribute(titleAttr);

fastGetAttribute

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1477
> +    if (HTMLElement* body = document->body())

I think auto* is better than HTMLElement here. Maybe some day we will have an HTMLBodyElement, and maybe it will have some special optimization for getNameAttribute. Why not be future proof in this respect?