ASSIGNED 133159
viewStateDidChange should always fully update ViewState
https://bugs.webkit.org/show_bug.cgi?id=133159
Summary viewStateDidChange should always fully update ViewState
Gavin Barraclough
Reported 2014-05-21 15:34:04 PDT
Currently WebPageProxy::viewStateDidChange is passed a mask of bits to update. This has the following negative consequences: – WKWebView implicitly requires more detailed knowledge of the internal implementation of the PageClient. – Updates may unnecessarily be split over multiple IPC messages. – In order to support partial updates we make multiple virtual function calls to PageClient, which then makes duplicate objc calls. Better to just always update the entire ViewState.
Attachments
Fix (32.65 KB, patch)
2014-05-26 17:50 PDT, Gavin Barraclough
no flags
gtk/efl fix (36.54 KB, patch)
2014-05-26 18:00 PDT, Gavin Barraclough
andersca: review+
Gavin Barraclough
Comment 1 2014-05-26 17:50:50 PDT
WebKit Commit Bot
Comment 2 2014-05-26 17:52:31 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Sam Weinig
Comment 3 2014-05-26 17:59:58 PDT
Look good to me, but I would like Anders to review it as well.
Gavin Barraclough
Comment 4 2014-05-26 18:00:34 PDT
Created attachment 232100 [details] gtk/efl fix
Carlos Garcia Campos
Comment 5 2014-05-27 00:06:48 PDT
Comment on attachment 232100 [details] gtk/efl fix View in context: https://bugs.webkit.org/attachment.cgi?id=232100&action=review Thanks for fixing the GTK+ port too. > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp:110 > + if (webkitWebViewBaseIsFocused(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > + viewState |= ViewState::IsFocused; > + if (webkitWebViewBaseIsInWindowActive(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > + viewState |= ViewState::WindowIsActive; > + if (webkitWebViewBaseIsInWindow(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > + viewState |= ViewState::IsInWindow; > + if (webkitWebViewBaseIsVisible(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) Now that all these are in the same function, I would use a local variable to avoid casting all the time. WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget); if (webkitWebViewBaseIsFocused(webView)) .... I think it also improves a bit the readability. > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h:70 > + bool isViewVisible(); Why re-adding this as non-virtual?
Anders Carlsson
Comment 6 2014-05-28 16:04:25 PDT
Comment on attachment 232100 [details] gtk/efl fix This looks really great, but please address the comments from Carlos.
Gavin Barraclough
Comment 7 2014-05-28 18:17:03 PDT
(In reply to comment #5) > (From update of attachment 232100 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=232100&action=review > > Thanks for fixing the GTK+ port too. > > > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp:110 > > + if (webkitWebViewBaseIsFocused(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > > + viewState |= ViewState::IsFocused; > > + if (webkitWebViewBaseIsInWindowActive(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > > + viewState |= ViewState::WindowIsActive; > > + if (webkitWebViewBaseIsInWindow(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > > + viewState |= ViewState::IsInWindow; > > + if (webkitWebViewBaseIsVisible(WEBKIT_WEB_VIEW_BASE(m_viewWidget))) > > Now that all these are in the same function, I would use a local variable to avoid casting all the time. > WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget); > > if (webkitWebViewBaseIsFocused(webView)) > .... > > I think it also improves a bit the readability. > Ah – yes, good point. Done. > > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h:70 > > + bool isViewVisible(); > > Why re-adding this as non-virtual? Ooops, remnants of a partial refactor – that's gone now, removed.
Gavin Barraclough
Comment 8 2014-05-28 18:42:06 PDT
Transmitting file data ................. Committed revision 169439.
Radar WebKit Bug Importer
Comment 9 2014-05-29 13:48:25 PDT
Babak Shafiei
Comment 10 2014-05-29 14:50:33 PDT
Roll out on trunk in https://trac.webkit.org/r169465
Note You need to log in before you can comment on or make changes to this bug.