Title: [115135] trunk/Source/WebKit/blackberry
Revision
115135
Author
[email protected]
Date
2012-04-24 16:45:37 -0700 (Tue, 24 Apr 2012)

Log Message

[BlackBerry] setUserViewportArguments not always respected.
https://bugs.webkit.org/show_bug.cgi?id=84738

Patch by Mike Lattanzio <[email protected]> on 2012-04-24
Reviewed by Antonio Gomes.

Remove the unnecessary logic in
WebPagePrivate::recomputeVirtualViewportFromViewportArguments().
Instead it is much simpler to just set the m_viewportArguments to
m_userViewportArguments on LoadCommitted. If there is a viewport
tag in the content, m_viewportArguments will be replaced with it
as usual during normal page load.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (115134 => 115135)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-04-24 23:43:46 UTC (rev 115134)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-04-24 23:45:37 UTC (rev 115135)
@@ -853,6 +853,12 @@
             // Check if we have already process the meta viewport tag, this only happens on history navigation
             if (!m_didRestoreFromPageCache) {
                 m_viewportArguments = ViewportArguments();
+
+                // At the moment we commit a new load, set the viewport arguments
+                // to any fallback values. If there is a meta viewport in the
+                // content it will overwrite the fallback arguments soon.
+                dispatchViewportPropertiesDidChange(m_userViewportArguments);
+
                 m_userScalable = m_webSettings->isUserScalable();
                 resetScales();
             } else {
@@ -3129,35 +3135,23 @@
 IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments()
 {
     static const ViewportArguments defaultViewportArguments;
+    if (m_viewportArguments == defaultViewportArguments)
+        return IntSize();
 
-    // When calculating a virtual viewport for layout we prioritize the
-    // m_viewportArguments from WebCore over the m_userViewportArguments. We
-    // cannot assign m_viewportAguments = m_userViewportArguments because then
-    // subsequent changes to m_userViewportArguments would be ignored, thinking
-    // the m_viewportArguments had come from WebCore. Instead we make a copy.
-
-    ViewportArguments currentViewportArguments = m_viewportArguments;
-    if (currentViewportArguments == defaultViewportArguments) {
-        if (currentViewportArguments == m_userViewportArguments)
-            return IntSize();
-
-        currentViewportArguments = m_userViewportArguments;
-    }
-
     int desktopWidth = defaultMaxLayoutSize().width();
     int deviceWidth = Platform::Graphics::Screen::primaryScreen()->width();
     int deviceHeight = Platform::Graphics::Screen::primaryScreen()->height();
     FloatSize currentPPI = Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(-1);
     int deviceDPI = int(roundf((currentPPI.width() + currentPPI.height()) / 2));
-    if (currentViewportArguments.targetDensityDpi == ViewportArguments::ValueAuto
+    if (m_viewportArguments.targetDensityDpi == ViewportArguments::ValueAuto
         && !Platform::DeviceInfo::instance()->isMobile()) {
         // If the content provider hasn't specified a target dpi and we have a large
         // screen we assume the content is fine and set the targetDensityDpi to our dpi.
         // On smaller screen mobile devices we skip this and use WebCore dpi scaling.
-        currentViewportArguments.targetDensityDpi = deviceDPI;
+        m_viewportArguments.targetDensityDpi = deviceDPI;
     }
 
-    ViewportAttributes result = computeViewportAttributes(currentViewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, m_defaultLayoutSize);
+    ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, m_defaultLayoutSize);
     m_page->setDeviceScaleFactor(result.devicePixelRatio);
     return IntSize(result.layoutSize.width(), result.layoutSize.height());
 }

Modified: trunk/Source/WebKit/blackberry/ChangeLog (115134 => 115135)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-04-24 23:43:46 UTC (rev 115134)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-04-24 23:45:37 UTC (rev 115135)
@@ -1,3 +1,21 @@
+2012-04-24  Mike Lattanzio  <[email protected]>
+
+        [BlackBerry] setUserViewportArguments not always respected.
+        https://bugs.webkit.org/show_bug.cgi?id=84738
+
+        Reviewed by Antonio Gomes.
+
+        Remove the unnecessary logic in
+        WebPagePrivate::recomputeVirtualViewportFromViewportArguments().
+        Instead it is much simpler to just set the m_viewportArguments to
+        m_userViewportArguments on LoadCommitted. If there is a viewport
+        tag in the content, m_viewportArguments will be replaced with it
+        as usual during normal page load.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::setLoadState):
+        (BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments):
+
 2012-04-24  Joe Mason  <[email protected]>
 
         [BlackBerry] Revert broken changes to authentication dialog
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to