Title: [101259] trunk
Revision
101259
Author
[email protected]
Date
2011-11-28 06:45:26 -0800 (Mon, 28 Nov 2011)

Log Message

Make sure the useFixedLayout feature is consistently handled
https://bugs.webkit.org/show_bug.cgi?id=73212

Reviewed by Simon Hausmann.

Source/WebKit2:

Set the fixed layout on the UI side so that it is part of the page
creation parameters and ensure that the page parameters are set
before creating the page.

The parameters are set to our defaults and are now altered in the
WebKitTestRunner.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
(QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
(QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour):
(QQuickWebView::QQuickWebView):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setUseFixedLayout):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):

    On the web process side the default value for useFixedLayout
    wasn't actually read from the creation parameters. As it now may
    be different than that of the FrameView, we now call
    setFixedLayout in the constructor so make sure the value is
    propagated to the FrameView.

(WebKit::WebPage::setFixedVisibleContentRect):
(WebKit::WebPage::setResizesToContentsUsingLayoutSize):
(WebKit::WebPage::resizeToContentsIfNeeded):
(WebKit::WebPage::setViewportSize):
(WebKit::WebPage::setUseFixedLayout):
(WebKit::WebPage::setFixedLayoutSize):

    The methods that depends on fixed layout now have asserts to make
    sure that they are used properly.

Tools:

The web page parameters are set to our Qt defaults and are now altered
in the WebKitTestRunner.

* WebKitTestRunner/qt/PlatformWebViewQt.cpp:
(WTR::WrapperWindow::WrapperWindow):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (101258 => 101259)


--- trunk/Source/WebKit2/ChangeLog	2011-11-28 14:44:29 UTC (rev 101258)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-28 14:45:26 UTC (rev 101259)
@@ -1,3 +1,43 @@
+2011-11-28  Kenneth Rohde Christiansen  <[email protected]>
+
+        Make sure the useFixedLayout feature is consistently handled
+        https://bugs.webkit.org/show_bug.cgi?id=73212
+
+        Reviewed by Simon Hausmann.
+
+        Set the fixed layout on the UI side so that it is part of the page
+        creation parameters and ensure that the page parameters are set
+        before creating the page.
+
+        The parameters are set to our defaults and are now altered in the
+        WebKitTestRunner.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        (QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour):
+        (QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour):
+        (QQuickWebView::QQuickWebView):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setUseFixedLayout):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+
+            On the web process side the default value for useFixedLayout
+            wasn't actually read from the creation parameters. As it now may
+            be different than that of the FrameView, we now call
+            setFixedLayout in the constructor so make sure the value is
+            propagated to the FrameView.
+
+        (WebKit::WebPage::setFixedVisibleContentRect):
+        (WebKit::WebPage::setResizesToContentsUsingLayoutSize):
+        (WebKit::WebPage::resizeToContentsIfNeeded):
+        (WebKit::WebPage::setViewportSize):
+        (WebKit::WebPage::setUseFixedLayout):
+        (WebKit::WebPage::setFixedLayoutSize):
+
+            The methods that depends on fixed layout now have asserts to make
+            sure that they are used properly.
+
 2011-11-28  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Rename WebKitNetworkRequest to WebKitURIRequest

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (101258 => 101259)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2011-11-28 14:44:29 UTC (rev 101258)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2011-11-28 14:45:26 UTC (rev 101259)
@@ -43,7 +43,6 @@
     , promptDialog(0)
     , postTransitionState(adoptPtr(new PostTransitionState(this)))
     , transitioningToNewPage(false)
-    , useTraditionalDesktopBehaviour(false)
 {
     viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
 
@@ -54,14 +53,17 @@
     setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, contextRef, pageGroupRef));
     pageViewPrivate->setPageProxy(pageProxy.data());
 
+    pageLoadClient.reset(new QtWebPageLoadClient(pageProxy->pageRef(), q_ptr));
+    pagePolicyClient.reset(new QtWebPagePolicyClient(pageProxy->pageRef(), q_ptr));
+    pageUIClient.reset(new QtWebPageUIClient(pageProxy->pageRef(), q_ptr));
     eventHandler.reset(new QtWebPageEventHandler(pageProxy->pageRef()));
 
+    // Any page setting should preferrable be set before creating the page, so set them here:
+    setUseTraditionalDesktopBehaviour(false);
     QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true);
+
+    // Creates a page with the page creation parameters.
     pageProxy->init(eventHandler.data());
-
-    pageLoadClient.reset(new QtWebPageLoadClient(pageProxy->pageRef(), q_ptr));
-    pagePolicyClient.reset(new QtWebPagePolicyClient(pageProxy->pageRef(), q_ptr));
-    pageUIClient.reset(new QtWebPageUIClient(pageProxy->pageRef(), q_ptr));
 }
 
 void QQuickWebViewPrivate::enableMouseEvents()
