RESOLVED FIXED 119435
FrameView should have an isMainFrameView()
https://bugs.webkit.org/show_bug.cgi?id=119435
Summary FrameView should have an isMainFrameView()
Tim Horton
Reported 2013-08-02 01:11:22 PDT
There's a lot of "m_frame && m_frame->page() && m_frame->page()->mainFrame() == m_frame". Also I have already (maybe twice) made the mistake of not doing the requisite null-checks.
Attachments
patch (6.77 KB, patch)
2013-08-02 01:13 PDT, Tim Horton
no flags
more places (10.79 KB, patch)
2013-08-02 03:26 PDT, Tim Horton
simon.fraser: review+
Tim Horton
Comment 1 2013-08-02 01:13:28 PDT
Created attachment 207992 [details] patch Maybe there's some compelling reason that we haven't done this before? I don't know, but I'd love to!
zalan
Comment 2 2013-08-02 02:11:47 PDT
Yay. I wanted to do this for such a long time :) (I was a bit hesitant though, whether WebCore::Frame should have an isMainFrame() function instead (copy what WK2 already has) and use that in FrameView (and in other classes)) Anyway there are a few more places where you check for isMainFrameView() FrameView::setFrameRect() FrameView::performPostLayoutTasks() FrameView::pagination() FrameView::paintOverhangAreas()
Tim Horton
Comment 3 2013-08-02 03:22:18 PDT
(In reply to comment #2) > Yay. I wanted to do this for such a long time :) (I was a bit hesitant though, whether WebCore::Frame should have an isMainFrame() function instead (copy what WK2 already has) and use that in FrameView (and in other classes)) > > Anyway there are a few more places where you check for isMainFrameView() > > FrameView::setFrameRect() > FrameView::performPostLayoutTasks() > FrameView::pagination() > FrameView::paintOverhangAreas() There are even more than that! I will post a new patch in a moment.
Tim Horton
Comment 4 2013-08-02 03:26:42 PDT
Created attachment 207997 [details] more places
Simon Fraser (smfr)
Comment 5 2013-08-02 10:59:19 PDT
Comment on attachment 207997 [details] more places View in context: https://bugs.webkit.org/attachment.cgi?id=207997&action=review > Source/WebCore/page/FrameView.cpp:427 > +bool FrameView::isMainFrameView() const > +{ > + return m_frame && m_frame->page() && m_frame->page()->mainFrame() == m_frame; > +} > + Does this do the right thing for a page in the page cache? What is the right thing?
Brady Eidson
Comment 6 2013-08-02 12:29:49 PDT
(In reply to comment #5) > (From update of attachment 207997 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=207997&action=review > > > Source/WebCore/page/FrameView.cpp:427 > > +bool FrameView::isMainFrameView() const > > +{ > > + return m_frame && m_frame->page() && m_frame->page()->mainFrame() == m_frame; > > +} > > + > > Does this do the right thing for a page in the page cache? What is the right thing? A "web page" in the page cache is a much different concept than a WebCore::Page WebCore::Page represents the browser tab. And that WebCore::Page has a single WebCore::Frame that is ALWAYS the main frame of that tab, even across navigations. I think this check is fine.
Darin Adler
Comment 7 2013-08-02 14:13:17 PDT
(In reply to comment #1) > Maybe there's some compelling reason that we haven't done this before? I don't know, but I'd love to! Generally it’s hard to know how much to replicate across the core classes. Should Document have isMainFrameDocument in it? Should Frame have isMainFrame or only FrameTree, etc.?
Tim Horton
Comment 8 2013-08-15 12:07:51 PDT
Ryosuke Niwa
Comment 9 2013-08-15 13:53:59 PDT
Note You need to log in before you can comment on or make changes to this bug.