Title: [99195] trunk/Source
Revision
99195
Author
[email protected]
Date
2011-11-03 08:22:16 -0700 (Thu, 03 Nov 2011)

Log Message

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.

Source/WebCore:

Operations in computeViewportAttributes that are not a part of the spec:

http://www.w3.org/TR/2011/WD-css-device-adapt-20110915/#constraining-viewport-property-values

were moved into the functions restrictMinimumScaleFactorToViewportSize and
restrictScaleFactorToInitialScaleIfNotUserScalable.

* WebCore.exp.in:
* dom/ViewportArguments.cpp:
(WebCore::computeViewportAttributes):
(WebCore::restrictMinimumScaleFactorToViewportSize):
(WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable):
* dom/ViewportArguments.h:

Source/WebKit/efl:

* ewk/ewk_view.cpp:
(_ewk_view_viewport_attributes_compute):

Source/WebKit/gtk:

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::dumpConfigurationForViewport):
* webkit/webkitviewportattributes.cpp:
(webkitViewportAttributesRecompute):

Source/WebKit/qt:

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

Source/WebKit2:

* UIProcess/API/qt/qtouchwebview.cpp:
(QTouchWebViewPrivate::updateViewportConstraints):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::viewportConfigurationAsText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99194 => 99195)


--- trunk/Source/WebCore/ChangeLog	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebCore/ChangeLog	2011-11-03 15:22:16 UTC (rev 99195)
@@ -1,3 +1,24 @@
+2011-11-03  Fady Samuel  <[email protected]>
+
+        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.
+
+        Operations in computeViewportAttributes that are not a part of the spec: 
+
+        http://www.w3.org/TR/2011/WD-css-device-adapt-20110915/#constraining-viewport-property-values
+
+        were moved into the functions restrictMinimumScaleFactorToViewportSize and
+        restrictScaleFactorToInitialScaleIfNotUserScalable.
+
+        * WebCore.exp.in:
+        * dom/ViewportArguments.cpp:
+        (WebCore::computeViewportAttributes):
+        (WebCore::restrictMinimumScaleFactorToViewportSize):
+        (WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable):
+        * dom/ViewportArguments.h:
+
 2011-11-03  Andreas Kling  <[email protected]>
 
         Unreviewed build fix, sigh.

Modified: trunk/Source/WebCore/WebCore.exp.in (99194 => 99195)


--- trunk/Source/WebCore/WebCore.exp.in	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-11-03 15:22:16 UTC (rev 99195)
@@ -652,6 +652,8 @@
 __ZN7WebCore25PluginMainThreadScheduler9schedulerEv
 __ZN7WebCore25addLanguageChangeObserverEPvPFvS0_E
 __ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiiiNS_7IntSizeE
+__ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE
+__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
 __ZN7WebCore25contextMenuItemTagOutlineEv
 __ZN7WebCore26CSSMutableStyleDeclarationC1Ev
 __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv

Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (99194 => 99195)


--- trunk/Source/WebCore/dom/ViewportArguments.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -180,17 +180,30 @@
     result.layoutSize.setWidth(static_cast<int>(roundf(width)));
     result.layoutSize.setHeight(static_cast<int>(roundf(height)));
 
-    // Update minimum scale factor, to never allow zooming out more than viewport
-    result.minimumScale = max<float>(result.minimumScale, max(availableWidth / width, availableHeight / height));
-
     result.userScalable = args.userScalable;
-    // Make maximum and minimum scale equal to the initial scale if user is not allowed to zoom in/out.
-    if (!args.userScalable)
-        result.maximumScale = result.minimumScale = result.initialScale;
 
     return result;
 }
 
+void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport)
+{
+    float availableWidth = visibleViewport.width();
+    float availableHeight = visibleViewport.height();
+
+    if (result.devicePixelRatio != 1.0) {
+        availableWidth /= result.devicePixelRatio;
+        availableHeight /= result.devicePixelRatio;
+    }
+
+    result.minimumScale = max<float>(result.minimumScale, max(availableWidth / result.layoutSize.width(), availableHeight / result.layoutSize.height()));
+}
+
+void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result)
+{
+    if (!result.userScalable)
+        result.maximumScale = result.minimumScale = result.initialScale;
+}
+
 static float numericPrefix(const String& keyString, const String& valueString, Document* document, bool* ok)
 {
     // If a prefix of property-value can be converted to a number using strtod,

Modified: trunk/Source/WebCore/dom/ViewportArguments.h (99194 => 99195)


--- trunk/Source/WebCore/dom/ViewportArguments.h	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebCore/dom/ViewportArguments.h	2011-11-03 15:22:16 UTC (rev 99195)
@@ -107,6 +107,8 @@
 };
 
 ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, int deviceDPI, IntSize visibleViewport);
+void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport);
+void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
 
 void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
 void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);