@@ -329,9 +331,11 @@
 void QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour(bool enable)
 {
     Q_Q(QQuickWebView);
-    if (enable == useTraditionalDesktopBehaviour)
-        return;
 
+    // Do not guard, testing for the same value, as we call this from the constructor.
+
+    toImpl(pageProxy->pageRef())->setUseFixedLayout(!enable);
+
     useTraditionalDesktopBehaviour = enable;
     if (useTraditionalDesktopBehaviour)
         initializeDesktop(q);
@@ -394,6 +398,10 @@
 void QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour(bool enable)
 {
     Q_D(QQuickWebView);
+
+    if (enable == d->useTraditionalDesktopBehaviour)
+        return;
+
     d->setUseTraditionalDesktopBehaviour(enable);
 }
 
@@ -462,9 +470,6 @@
     , d_ptr(new QQuickWebViewPrivate(this, contextRef, pageGroupRef))
     , m_experimental(new QQuickWebViewExperimental(this))
 {
-    Q_D(QQuickWebView);
-    // Used by WebKitTestRunner.
-    d->setUseTraditionalDesktopBehaviour(true);
 }
 
 QQuickWebView::~QQuickWebView()

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (101258 => 101259)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-11-28 14:44:29 UTC (rev 101258)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-11-28 14:45:26 UTC (rev 101259)
@@ -1261,6 +1261,8 @@
     if (!isValid())
         return;
 
+    // This check is fine as the value is initialized in the web
+    // process as part of the creation parameters.
     if (fixed == m_useFixedLayout)
         return;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (101258 => 101259)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-11-28 14:44:29 UTC (rev 101258)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-11-28 14:45:26 UTC (rev 101259)
@@ -172,7 +172,6 @@
 
 WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     : m_viewSize(parameters.viewSize)
-    , m_useFixedLayout(false)
     , m_drawsBackground(true)
     , m_drawsTransparentBackground(false)
     , m_isInRedo(false)
@@ -239,6 +238,8 @@
 
     m_mainFrame = WebFrame::createMainFrame(this);
 
+    setUseFixedLayout(parameters.useFixedLayout);
+
     setDrawsBackground(parameters.drawsBackground);
     setDrawsTransparentBackground(parameters.drawsTransparentBackground);
 
@@ -700,6 +701,8 @@
 #if USE(TILED_BACKING_STORE)
 void WebPage::setFixedVisibleContentRect(const IntRect& rect)
 {
+    ASSERT(m_useFixedLayout);
+
     Frame* frame = m_page->mainFrame();
 
     frame->view()->setFixedVisibleContentRect(rect);
@@ -707,15 +710,15 @@
 
 void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSize)
 {
+    ASSERT(m_useFixedLayout);
+    ASSERT(!targetLayoutSize.isEmpty());
+
     FrameView* view = m_page->mainFrame()->view();
 
-    m_useFixedLayout = !targetLayoutSize.isEmpty();
+    view->setDelegatesScrolling(true);
+    view->setUseFixedLayout(true);
+    view->setPaintsEntireContents(true);
 
-    // Set view attributes based on whether fixed layout is used.
-    view->setDelegatesScrolling(m_useFixedLayout);
-    view->setUseFixedLayout(m_useFixedLayout);
-    view->setPaintsEntireContents(m_useFixedLayout);
-
     if (view->fixedLayoutSize() == targetLayoutSize)
         return;
 
@@ -731,6 +734,8 @@
 
 void WebPage::resizeToContentsIfNeeded()
 {
+    ASSERT(m_useFixedLayout);
+
     FrameView* view = m_page->mainFrame()->view();
 
     if (!view->useFixedLayout())
@@ -747,6 +752,8 @@
 
 void WebPage::setViewportSize(const IntSize& size)
 {
+    ASSERT(m_useFixedLayout);
+
     if (m_viewportSize == size)
         return;
 
@@ -896,11 +903,7 @@
 {
     m_useFixedLayout = fixed;
 
-    Frame* frame = m_mainFrame->coreFrame();
-    if (!frame)
-        return;
-
-    FrameView* view = frame->view();
+    FrameView* view = mainFrameView();
     if (!view)
         return;
 
@@ -911,11 +914,7 @@
 
 void WebPage::setFixedLayoutSize(const IntSize& size)
 {
-    Frame* frame = m_mainFrame->coreFrame();
-    if (!frame)
-        return;
-    
-    FrameView* view = frame->view();
+    FrameView* view = mainFrameView();
     if (!view)
         return;
 

Modified: trunk/Tools/ChangeLog (101258 => 101259)


--- trunk/Tools/ChangeLog	2011-11-28 14:44:29 UTC (rev 101258)
+++ trunk/Tools/ChangeLog	2011-11-28 14:45:26 UTC (rev 101259)
@@ -1,3 +1,16 @@
+2011-11-28  Kenneth Rohde Christiansen  <[email protected]>
+
+        Make sure the useFixedLayout feature is consistently handled
+        https://bugs.webkit.org/show_bug.cgi?id=73212
+
+        Reviewed by Simon Hausmann.
+
+        The web page parameters are set to our Qt defaults and are now altered
+        in the WebKitTestRunner.
+
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+        (WTR::WrapperWindow::WrapperWindow):
+
 2011-11-28  Simon Hausmann  <[email protected]>
 
         [Qt] WTF should be built as separate static library

Modified: trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp (101258 => 101259)


--- trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp	2011-11-28 14:44:29 UTC (rev 101258)
+++ trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp	2011-11-28 14:45:26 UTC (rev 101259)
@@ -44,6 +44,7 @@
         : QQuickView(QUrl("data:text/plain,import QtQuick 2.0\nItem { objectName: 'root' }"))
         , m_view(view)
     {
+        QQuickWebViewExperimental(view).setUseTraditionalDesktopBehaviour(true);
         connect(this, SIGNAL(statusChanged(QQuickView::Status)), SLOT(handleStatusChanged(QQuickView::Status)));
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to