Title: [109288] trunk
Revision
109288
Author
[email protected]
Date
2012-02-29 17:29:56 -0800 (Wed, 29 Feb 2012)

Log Message

[chromium] Add the ability to turn off autoresize.
https://bugs.webkit.org/show_bug.cgi?id=77452

Reviewed by Darin Fisher.

Source/WebCore:

Test: fast/autoresize/turn-off-autoresize.html

* page/FrameView.cpp:
(WebCore::FrameView::enableAutoSizeMode): Fix the code
path for turning off autoresize to set the scrollbars to auto.

Source/WebKit/chromium:

* public/WebView.h:
(WebKit::WebViewImpl::enableAutoResizeMode): Cleaned up the api.
(WebKit::WebViewImpl::disableAutoResizeMode): Added the ability to disable auto-resize.
(WebKit::WebViewImpl::enableAutoResizeMode): Deprecated it.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::enableAutoResizeMode): Adjust for new api.
(WebKit::WebViewImpl::disableAutoResizeMode): Allow turning off autoresize.
(WebKit::WebViewImpl::enableAutoResizeMode): Call the other two apis, but
this api will be deleted shortly.
(WebKit::WebViewImpl::configureAutoResizeMode): Common code.
* src/WebViewImpl.h:
(WebViewImpl): Adjust to new public api.

Tools:

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController): Expose a way to turn off auto-resize.
(LayoutTestController::enableAutoResizeMode): Ditto and adjust to new WebKit api.
(LayoutTestController::disableAutoResizeMode):  Ditto.
* DumpRenderTree/chromium/LayoutTestController.h: Ditto.

LayoutTests:

* fast/autoresize/turn-off-autoresize-expected.txt: Added.
* fast/autoresize/turn-off-autoresize.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109287 => 109288)


--- trunk/LayoutTests/ChangeLog	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/LayoutTests/ChangeLog	2012-03-01 01:29:56 UTC (rev 109288)
@@ -1,3 +1,13 @@
+2012-02-29  David Levin  <[email protected]>
+
+        [chromium] Add the ability to turn off autoresize.
+        https://bugs.webkit.org/show_bug.cgi?id=77452
+
+        Reviewed by Darin Fisher.
+
+        * fast/autoresize/turn-off-autoresize-expected.txt: Added.
+        * fast/autoresize/turn-off-autoresize.html: Added.
+
 2012-02-29  Adam Klein  <[email protected]>
 
         Rebaseline line-grid tests for Chromium after r109267.

Added: trunk/LayoutTests/fast/autoresize/turn-off-autoresize-expected.txt (0 => 109288)


--- trunk/LayoutTests/fast/autoresize/turn-off-autoresize-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/autoresize/turn-off-autoresize-expected.txt	2012-03-01 01:29:56 UTC (rev 109288)
@@ -0,0 +1,15 @@
+This test verifies that turning off auto resize functions correctly. It only works when run in dumprendertree as it relies on having auto-resize function available. 
+
+When it succeeds, there should be a series of PASS messages followed by a DONE message. 
+
+PASS: document.body.clientWidth equaled window.innerWidth
+PASS: document.body.clientHeight equaled window.innerHeight
+PASS: document.body.scrollWidth equaled window.innerWidth
+PASS: document.body.scrollHeight equaled window.innerHeight
+PASS: window.innerWidth equaled window.outerWidth
+PASS: window.innerHeight equaled window.outerHeight
+PASS: window.outerWidth equaled 200
+PASS: window.outerHeight equaled 200
+PASS: window.outerWidth equaled 200
+DONE
+
Property changes on: trunk/LayoutTests/fast/autoresize/turn-off-autoresize-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/autoresize/turn-off-autoresize.html (0 => 109288)


--- trunk/LayoutTests/fast/autoresize/turn-off-autoresize.html	                        (rev 0)
+++ trunk/LayoutTests/fast/autoresize/turn-off-autoresize.html	2012-03-01 01:29:56 UTC (rev 109288)
@@ -0,0 +1,38 @@
+<!doctype html>
+<html>
+<script src=''></script>
+<script>
+function runTest()
+{
+    if (window.layoutTestController) {
+        layoutTestController.enableAutoResizeMode(10, 10, 1000, 1000);
+        layoutTestController.dumpAsText();
+    }
+    shouldBe('document.body.clientWidth', 'window.innerWidth');
+    shouldBe('document.body.clientHeight', 'window.innerHeight');
+    shouldBe('document.body.scrollWidth', 'window.innerWidth');
+    shouldBe('document.body.scrollHeight', 'window.innerHeight');
+    shouldBe('window.innerWidth', 'window.outerWidth');
+    shouldBe('window.innerHeight', 'window.outerHeight');
+    if (window.layoutTestController)
+        layoutTestController.disableAutoResizeMode(200, 200);
+
+    shouldBe('window.outerWidth', 200);
+    shouldBe('window.outerHeight', 200);
+    document.body.style.width = '100px';
+    shouldBe('window.outerWidth', 200);
+
+    log('DONE');
+}
+</script>
+<body _onload_="runTest()" style="margin:0; width:900px">
+This test verifies that turning off auto resize functions correctly. It only works when run in dumprendertree as it relies on having auto-resize function available.
+<br>
+<br>
+When it succeeds, there should be a series of PASS messages followed by a DONE message.
+<br>
+<br>
+<div id='result'>
+</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/autoresize/turn-off-autoresize.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (109287 => 109288)


