Changeset 158369 in webkit


Ignore:
Timestamp:
Oct 31, 2013 10:48:33 AM (10 years ago)
Author:
barraclough@apple.com
Message:

WebPageCreationParameters should be consistent in Window.open
https://bugs.webkit.org/show_bug.cgi?id=123557

Reviewed by Sam Weinig.

When Window.open in called in WebKit2 the WebProcess sends a synchronous request to open
a page (WebPageProxy::createNewPage). The UIProcess creates a WebpageProxy, and responds
with instructions to the WebProcess to create the WebPage. The initial creation state of
the WebPage is communicated to the WebProcess via two routes (firstly an asynchronous
WebProcess::CreateWebPage message, and secondly in the synchronous response from
WebPageProxy::createNewPage). Unfortunately these responses are inconsistent with each
other. The creationParameters() for the page are calculated twice, and since the WKView
will be added to a window between the async message being sent and the synchronous reply
being returned the visibility state of the page can change.

To fix the inconsistency we can set the creation parameters at the point that the
WebPageProxy is instantiated. This will result in a functional change that is web
visible, since the page will initially be opened in a hidden/blurred state, and may
later become visible/focussed. This change is consistent with the direction we want to
evolve in. Whilst we will still probably require a synchronous message from the
WebProcess to the UIProcess on Window.open, we'll probably make this return much earlier
– having just created the WebPageProxy, but avoiding blocking the WebProcess over the
client delegate callback that opens the new window.

This fix results in a layout test result change, due to the change in behavior (page is
created blurred, and becomes focussed, resulting in a focus event being fired – rather
than the window opening directly into a focussed state). This is reported as a
progression (test is broken in WebKit1, fixed in WebKit2 after this change). In reality
the test is actually slightly broken in DRT/test-runner – the test runs differently than
in browser, since there is is no visible main window. In-browser this patch results in
no change in behavior on dom/Window/mozilla-focus-blur.html (the affected test).

Source/WebKit2:

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::initializeWebPage):

  • call initializeCreationParameters

(WebKit::WebPageProxy::initializeCreationParameters):

  • calculate m_creationParameters
  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::creationParameters):

  • Added m_creationParameters, initializeCreationParameters, creationParameters returns m_creationParameters

