[WK2] Remove m_viewportSize in WebPage.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Feb 2013 18:23:42 +0000 (18:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Feb 2013 18:23:42 +0000 (18:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110311

Patch by Huang Dongsung <luxtella@company100.net> on 2013-02-20
Reviewed by Anders Carlsson.

EFL and Qt use m_viewSize as a contents size while Apple use it as a viewport
size, so EFL and Qt introduced m_viewportSize to make WebPage know a viewport
size.

EFL and Qt use m_viewSize as a contents size because the size of non compositing
layer is contents size, and EFL and Qt mark whole non compositing layer as dirty
using m_viewSize. Bug 110299 (http://webkit.org/b/110299) changes that it is not
necessary to know m_viewSize when marking whole non compositing layer as dirty.
So we can make EFL and Qt use m_viewSize as a viewport size also.

This patch removes m_viewportSize and related methods to increase readability.

* UIProcess/API/qt/raw/qrawwebview.cpp:
(QRawWebView::setSize):
* UIProcess/PageViewportController.cpp:
(WebKit::PageViewportController::didChangeViewportSize):
* UIProcess/WebPageProxy.cpp:
(WebKit):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::pageRect):
(WebKit::WebChromeClient::contentsSizeChanged):
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::updateBackingStoreState):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setSize):
(WebKit::WebPage::sendViewportAttributesChanged):
* WebProcess/WebPage/WebPage.h:
(WebPage):
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143474 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
Source/WebKit2/UIProcess/PageViewportController.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 235e11aeeadbd4d0d5c8845651cad4d30cab3ebc..bc77ec251f47d2bae75e1ea009fdd733f8a50d4a 100644 (file)
@@ -1,3 +1,42 @@
+2013-02-20  Huang Dongsung  <luxtella@company100.net>
+
+        [WK2] Remove m_viewportSize in WebPage.
+        https://bugs.webkit.org/show_bug.cgi?id=110311
+
+        Reviewed by Anders Carlsson.
+
+        EFL and Qt use m_viewSize as a contents size while Apple use it as a viewport
+        size, so EFL and Qt introduced m_viewportSize to make WebPage know a viewport
+        size.
+
+        EFL and Qt use m_viewSize as a contents size because the size of non compositing
+        layer is contents size, and EFL and Qt mark whole non compositing layer as dirty
+        using m_viewSize. Bug 110299 (http://webkit.org/b/110299) changes that it is not
+        necessary to know m_viewSize when marking whole non compositing layer as dirty.
+        So we can make EFL and Qt use m_viewSize as a viewport size also.
+
+        This patch removes m_viewportSize and related methods to increase readability.
+
+        * UIProcess/API/qt/raw/qrawwebview.cpp:
+        (QRawWebView::setSize):
+        * UIProcess/PageViewportController.cpp:
+        (WebKit::PageViewportController::didChangeViewportSize):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::pageRect):
+        (WebKit::WebChromeClient::contentsSizeChanged):
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::updateBackingStoreState):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setSize):
+        (WebKit::WebPage::sendViewportAttributesChanged):
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2013-02-20  Huang Dongsung  <luxtella@company100.net>
 
         [WK2] add setNeedsDisplay in DrawingArea to mark whole layer as dirty.
index 38991ddf65c1c3e3c716a6d609dcd7fc9202d04d..4aa353377f1427c516e95e9bb7babb66845a92d7 100644 (file)
@@ -344,7 +344,7 @@ void QRawWebView::setSize(const QSize& size)
         return;
 
     if (d->m_webPageProxy->useFixedLayout())
-        d->m_webPageProxy->setViewportSize(size);
+        drawingArea->setSize(size, WebCore::IntSize());
 
     d->m_size = size;
 
index 1a9bde6de5c7532b3b8c7f91cd45c0686ed56d30..0f6bd2230eefe44e53bfcd3602d691b135427727 100644 (file)
@@ -251,7 +251,7 @@ void PageViewportController::didChangeViewportSize(const FloatSize& newSize)
 
     // Let the WebProcess know about the new viewport size, so that
     // it can resize the content accordingly.
-    m_webPageProxy->setViewportSize(roundedIntSize(newSize));
+    m_webPageProxy->drawingArea()->setSize(roundedIntSize(newSize), IntSize());
 }
 
 void PageViewportController::didChangeContentsVisibility(const FloatPoint& position, float scale, const FloatPoint& trajectoryVector)