--- trunk/Source/WebCore/ChangeLog	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Source/WebCore/ChangeLog	2012-03-01 01:29:56 UTC (rev 109288)
@@ -1,3 +1,16 @@
+2012-02-29  David Levin  <[email protected]>
+
+        [chromium] Add the ability to turn off autoresize.
+        https://bugs.webkit.org/show_bug.cgi?id=77452
+
+        Reviewed by Darin Fisher.
+
+        Test: fast/autoresize/turn-off-autoresize.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::enableAutoSizeMode): Fix the code
+        path for turning off autoresize to set the scrollbars to auto.
+
 2012-02-29  David Barton  <[email protected]>
 
         <msubsup> setNeedsLayout() correction

Modified: trunk/Source/WebCore/page/FrameView.cpp (109287 => 109288)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-03-01 01:29:56 UTC (rev 109288)
@@ -3024,11 +3024,15 @@
     m_minAutoSize = minSize;
     m_maxAutoSize = maxSize;
 
-    if (!m_shouldAutoSize)
+    setNeedsLayout();
+    scheduleRelayout();
+    if (m_shouldAutoSize)
         return;
 
-    setNeedsLayout();
-    scheduleRelayout();
+    // Since autosize mode forces the scrollbar mode, change them to being auto.
+    setVerticalScrollbarLock(false);
+    setHorizontalScrollbarLock(false);
+    setScrollbarModes(ScrollbarAuto, ScrollbarAuto);
 }
 
 void FrameView::forceLayout(bool allowSubtree)

Modified: trunk/Source/WebKit/chromium/ChangeLog (109287 => 109288)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-01 01:29:56 UTC (rev 109288)
@@ -1,3 +1,23 @@
+2012-02-29  David Levin  <[email protected]>
+
+        [chromium] Add the ability to turn off autoresize.
+        https://bugs.webkit.org/show_bug.cgi?id=77452
+
+        Reviewed by Darin Fisher.
+
+        * public/WebView.h:
+        (WebKit::WebViewImpl::enableAutoResizeMode): Cleaned up the api.
+        (WebKit::WebViewImpl::disableAutoResizeMode): Added the ability to disable auto-resize.
+        (WebKit::WebViewImpl::enableAutoResizeMode): Deprecated it.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::enableAutoResizeMode): Adjust for new api.
+        (WebKit::WebViewImpl::disableAutoResizeMode): Allow turning off autoresize.
+        (WebKit::WebViewImpl::enableAutoResizeMode): Call the other two apis, but
+        this api will be deleted shortly.
+        (WebKit::WebViewImpl::configureAutoResizeMode): Common code.
+        * src/WebViewImpl.h:
+        (WebViewImpl): Adjust to new public api.
+
 2012-02-29  Sheriff Bot  <[email protected]>
 
         Unreviewed.  Rolled DEPS.

Modified: trunk/Source/WebKit/chromium/public/WebView.h (109287 => 109288)


--- trunk/Source/WebKit/chromium/public/WebView.h	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Source/WebKit/chromium/public/WebView.h	2012-03-01 01:29:56 UTC (rev 109288)
@@ -260,11 +260,18 @@
     // In auto-resize mode, the view is automatically adjusted to fit the html
     // content within the given bounds.
     virtual void enableAutoResizeMode(
+        const WebSize& minSize,
+        const WebSize& maxSize) = 0;
+
+    // Turn off auto-resize.
+    virtual void disableAutoResizeMode() = 0;
+
+    // DEPRECATED
+    virtual void enableAutoResizeMode(
         bool enable,
         const WebSize& minSize,
         const WebSize& maxSize) = 0;
 
-
     // Media ---------------------------------------------------------------
 
     // Performs the specified media player action on the node at the given location.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (109287 => 109288)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-03-01 01:29:56 UTC (rev 109288)
@@ -2264,17 +2264,29 @@
 #endif
 }
 
-void WebViewImpl::enableAutoResizeMode(bool enable, const WebSize& minSize, const WebSize& maxSize)
+
+void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& maxSize)
 {
-    m_shouldAutoResize = enable;
+    m_shouldAutoResize = true;
     m_minAutoSize = minSize;
     m_maxAutoSize = maxSize;
-    if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame()->view())
-        return;
+    configureAutoResizeMode();
+}
 
-    mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_shouldAutoResize, m_minAutoSize, m_maxAutoSize);
+void WebViewImpl::disableAutoResizeMode()
+{
+    m_shouldAutoResize = false;
+    configureAutoResizeMode();
 }
 