LayoutTests:

  • platform/mac-wk2/fast/dom/Window: Added.
  • platform/mac-wk2/fast/dom/Window/mozilla-focus-blur-expected.txt: Added.
    • This test now reports a pass on WebKit2
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r158362 r158369  
     12013-10-30  Gavin Barraclough  <barraclough@apple.com>
     2
     3        WebPageCreationParameters should be consistent in Window.open
     4        https://bugs.webkit.org/show_bug.cgi?id=123557
     5
     6        Reviewed by Sam Weinig.
     7
     8        When Window.open in called in WebKit2 the WebProcess sends a synchronous request to open
     9        a page (WebPageProxy::createNewPage). The UIProcess creates a WebpageProxy, and responds
     10        with instructions to the WebProcess to create the WebPage. The initial creation state of
     11        the WebPage is communicated to the WebProcess via two routes (firstly an asynchronous
     12        WebProcess::CreateWebPage message, and secondly in the synchronous response from
     13        WebPageProxy::createNewPage). Unfortunately these responses are inconsistent with each
     14        other. The creationParameters() for the page are calculated twice, and since the WKView
     15        will be added to a window between the async message being sent and the synchronous reply
     16        being returned the visibility state of the page can change.
     17
     18        To fix the inconsistency we can set the creation parameters at the point that the
     19        WebPageProxy is instantiated. This will result in a functional change that is web
     20        visible, since the page will initially be opened in a hidden/blurred state, and may
     21        later become visible/focussed. This change is consistent with the direction we want to
     22        evolve in. Whilst we will still probably require a synchronous message from the
     23        WebProcess to the UIProcess on Window.open, we'll probably make this return much earlier
     24        – having just created the WebPageProxy, but avoiding blocking the WebProcess over the
     25        client delegate callback that opens the new window.
     26
     27        This fix results in a layout test result change, due to the change in behavior (page is
     28        created blurred, and becomes focussed, resulting in a focus event being fired – rather
     29        than the window opening directly into a focussed state). This is reported as a
     30        progression (test is broken in WebKit1, fixed in WebKit2 after this change). In reality
     31        the test is actually slightly broken in DRT/test-runner – the test runs differently than
     32        in browser, since there is is no visible main window. In-browser this patch results in
     33        no change in behavior on dom/Window/mozilla-focus-blur.html (the affected test).
     34
     35        * platform/mac-wk2/fast/dom/Window: Added.
     36        * platform/mac-wk2/fast/dom/Window/mozilla-focus-blur-expected.txt: Added.
     37            - This test now reports a pass on WebKit2
     38
    1392013-10-31  Alexey Proskuryakov  <ap@apple.com>
    240
  • trunk/Source/WebKit2/ChangeLog

    r158360 r158369  
     12013-10-30  Gavin Barraclough  <barraclough@apple.com>
     2
     3        WebPageCreationParameters should be consistent in Window.open
     4        https://bugs.webkit.org/show_bug.cgi?id=123557
     5
     6        Reviewed by Sam Weinig.
     7
     8        When Window.open in called in WebKit2 the WebProcess sends a synchronous request to open
     9        a page (WebPageProxy::createNewPage). The UIProcess creates a WebpageProxy, and responds
     10        with instructions to the WebProcess to create the WebPage. The initial creation state of
     11        the WebPage is communicated to the WebProcess via two routes (firstly an asynchronous
     12        WebProcess::CreateWebPage message, and secondly in the synchronous response from
     13        WebPageProxy::createNewPage). Unfortunately these responses are inconsistent with each
     14        other. The creationParameters() for the page are calculated twice, and since the WKView
     15        will be added to a window between the async message being sent and the synchronous reply
     16        being returned the visibility state of the page can change.
     17
     18        To fix the inconsistency we can set the creation parameters at the point that the
     19        WebPageProxy is instantiated. This will result in a functional change that is web
     20        visible, since the page will initially be opened in a hidden/blurred state, and may
     21        later become visible/focussed. This change is consistent with the direction we want to
     22        evolve in. Whilst we will still probably require a synchronous message from the
     23        WebProcess to the UIProcess on Window.open, we'll probably make this return much earlier
     24        – having just created the WebPageProxy, but avoiding blocking the WebProcess over the
     25        client delegate callback that opens the new window.
     26
     27        This fix results in a layout test result change, due to the change in behavior (page is
     28        created blurred, and becomes focussed, resulting in a focus event being fired – rather
     29        than the window opening directly into a focussed state). This is reported as a
     30        progression (test is broken in WebKit1, fixed in WebKit2 after this change). In reality
     31        the test is actually slightly broken in DRT/test-runner – the test runs differently than
     32        in browser, since there is is no visible main window. In-browser this patch results in
     33        no change in behavior on dom/Window/mozilla-focus-blur.html (the affected test).
     34
     35        * UIProcess/WebPageProxy.cpp:
     36        (WebKit::WebPageProxy::initializeWebPage):
     37            - call initializeCreationParameters
     38        (WebKit::WebPageProxy::initializeCreationParameters):
     39            - calculate m_creationParameters
     40        * UIProcess/WebPageProxy.h:
     41        (WebKit::WebPageProxy::creationParameters):
     42            - Added m_creationParameters, initializeCreationParameters,
     43              creationParameters returns m_creationParameters
     44
    1452013-10-31  Philippe Normand  <pnormand@igalia.com>
    246
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r158034 r158369  
    523523#endif
    524524
    525     m_process->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
     525    initializeCreationParameters();
     526    m_process->send(Messages::WebProcess::CreateWebPage(m_pageID, m_creationParameters), 0);
    526527
    527528#if ENABLE(PAGE_VISIBILITY_API)
     
    38333834}
    38343835
    3835 WebPageCreationParameters WebPageProxy::creationParameters() const
    3836 {
    3837     WebPageCreationParameters parameters;
    3838 
    3839     parameters.viewSize = m_pageClient->viewSize();
    3840     parameters.isActive = m_pageClient->isViewWindowActive();
    3841     parameters.isFocused = m_pageClient->isViewFocused();
    3842     parameters.isVisible = m_pageClient->isViewVisible();
    3843     parameters.isInWindow = m_pageClient->isViewInWindow();
    3844     parameters.drawingAreaType = m_drawingArea->type();
    3845     parameters.store = m_pageGroup->preferences()->store();
    3846     parameters.pageGroupData = m_pageGroup->data();
    3847     parameters.drawsBackground = m_drawsBackground;
    3848     parameters.drawsTransparentBackground = m_drawsTransparentBackground;
    3849     parameters.underlayColor = m_underlayColor;
    3850     parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
    3851     parameters.useFixedLayout = m_useFixedLayout;
    3852     parameters.fixedLayoutSize = m_fixedLayoutSize;
    3853     parameters.suppressScrollbarAnimations = m_suppressScrollbarAnimations;
    3854     parameters.paginationMode = m_paginationMode;
    3855     parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
    3856     parameters.pageLength = m_pageLength;
    3857     parameters.gapBetweenPages = m_gapBetweenPages;
    3858     parameters.userAgent = userAgent();
    3859     parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
    3860     parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
    3861     parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
    3862     parameters.canRunModal = m_canRunModal;
    3863     parameters.deviceScaleFactor = deviceScaleFactor();
    3864     parameters.mediaVolume = m_mediaVolume;
    3865     parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow;
    3866     parameters.minimumLayoutSize = m_minimumLayoutSize;
    3867     parameters.autoSizingShouldExpandToViewHeight = m_autoSizingShouldExpandToViewHeight;
    3868     parameters.scrollPinningBehavior = m_scrollPinningBehavior;
     3836void WebPageProxy::initializeCreationParameters()
     3837{
     3838    m_creationParameters.viewSize = m_pageClient->viewSize();
     3839    m_creationParameters.isActive = m_pageClient->isViewWindowActive();
     3840    m_creationParameters.isFocused = m_pageClient->isViewFocused();
     3841    m_creationParameters.isVisible = m_pageClient->isViewVisible();
     3842    m_creationParameters.isInWindow = m_pageClient->isViewInWindow();
     3843    m_creationParameters.drawingAreaType = m_drawingArea->type();
     3844    m_creationParameters.store = m_pageGroup->preferences()->store();
     3845    m_creationParameters.pageGroupData = m_pageGroup->data();
     3846    m_creationParameters.drawsBackground = m_drawsBackground;
     3847    m_creationParameters.drawsTransparentBackground = m_drawsTransparentBackground;
     3848    m_creationParameters.underlayColor = m_underlayColor;
     3849    m_creationParameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
     3850    m_creationParameters.useFixedLayout = m_useFixedLayout;
     3851    m_creationParameters.fixedLayoutSize = m_fixedLayoutSize;
     3852    m_creationParameters.suppressScrollbarAnimations = m_suppressScrollbarAnimations;
     3853    m_creationParameters.paginationMode = m_paginationMode;
     3854    m_creationParameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
     3855    m_creationParameters.pageLength = m_pageLength;
     3856    m_creationParameters.gapBetweenPages = m_gapBetweenPages;
     3857    m_creationParameters.userAgent = userAgent();
     3858    m_creationParameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
     3859    m_creationParameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
     3860    m_creationParameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
     3861    m_creationParameters.canRunModal = m_canRunModal;
     3862    m_creationParameters.deviceScaleFactor = deviceScaleFactor();
     3863    m_creationParameters.mediaVolume = m_mediaVolume;
     3864    m_creationParameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow;
     3865    m_creationParameters.minimumLayoutSize = m_minimumLayoutSize;
     3866    m_creationParameters.autoSizingShouldExpandToViewHeight = m_autoSizingShouldExpandToViewHeight;
     3867    m_creationParameters.scrollPinningBehavior = m_scrollPinningBehavior;
    38693868
    38703869#if PLATFORM(MAC)
    3871     parameters.layerHostingMode = m_layerHostingMode;
    3872     parameters.colorSpace = m_pageClient->colorSpace();
    3873 #endif
    3874 
    3875     return parameters;
     3870    m_creationParameters.layerHostingMode = m_layerHostingMode;
     3871    m_creationParameters.colorSpace = m_pageClient->colorSpace();
     3872#endif
    38763873}
    38773874
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r158034 r158369  
    5151#include "WebLoaderClient.h"
    5252#include "WebPageContextMenuClient.h"
     53#include "WebPageCreationParameters.h"
    5354#include <WebCore/AlternativeTextClient.h> // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
    5455#include "WebPageProxyMessages.h"
     
    149150struct PlatformPopupMenuData;
    150151struct PrintInfo;
    151 struct WebPageCreationParameters;
    152152struct WebPopupItem;
    153153
     
    629629    void didCancelForOpenPanel();
    630630
    631     WebPageCreationParameters creationParameters() const;
     631    WebPageCreationParameters creationParameters() const
     632    {
     633        return m_creationParameters;
     634    }
    632635
    633636#if USE(COORDINATED_GRAPHICS)
     
    752755    WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
    753756    void platformInitialize();
     757    void initializeCreationParameters();
    754758
    755759    void resetState();
     
    12471251       
    12481252    WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
     1253
     1254    WebPageCreationParameters m_creationParameters;
    12491255};
    12501256
Note: See TracChangeset for help on using the changeset viewer.