Removing line in computeViewportAttributes that enforces a minimum scale factor to...
authorfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 May 2012 23:15:41 +0000 (23:15 +0000)
committerfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 May 2012 23:15:41 +0000 (23:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70609

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Make ViewportAttributes' layoutSize be a FloatRect to avoid rounding
too early, and the occasional off by one fixed layout dimensions.

* dom/ViewportArguments.cpp:
(WebCore::computeViewportAttributes):
* dom/ViewportArguments.h:
(ViewportAttributes):

Source/WebKit/qt:

* Api/qwebpage.h:
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::viewportAsText):

Source/WebKit2:

* UIProcess/API/qt/qwebviewportinfo.cpp:
(QWebViewportInfo::layoutSize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::viewportConfigurationAsText):

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

Source/WebCore/ChangeLog
Source/WebCore/dom/ViewportArguments.cpp
Source/WebCore/dom/ViewportArguments.h
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/Api/qwebpage.h
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 1969f5a..ecb51ea 100644 (file)
@@ -1,3 +1,18 @@
+2012-05-02  Fady Samuel  <fsamuel@chromium.org>
+
+        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
+        https://bugs.webkit.org/show_bug.cgi?id=70609
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make ViewportAttributes' layoutSize be a FloatRect to avoid rounding
+        too early, and the occasional off by one fixed layout dimensions.
+
+        * dom/ViewportArguments.cpp:
+        (WebCore::computeViewportAttributes):
+        * dom/ViewportArguments.h:
+        (ViewportAttributes):
+
 2012-05-02  Joshua Bell  <jsbell@chromium.org>
 
         IndexedDB: Handle generated keys up to 2^53
index c131fcc..0f329ac 100644 (file)
@@ -177,8 +177,8 @@ ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktop
     // Extend width and height to fill the visual viewport for the resolved initial-scale.
     width = max<float>(width, availableWidth / result.initialScale);
     height = max<float>(height, availableHeight / result.initialScale);
-    result.layoutSize.setWidth(static_cast<int>(roundf(width)));
-    result.layoutSize.setHeight(static_cast<int>(roundf(height)));
+    result.layoutSize.setWidth(width);
+    result.layoutSize.setHeight(height);
 
     result.userScalable = args.userScalable;
 
index 59b41de..79651d2 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef ViewportArguments_h
 #define ViewportArguments_h
 
-#include "IntSize.h"
+#include "FloatSize.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -43,7 +43,7 @@ enum ViewportErrorCode {
 };
 
 struct ViewportAttributes {
-    IntSize layoutSize;
+    FloatSize layoutSize;
 
     float devicePixelRatio;
 
index 1c47958..e85dfd2 100644 (file)
@@ -2533,7 +2533,7 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av
     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
 
     result.m_isValid = true;
-    result.m_size = conf.layoutSize;
+    result.m_size = QSizeF(conf.layoutSize.width(), conf.layoutSize.height());
     result.m_initialScaleFactor = conf.initialScale;
     result.m_minimumScaleFactor = conf.minimumScale;
     result.m_maximumScaleFactor = conf.maximumScale;
index fd2fd4b..0bf35e2 100644 (file)
@@ -232,7 +232,7 @@ public:
         inline qreal devicePixelRatio() const { return m_devicePixelRatio; }
         inline bool isUserScalable() const { return m_isUserScalable; }
         inline bool isValid() const { return m_isValid; }
-        inline QSize size() const { return m_size; }
+        inline QSizeF size() const { return m_size; }
 
     private:
         QSharedDataPointer<QtViewportAttributesPrivate> d;
@@ -242,7 +242,7 @@ public:
         qreal m_devicePixelRatio;
         bool m_isUserScalable;
         bool m_isValid;
-        QSize m_size;
+        QSizeF m_size;
 
         friend class WebCore::ChromeClientQt;
         friend class QWebPage;
index 28accfb..780b9a7 100644 (file)
@@ -1,3 +1,14 @@
+2012-05-02  Fady Samuel  <fsamuel@chromium.org>
+
+        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
+        https://bugs.webkit.org/show_bug.cgi?id=70609
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * Api/qwebpage.h:
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::viewportAsText):
+
 2012-05-02  Milian Wolff  <milian.wolff@kdab.com>
 
         [Qt] Pass page-height to PrintContext::begin to fix print layouting
index 63f77d6..f4f42bc 100644 (file)
@@ -810,7 +810,7 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c
     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
 
     QString res;
-    res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
+    res = res.sprintf("viewport size %fx%f scale %f with limits [%f, %f] and userScalable %f\n",
             conf.layoutSize.width(),
             conf.layoutSize.height(),
             conf.initialScale,
index 7033673..41619ae 100644 (file)
@@ -1,3 +1,15 @@
+2012-05-02  Fady Samuel  <fsamuel@chromium.org>
+
+        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
+        https://bugs.webkit.org/show_bug.cgi?id=70609
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * UIProcess/API/qt/qwebviewportinfo.cpp:
+        (QWebViewportInfo::layoutSize):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::viewportConfigurationAsText):
+
 2012-05-02  Emil A Eklund  <eae@chromium.org>
 
         Fix usage of layout types in platform code
index 56b1327..170604d 100644 (file)
@@ -77,7 +77,7 @@ QVariant QWebViewportInfo::isScalable() const
 
 QVariant QWebViewportInfo::layoutSize() const
 {
-    return QSize(m_webViewPrivate->attributes.layoutSize);
+    return QSizeF(m_webViewPrivate->attributes.layoutSize.width(), m_webViewPrivate->attributes.layoutSize.height());
 }
 
 void QWebViewportInfo::didUpdateContentsSize()
index eef0dce..c88ea7f 100644 (file)
@@ -892,7 +892,7 @@ void WebPage::sendViewportAttributesChanged()
 
     ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(), settings->deviceDPI(), m_viewportSize);
 
-    setResizesToContentsUsingLayoutSize(attr.layoutSize);
+    setResizesToContentsUsingLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height())));
     send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
 }
 
@@ -3052,7 +3052,7 @@ String WebPage::viewportConfigurationAsText(int deviceDPI, int deviceWidth, int
     ViewportAttributes attrs = WebCore::computeViewportAttributes(arguments, /* default layout width for non-mobile pages */ 980, deviceWidth, deviceHeight, deviceDPI, IntSize(availableWidth, availableHeight));
     WebCore::restrictMinimumScaleFactorToViewportSize(attrs, IntSize(availableWidth, availableHeight));
     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attrs);
-    return String::format("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale, attrs.userScalable);
+    return String::format("viewport size %fx%f scale %f with limits [%f, %f] and userScalable %f\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale, attrs.userScalable);
 }
 
 void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)