[BlackBerry] meta viewport initial-scale doesn't factor in device pixel ratio
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jul 2012 19:27:11 +0000 (19:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jul 2012 19:27:11 +0000 (19:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90575

Patch by Mike Lattanzio <mlattanzio@rim.com> on 2012-07-09
Reviewed by Rob Buis.

.:

Add a manual test to verify wide content doesn't interfere
with initial-scale calculations.

Internal review from Konrad Piascik.

* ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html: Added.

Source/WebKit/blackberry:

Refactor meta viewport handling to multiply the developer
specified scale properties by the devicePixelRatio. This
required moving the setting of these values until after
the call to computeViewportAttributes.

This fixes an isssue where content wider than the meta viewport
would case a zoom-out-to-fit scenario because we misinterpreted
the specified initial-scale.

New test to verify wide content doesn't affect initial-scale:
ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html

Internal review from Konrad Piascik, Arvid Nilsson.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments):
(BlackBerry::WebKit::WebPagePrivate::dispatchViewportPropertiesDidChange):

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

ChangeLog
ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html [new file with mode: 0644]
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index b3543de5b2415e2319016fc845882c59fa32ef65..dafa8e5692110045ccf907d6eadd62e848e0b280 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-07-09  Mike Lattanzio  <mlattanzio@rim.com>
+
+        [BlackBerry] meta viewport initial-scale doesn't factor in device pixel ratio
+        https://bugs.webkit.org/show_bug.cgi?id=90575
+
+        Reviewed by Rob Buis.
+
+        Add a manual test to verify wide content doesn't interfere
+        with initial-scale calculations.
+
+        Internal review from Konrad Piascik.
+
+        * ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html: Added.
+
 2012-07-09  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r122107.
diff --git a/ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html b/ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html
new file mode 100644 (file)
index 0000000..56265f5
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<style>
+body { margin: 0; padding: 0; }
+#green { width: 100%; height: 100%; background: green; }
+#red { width: 1024px; height: 2048px; background: red; }
+</style>
+</head>
+<body>
+<div id="green">
+This green box should fully fill the initial viewport, and the text within it
+should wrap at the edge of the screen appropriately. The test is PASSED if
+this green box is fully visible and takes up the whole screen.
+</div>
+<div id="red">
+This should not be visible initially. This test is FAILED if you can see
+can red without first scrolling down.
+</div>
+</body>
+</html>
index cf0e1c49a09d7461e870e9ee6d9d34144fef54ae..4fe6ca50773d7929aea5958f6536f9416a56660e 100644 (file)
@@ -3549,6 +3549,15 @@ IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments()
     int deviceHeight = Platform::Graphics::Screen::primaryScreen()->height();
     ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, m_webSettings->devicePixelRatio(), m_defaultLayoutSize);
     m_page->setDeviceScaleFactor(result.devicePixelRatio);
+
+    setUserScalable(m_userScalable && result.userScalable);
+    if (result.initialScale > 0)
+        setInitialScale(result.initialScale * result.devicePixelRatio);
+    if (result.minimumScale > 0)
+        setMinimumScale(result.minimumScale * result.devicePixelRatio);
+    if (result.maximumScale > 0)
+        setMaximumScale(result.maximumScale * result.devicePixelRatio);
+
     return IntSize(result.layoutSize.width(), result.layoutSize.height());
 }
 
@@ -3591,14 +3600,6 @@ void WebPagePrivate::dispatchViewportPropertiesDidChange(const ViewportArguments
     if (!m_viewportArguments.height)
         m_viewportArguments.height = ViewportArguments::ValueDeviceHeight;
 
-    setUserScalable(arguments.userScalable == ViewportArguments::ValueAuto ? true : arguments.userScalable);
-    if (arguments.initialScale > 0)
-        setInitialScale(arguments.initialScale);
-    if (arguments.minimumScale > 0)
-        setMinimumScale(arguments.minimumScale);
-    if (arguments.maximumScale > 0)
-        setMaximumScale(arguments.maximumScale);
-
     IntSize virtualViewport = recomputeVirtualViewportFromViewportArguments();
     m_webPage->setVirtualViewportSize(virtualViewport.width(), virtualViewport.height());
 
index bca061eaf0b33955bc6bf483f4ce14e1ec048ee9..f154e7e14fe4bba920c8b02aa177725139c0d09b 100644 (file)
@@ -1,3 +1,28 @@
+2012-07-09  Mike Lattanzio  <mlattanzio@rim.com>
+
+        [BlackBerry] meta viewport initial-scale doesn't factor in device pixel ratio
+        https://bugs.webkit.org/show_bug.cgi?id=90575
+
+        Reviewed by Rob Buis.
+
+        Refactor meta viewport handling to multiply the developer
+        specified scale properties by the devicePixelRatio. This
+        required moving the setting of these values until after
+        the call to computeViewportAttributes.
+
+        This fixes an isssue where content wider than the meta viewport
+        would case a zoom-out-to-fit scenario because we misinterpreted
+        the specified initial-scale.
+
+        New test to verify wide content doesn't affect initial-scale:
+        ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html
+
+        Internal review from Konrad Piascik, Arvid Nilsson.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments):
+        (BlackBerry::WebKit::WebPagePrivate::dispatchViewportPropertiesDidChange):
+
 2012-07-07  George Staikos  <staikos@webkit.org>
 
         Detach animation clients properly if we clear the web page pointer.