index 427935290ff1c98fd65ad4d81aabd42cbf59bb98..2c3ec0fbc84b7874da302401bfa4434e1da3674a 100644 (file)
@@ -1007,14 +1007,6 @@ void WebPageProxy::executeEditCommand(const String& commandName)
 }
     
 #if USE(TILED_BACKING_STORE)
-void WebPageProxy::setViewportSize(const IntSize& size)
-{
-    if (!isValid())
-        return;
-
-    m_process->send(Messages::WebPage::SetViewportSize(size), m_pageID);
-}
-
 void WebPageProxy::commitPageTransitionViewport()
 {
     if (!isValid())
index 36a02bef9252c7de78b3509e5d7e812782c2b289..c806b9b0be04d7e42076ecefc78e112e56d2b2e2 100644 (file)
@@ -419,7 +419,6 @@ public:
     PlatformWidget viewWidget();
 #endif
 #if USE(TILED_BACKING_STORE)
-    void setViewportSize(const WebCore::IntSize&);
     void commitPageTransitionViewport();
 #endif
 
index dfaba8b56d1ed028abf4ac0bf295ecd4ee17b885..d5b67fcd0397b9358a9b54945b45a0443dc455a4 100644 (file)
@@ -119,11 +119,7 @@ FloatRect WebChromeClient::windowRect()
 
 FloatRect WebChromeClient::pageRect()
 {
-#if USE(TILED_BACKING_STORE)
-    return FloatRect(FloatPoint(), m_page->viewportSize());
-#else
     return FloatRect(FloatPoint(), m_page->size());
-#endif
 }
 
 void WebChromeClient::focus()
@@ -446,14 +442,11 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con
     if (frame->page()->mainFrame() != frame)
         return;
 
-#if PLATFORM(QT) || PLATFORM(EFL)
-    if (m_page->useFixedLayout()) {
-        // The below method updates the size().
-        m_page->resizeToContentsIfNeeded();
-        m_page->drawingArea()->layerTreeHost()->sizeDidChange(m_page->size());
-    }
+#if USE(COORDINATED_GRAPHICS)
+    if (m_page->useFixedLayout())
+        m_page->drawingArea()->layerTreeHost()->sizeDidChange(size);
 
-    m_page->send(Messages::WebPageProxy::DidChangeContentsSize(m_page->size()));
+    m_page->send(Messages::WebPageProxy::DidChangeContentsSize(size));
 #endif
 
     m_page->drawingArea()->mainFrameContentSizeChanged(size);
index 7f7a2e8116240cfe2175e2747279393eda61ceb7..6c5cb2d13091776ae33e36c38b8450907838f0ac 100644 (file)
@@ -394,9 +394,11 @@ void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImme
         m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
 
         if (m_layerTreeHost) {
-            // Use the previously set page size instead of the argument.
-            // It gets adjusted properly when using the fixed layout mode.
-            m_layerTreeHost->sizeDidChange(m_webPage->size());
+#if USE(COORDINATED_GRAPHICS)
+            // Coordinated Graphics sets the size of the root layer to contents size.
+            if (!m_webPage->useFixedLayout())
+#endif
+                m_layerTreeHost->sizeDidChange(m_webPage->size());
         } else
             m_dirtyRegion = m_webPage->bounds();
     } else {
index ed58d580311bdc8a10fa5dc601a98d281788517c..85e9c9c60fa00871655e830e47f40a9021399dbd 100644 (file)
@@ -979,12 +979,6 @@ void WebPage::setSize(const WebCore::IntSize& viewSize)
 {
     FrameView* view = m_page->mainFrame()->view();
 
-#if USE(TILED_BACKING_STORE)
-    // If we are resizing to content ignore external attempts.
-    if (view->useFixedLayout())
-        return;
-#endif
-
     if (m_viewSize == viewSize)
         return;
 
@@ -993,6 +987,11 @@ void WebPage::setSize(const WebCore::IntSize& viewSize)
     m_drawingArea->setNeedsDisplay();
     
     m_viewSize = viewSize;
+
+#if USE(TILED_BACKING_STORE)
+    if (view->useFixedLayout())
+        sendViewportAttributesChanged();
+#endif
 }
 
 #if USE(TILED_BACKING_STORE)
@@ -1003,43 +1002,24 @@ void WebPage::setFixedVisibleContentRect(const IntRect& rect)
     m_page->mainFrame()->view()->setFixedVisibleContentRect(rect);
 }
 