+void WebViewImpl::enableAutoResizeMode(bool enable, const WebSize& minSize, const WebSize& maxSize)
+{
+    if (enable)
+        enableAutoResizeMode(enable, minSize, maxSize);
+    else
+        disableAutoResizeMode();
+}
+
 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScale)
 {
     m_pageDefinedMinimumPageScaleFactor = minPageScale;
@@ -2585,6 +2597,14 @@
     }
 }
 
+void WebViewImpl::configureAutoResizeMode()
+{
+    if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame()->view())
+        return;
+
+    mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_shouldAutoResize, m_minAutoSize, m_maxAutoSize);
+}
+
 unsigned long WebViewImpl::createUniqueIdentifierForRequest()
 {
     if (m_page)

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (109287 => 109288)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-03-01 01:29:56 UTC (rev 109288)
@@ -188,6 +188,10 @@
     virtual WebSize fixedLayoutSize() const;
     virtual void setFixedLayoutSize(const WebSize&);
     virtual void enableAutoResizeMode(
+        const WebSize& minSize,
+        const WebSize& maxSize);
+    virtual void disableAutoResizeMode();
+    virtual void enableAutoResizeMode(
         bool enable,
         const WebSize& minSize,
         const WebSize& maxSize);
@@ -534,6 +538,7 @@
                                                DragAction);
 
     void sendResizeEventAndRepaint();
+    void configureAutoResizeMode();
 
 #if USE(ACCELERATED_COMPOSITING)
     void setIsAcceleratedCompositingActive(bool);

Modified: trunk/Tools/ChangeLog (109287 => 109288)


--- trunk/Tools/ChangeLog	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Tools/ChangeLog	2012-03-01 01:29:56 UTC (rev 109288)
@@ -1,3 +1,16 @@
+2012-02-29  David Levin  <[email protected]>
+
+        [chromium] Add the ability to turn off autoresize.
+        https://bugs.webkit.org/show_bug.cgi?id=77452
+
+        Reviewed by Darin Fisher.
+
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController): Expose a way to turn off auto-resize.
+        (LayoutTestController::enableAutoResizeMode): Ditto and adjust to new WebKit api.
+        (LayoutTestController::disableAutoResizeMode):  Ditto.
+        * DumpRenderTree/chromium/LayoutTestController.h: Ditto.
+
 2012-02-29  Dirk Pranke  <[email protected]>
 
         nrwt: make --print trace work with virtual tests

Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (109287 => 109288)


--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2012-03-01 01:29:56 UTC (rev 109288)
@@ -104,6 +104,7 @@
 #if ENABLE(POINTER_LOCK)
     bindMethod("didLosePointerLock", &LayoutTestController::didLosePointerLock);
 #endif
+    bindMethod("disableAutoResizeMode", &LayoutTestController::disableAutoResizeMode);
     bindMethod("disableImageLoading", &LayoutTestController::disableImageLoading);
     bindMethod("display", &LayoutTestController::display);
     bindMethod("displayInvalidatedRegion", &LayoutTestController::displayInvalidatedRegion);
@@ -1129,10 +1130,26 @@
     int maxHeight = cppVariantToInt32(arguments[3]);
     WebKit::WebSize maxSize(maxWidth, maxHeight);
 
-    m_shell->webView()->enableAutoResizeMode(true, minSize, maxSize);
+    m_shell->webView()->enableAutoResizeMode(minSize, maxSize);
     result->set(true);
 }
 
+void LayoutTestController::disableAutoResizeMode(const CppArgumentList& arguments, CppVariant* result)
+{
+    if (arguments.size() !=2) {
+        result->set(false);
+        return;
+    }
+    int newWidth = cppVariantToInt32(arguments[0]);
+    int newHeight = cppVariantToInt32(arguments[1]);
+    WebKit::WebSize newSize(newWidth, newHeight);
+
+    m_shell->webViewHost()->setWindowRect(WebRect(0, 0, newSize.width, newSize.height));
+    m_shell->webView()->disableAutoResizeMode();
+    m_shell->webView()->resize(newSize);
+    result->set(true);
+}
+
 void LayoutTestController::numberOfActiveAnimations(const CppArgumentList&, CppVariant* result)
 {
     result->set(numberOfActiveAnimations());

Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (109287 => 109288)


--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h	2012-03-01 01:26:15 UTC (rev 109287)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h	2012-03-01 01:29:56 UTC (rev 109288)
@@ -241,6 +241,7 @@
     void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
     void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*);
     void enableAutoResizeMode(const CppArgumentList&, CppVariant*);
+    void disableAutoResizeMode(const CppArgumentList&, CppVariant*);
     void numberOfActiveAnimations(const CppArgumentList&, CppVariant*);
     void suspendAnimations(const CppArgumentList&, CppVariant*);
     void resumeAnimations(const CppArgumentList&, CppVariant*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to