Title: [122135] trunk
Revision
122135
Author
[email protected]
Date
2012-07-09 12:27:11 -0700 (Mon, 09 Jul 2012)

Log Message

[BlackBerry] meta viewport initial-scale doesn't factor in device pixel ratio
https://bugs.webkit.org/show_bug.cgi?id=90575

Patch by Mike Lattanzio <[email protected]> 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):

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (122134 => 122135)


--- trunk/ChangeLog	2012-07-09 19:25:16 UTC (rev 122134)
+++ trunk/ChangeLog	2012-07-09 19:27:11 UTC (rev 122135)
@@ -1,3 +1,17 @@
+2012-07-09  Mike Lattanzio  <[email protected]>
+
+        [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  <[email protected]>
 
         Unreviewed, rolling out r122107.

Added: trunk/ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html (0 => 122135)


--- trunk/ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html	                        (rev 0)
+++ trunk/ManualTests/blackberry/meta-viewport-initial-scale-wide-content.html	2012-07-09 19:27:11 UTC (rev 122135)
@@ -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>

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (122134 => 122135)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-09 19:25:16 UTC (rev 122134)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-09 19:27:11 UTC (rev 122135)
@@ -3549,6 +3549,15 @@
     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 @@
     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());
 

Modified: trunk/Source/WebKit/blackberry/ChangeLog (122134 => 122135)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-09 19:25:16 UTC (rev 122134)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-09 19:27:11 UTC (rev 122135)
@@ -1,3 +1,28 @@
+2012-07-09  Mike Lattanzio  <[email protected]>
+
+        [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  <[email protected]>
 
         Detach animation clients properly if we clear the web page pointer.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to