Modified: trunk/Source/WebKit/efl/ChangeLog (99194 => 99195)


--- trunk/Source/WebKit/efl/ChangeLog	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-11-03 15:22:16 UTC (rev 99195)
@@ -1,3 +1,13 @@
+2011-11-03  Fady Samuel  <[email protected]>
+
+        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.
+
+        * ewk/ewk_view.cpp:
+        (_ewk_view_viewport_attributes_compute):
+
 2011-11-03  Dongwoo Im  <[email protected]>
 
         [EFL] Enable the Page Visibility API.

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (99194 => 99195)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -1088,6 +1088,8 @@
     WebCore::IntRect deviceRect = enclosingIntRect(priv->page->chrome()->client()->windowRect());
 
     WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI, availableRect.size());
+    WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size());
+    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
 
     return attributes;
 }

Modified: trunk/Source/WebKit/gtk/ChangeLog (99194 => 99195)


--- trunk/Source/WebKit/gtk/ChangeLog	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/gtk/ChangeLog	2011-11-03 15:22:16 UTC (rev 99195)
@@ -1,3 +1,15 @@
+2011-11-03  Fady Samuel  <[email protected]>
+
+        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.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::dumpConfigurationForViewport):
+        * webkit/webkitviewportattributes.cpp:
+        (webkitViewportAttributesRecompute):
+
 2011-11-02  Jon Lee  <[email protected]>
 
         Expand DragController to provide more information about the dragging session

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp (99194 => 99195)


--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -711,7 +711,8 @@
 
     ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
     ViewportAttributes attrs = computeViewportAttributes(arguments, /* default layout width for non-mobile pages */ 980, deviceWidth, deviceHeight, deviceDPI, IntSize(availableWidth, availableHeight));
-
+    restrictMinimumScaleFactorToViewportSize(attrs, IntSize(availableWidth, availableHeight));
+    restrictScaleFactorToInitialScaleIfNotUserScalable(attrs);
     fprintf(stdout, "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);
 }
 

Modified: trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp (99194 => 99195)


--- trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -535,6 +535,8 @@
     ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
 
     ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, priv->deviceDPI, IntSize(priv->availableWidth, priv->availableHeight));
+    restrictMinimumScaleFactorToViewportSize(attributes, IntSize(priv->availableWidth, priv->availableHeight));
+    restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
 
     priv->width = attributes.layoutSize.width();
     priv->height = attributes.layoutSize.height();

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (99194 => 99195)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -2558,6 +2558,8 @@
     }
 
     WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, qt_defaultDpi(), availableSize);
+    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
 
     result.m_isValid = true;
     result.m_size = conf.layoutSize;

Modified: trunk/Source/WebKit/qt/ChangeLog (99194 => 99195)


--- trunk/Source/WebKit/qt/ChangeLog	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-11-03 15:22:16 UTC (rev 99195)
@@ -1,3 +1,15 @@
+2011-11-03  Fady Samuel  <[email protected]>
+
+        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.cpp:
+        (QWebPage::viewportAttributesForSize):
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::viewportAsText):
+
 2011-11-03  Jesus Sanchez-Palencia  <[email protected]>
 
         [Qt][WK2] Download support and API in UIProcess

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp (99194 => 99195)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -765,6 +765,8 @@
         /* device-height */ deviceSize.height(),
         /* device-dpi    */ deviceDPI,
         availableSize);
+    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
 
     QString res;
     res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",

Modified: trunk/Source/WebKit2/ChangeLog (99194 => 99195)


--- trunk/Source/WebKit2/ChangeLog	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-03 15:22:16 UTC (rev 99195)
@@ -1,3 +1,15 @@
+2011-11-03  Fady Samuel  <[email protected]>
+
+        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/qtouchwebview.cpp:
+        (QTouchWebViewPrivate::updateViewportConstraints):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::viewportConfigurationAsText):
+
 2011-11-03  Andras Becsi  <[email protected]>
 
         [Qt][WK2] Fix the signal signature of the loadFailed API test.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp (99194 => 99195)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -92,6 +92,8 @@
     wkPrefs->setDeviceHeight(720);
 
     WebCore::ViewportAttributes attr = WebCore::computeViewportAttributes(viewportArguments, wkPrefs->layoutFallbackWidth(), wkPrefs->deviceWidth(), wkPrefs->deviceHeight(), wkPrefs->deviceDPI(), availableSize);
+    WebCore::restrictMinimumScaleFactorToViewport(attr, availableSize);
+    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr);
 
     QtViewportInteractionEngine::Constraints newConstraints;
     newConstraints.initialScale = attr.initialScale;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (99194 => 99195)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-11-03 15:21:06 UTC (rev 99194)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-11-03 15:22:16 UTC (rev 99195)
@@ -2618,6 +2618,8 @@
 {
     ViewportArguments arguments = mainFrame()->document()->viewportArguments();
     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);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to