Bug 136746

Summary: Use tighter typing for Document::ownerElement() return value
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, cfleizach, commit-queue, dmazzoni, esprehn+autocc, glenn, gyuyoung.kim, jcraig, jdiggs, kangil.han, koivisto, kondapallykalyan, mario, rniwa, samuel_white, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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?