Bug 127786

Summary: Document::topDocument() should return a reference
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, benjamin, cfleizach, commit-queue, darin, dmazzoni, esprehn+autocc, glenn, jcraig, jdiggs, kangil.han, kondapallykalyan, mario, samuel_white
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch darin: review+

Description Antti Koivisto 2014-01-28 12:09:29 PST
it should
Comment 1 Antti Koivisto 2014-01-28 12:10:53 PST
Created attachment 222473 [details]
patch
Comment 2 WebKit Commit Bot 2014-01-28 12:13:45 PST
Attachment 222473 [details] did not pass style-queue:


ERROR: Source/WebCore/rendering/RenderView.cpp:1269:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2014-01-28 12:16:34 PST
Comment on attachment 222473 [details]
patch

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

> Source/WebCore/dom/Document.cpp:4316
> -    return m_frame ? m_frame->mainFrame().document() : const_cast<Document*>(this);
> +    return m_frame ? *m_frame->mainFrame().document() : const_cast<Document&>(*this);

We should make this 100% safe by null-checking MainFrame::document and falling back to this in that case too. And if we ever change MainFrame::document to return a reference we can delete that branch.
Comment 4 Antti Koivisto 2014-01-28 14:27:59 PST
https://trac.webkit.org/r162962
Comment 5 Benjamin Poulain 2014-01-28 16:20:34 PST
Looks like it does not build on iOS.
Comment 6 Benjamin Poulain 2014-01-28 16:26:48 PST
Never mind, I am late on the internal updates. Antti already fixed the build.