-void WebPage::resizeToContentsIfNeeded()
-{
-    ASSERT(m_useFixedLayout);
-
-    FrameView* view = m_page->mainFrame()->view();
-
-    if (!view->useFixedLayout())
-        return;
-
-    IntSize newSize = view->contentsSize().expandedTo(view->fixedLayoutSize());
-
-    if (newSize == m_viewSize)
-        return;
-
-    m_viewSize = newSize;
-    view->resize(newSize);
-    view->setNeedsLayout();
-}
-
 void WebPage::sendViewportAttributesChanged()
 {
     ASSERT(m_useFixedLayout);
 
     // Viewport properties have no impact on zero sized fixed viewports.
-    if (m_viewportSize.isEmpty())
+    if (m_viewSize.isEmpty())
         return;
 
     // Recalculate the recommended layout size, when the available size (device pixel) changes.
     Settings* settings = m_page->settings();
 
-    int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_viewportSize.width());
+    int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_viewSize.width());
 
     // If unset  we use the viewport dimensions. This fits with the behavior of desktop browsers.
-    int deviceWidth = (settings->deviceWidth() > 0) ? settings->deviceWidth() : m_viewportSize.width();
-    int deviceHeight = (settings->deviceHeight() > 0) ? settings->deviceHeight() : m_viewportSize.height();
+    int deviceWidth = (settings->deviceWidth() > 0) ? settings->deviceWidth() : m_viewSize.width();
+    int deviceHeight = (settings->deviceHeight() > 0) ? settings->deviceHeight() : m_viewSize.height();
 
-    ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, 1, m_viewportSize);
+    ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, 1, m_viewSize);
 
     FrameView* view = m_page->mainFrame()->view();
 
@@ -1048,7 +1028,7 @@ void WebPage::sendViewportAttributesChanged()
 
     // Put the width and height to the viewport width and height. In css units however.
     // Use FloatSize to avoid truncated values during scale.
-    FloatSize contentFixedSize = m_viewportSize;
+    FloatSize contentFixedSize = m_viewSize;
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)
     // CSS viewport descriptors might be applied to already affected viewport size
@@ -1066,19 +1046,6 @@ void WebPage::sendViewportAttributesChanged()
 
     send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
 }
-
-void WebPage::setViewportSize(const IntSize& size)
-{
-    ASSERT(m_useFixedLayout);
-
-    if (m_viewportSize == size)
-        return;
-
-    m_viewportSize = size;
-
-    sendViewportAttributesChanged();
-}
-
 #endif
 
 void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffset)
index 92a2e4e38e3a225d209e8b9ab8d005efbfa3a805..b3ab93bc66b6e7a6d5272e68184027d161dfc5d8 100644 (file)
@@ -377,10 +377,7 @@ public:
 #if USE(TILED_BACKING_STORE)
     void pageDidRequestScroll(const WebCore::IntPoint&);
     void setFixedVisibleContentRect(const WebCore::IntRect&);
-    void resizeToContentsIfNeeded();
     void sendViewportAttributesChanged();
-    void setViewportSize(const WebCore::IntSize&);
-    WebCore::IntSize viewportSize() const { return m_viewportSize; }
 #endif
 
 #if ENABLE(CONTEXT_MENUS)
@@ -874,10 +871,6 @@ private:
 #endif
     InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
 
-#if USE(TILED_BACKING_STORE)
-    WebCore::IntSize m_viewportSize;
-#endif
-
     FindController m_findController;
 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
     TapHighlightController m_tapHighlightController;
index b34db5c4e8519c101eec001725009b2660d259c9..7d9d378ba03ce57a5146a2c7e3abe1fbe1064895 100644 (file)
@@ -116,10 +116,6 @@ messages -> WebPage LegacyReceiver {
     SuspendActiveDOMObjectsAndAnimations()
     ResumeActiveDOMObjectsAndAnimations()
 
-#if USE(TILED_BACKING_STORE)
-    SetViewportSize(WebCore::IntSize size)
-#endif
-
     Close()
     TryClose()