Title: [101167] trunk/Source/WebKit2
Revision
101167
Author
kenn...@webkit.org
Date
2011-11-25 05:53:11 -0800 (Fri, 25 Nov 2011)

Log Message

Clean up code in WK2/ChromeClientClient related to viewport handling
https://bugs.webkit.org/show_bug.cgi?id=73128

Reviewed by Simon Hausmann.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentsSizeChanged):

    Make sure that we only call resizeToContentsIfNeeded when we are
    using the tiled backing store and fixed layout as well.

    Guard the scrollbar code so that it is only called when scroll
    delegation is not used. Do similarily for the frameset code,
    which makes no sense with frame flattening.

(WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):

    This method is only called for the main frame, so the main frame
    check has been removed.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (101166 => 101167)


--- trunk/Source/WebKit2/ChangeLog	2011-11-25 13:39:37 UTC (rev 101166)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-25 13:53:11 UTC (rev 101167)
@@ -1,3 +1,25 @@
+2011-11-25  Kenneth Rohde Christiansen  <kenn...@webkit.org>
+
+        Clean up code in WK2/ChromeClientClient related to viewport handling
+        https://bugs.webkit.org/show_bug.cgi?id=73128
+
+        Reviewed by Simon Hausmann.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::contentsSizeChanged):
+
+            Make sure that we only call resizeToContentsIfNeeded when we are
+            using the tiled backing store and fixed layout as well.
+
+            Guard the scrollbar code so that it is only called when scroll
+            delegation is not used. Do similarily for the frameset code,
+            which makes no sense with frame flattening.
+
+        (WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):
+
+            This method is only called for the main frame, so the main frame
+            check has been removed.
+
 2011-11-25  Simon Hausmann  <simon.hausm...@nokia.com>
 
         [Qt] Eliminate warnings about the deprecated QQuickCanvas::sceneGraphEngine() function.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (101166 => 101167)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-11-25 13:39:37 UTC (rev 101166)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-11-25 13:53:11 UTC (rev 101167)
@@ -427,40 +427,35 @@
 
 void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
 {
-#if PLATFORM(QT)
-#if USE(TILED_BACKING_STORE)
-    if (frame->page()->mainFrame() == frame)
-        m_page->resizeToContentsIfNeeded();
-#endif
+    if (!m_page->corePage()->settings()->frameFlatteningEnabled()) {
+        WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
+        if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
+            m_cachedFrameSetLargestFrame = largestFrame;
+            m_page->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0));
+        }
+    }
 
-    WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
-
-    if (!m_page->mainWebFrame() || m_page->mainWebFrame() != webFrame)
+    if (frame->page()->mainFrame() != frame)
         return;
 
+#if PLATFORM(QT)
     m_page->send(Messages::WebPageProxy::DidChangeContentsSize(size));
+
+    if (m_page->useFixedLayout())
+        m_page->resizeToContentsIfNeeded();
 #endif
 
-    WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
-    if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
-        m_cachedFrameSetLargestFrame = largestFrame;
-        m_page->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0));
-    }
-
-    if (frame->page()->mainFrame() != frame)
-        return;
     FrameView* frameView = frame->view();
-    if (!frameView)
-        return;
+    if (frameView && !frameView->delegatesScrolling())  {
+        bool hasHorizontalScrollbar = frameView->horizontalScrollbar();
+        bool hasVerticalScrollbar = frameView->verticalScrollbar();
 
-    bool hasHorizontalScrollbar = frameView->horizontalScrollbar();
-    bool hasVerticalScrollbar = frameView->verticalScrollbar();
+        if (hasHorizontalScrollbar != m_cachedMainFrameHasHorizontalScrollbar || hasVerticalScrollbar != m_cachedMainFrameHasVerticalScrollbar) {
+            m_page->send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar));
 
-    if (hasHorizontalScrollbar != m_cachedMainFrameHasHorizontalScrollbar || hasVerticalScrollbar != m_cachedMainFrameHasVerticalScrollbar) {
-        m_page->send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar));
-        
-        m_cachedMainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
-        m_cachedMainFrameHasVerticalScrollbar = hasVerticalScrollbar;
+            m_cachedMainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
+            m_cachedMainFrameHasVerticalScrollbar = hasVerticalScrollbar;
+        }
     }
 }
 
@@ -747,13 +742,13 @@
 
 #if USE(TILED_BACKING_STORE)
     // When viewport properties change, recalculate and set the new recommended layout size in case of fixed layout rendering.
-    if (m_page->mainFrameView() && m_page->mainFrameView()->useFixedLayout()) {
-        Page* page = m_page->corePage();
-        Settings* settings = page->settings();
+    if (m_page->useFixedLayout()) {
+        Settings* settings = m_page->corePage()->settings();
 
         int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_page->viewportSize().width());
 
-        IntSize targetLayoutSize = computeViewportAttributes(page->viewportArguments(), minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(),
+        IntSize targetLayoutSize = computeViewportAttributes(m_page->corePage()->viewportArguments(),
+            minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(),
             settings->deviceDPI(), m_page->viewportSize()).layoutSize;
         m_page->setResizesToContentsUsingLayoutSize(targetLayoutSize);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to