Title: [138699] trunk/Source/WebKit/blackberry
Revision
138699
Author
[email protected]
Date
2013-01-02 22:11:38 -0800 (Wed, 02 Jan 2013)

Log Message

[BlackBerry] file:/// pages don't get correct scales after several rotations and history navigations
https://bugs.webkit.org/show_bug.cgi?id=105996

Patch by Jacky Jiang <[email protected]>.
Reviewed by George Staikos.

PR: 273541
When navigating back to the previous page on portrait mode, we were
trying to set virtual viewport after recalculation. However, we didn't
change the fixed layout size so that we still layouted the contents at
the old virtual viewport size. In this case, the old virtual viewport
was 570 * 293 which was set in landscape mode unfortunately. There
would be no chance for such kind of contents size to fit the portrait
mode screen size nicely.
This was a regression of webkit/cc31d9bad where setViewMode() was
removed as a noop. So just get setViewMode() back to apply the fixed
layout size with a little bit change as SVG document path was proved
invalid in that patch. Thanks to George for the float comparison change.
Put a FIXME as we don't have a way to save the scale precisely before
the rotation and history navigation currently.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setLoadState):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::saveViewStateToItem):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (138698 => 138699)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-01-03 05:36:32 UTC (rev 138698)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-01-03 06:11:38 UTC (rev 138699)
@@ -1114,6 +1114,10 @@
             } else {
                 Platform::IntSize virtualViewport = recomputeVirtualViewportFromViewportArguments();
                 m_webPage->setVirtualViewportSize(virtualViewport);
+                if (m_shouldUseFixedDesktopMode)
+                    setViewMode(FixedDesktop);
+                else
+                    setViewMode(Desktop);
             }
 
 #if ENABLE(EVENT_MODE_METATAGS)

Modified: trunk/Source/WebKit/blackberry/ChangeLog (138698 => 138699)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-01-03 05:36:32 UTC (rev 138698)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-01-03 06:11:38 UTC (rev 138699)
@@ -1,3 +1,30 @@
+2013-01-02  Jacky Jiang  <[email protected]>
+
+        [BlackBerry] file:/// pages don't get correct scales after several rotations and history navigations
+        https://bugs.webkit.org/show_bug.cgi?id=105996
+
+        Reviewed by George Staikos.
+
+        PR: 273541
+        When navigating back to the previous page on portrait mode, we were
+        trying to set virtual viewport after recalculation. However, we didn't
+        change the fixed layout size so that we still layouted the contents at
+        the old virtual viewport size. In this case, the old virtual viewport
+        was 570 * 293 which was set in landscape mode unfortunately. There
+        would be no chance for such kind of contents size to fit the portrait
+        mode screen size nicely.
+        This was a regression of webkit/cc31d9bad where setViewMode() was
+        removed as a noop. So just get setViewMode() back to apply the fixed
+        layout size with a little bit change as SVG document path was proved
+        invalid in that patch. Thanks to George for the float comparison change.
+        Put a FIXME as we don't have a way to save the scale precisely before
+        the rotation and history navigation currently.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::setLoadState):
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::saveViewStateToItem):
+
 2013-01-02  Otto Derek Cheung  <[email protected]>
 
         [BlackBerry] Do not determine db quota limit using db file size

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (138698 => 138699)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2013-01-03 05:36:32 UTC (rev 138698)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2013-01-03 06:11:38 UTC (rev 138699)
@@ -1065,7 +1065,11 @@
     HistoryItemViewState& viewState = item->viewState();
     if (viewState.shouldSaveViewState) {
         viewState.orientation = m_webPagePrivate->mainFrame()->orientation();
-        viewState.isZoomToFitScale = m_webPagePrivate->currentScale() == m_webPagePrivate->zoomToFitScale();
+        viewState.isZoomToFitScale = fabsf(m_webPagePrivate->currentScale() - m_webPagePrivate->zoomToFitScale()) < 0.01;
+        // FIXME: for the web page which has viewport, if the page was rotated, we can get the correct scale
+        // as initial-scale or zoomToFitScale isn't changed most of the time and the scale can still be clamped
+        // during zoomAboutPoint when restoring the view state. However, there are still chances to get the
+        // wrong scale in theory, we don't have a way to save the scale of the previous orientation currently.
         viewState.scale = m_webPagePrivate->currentScale();
         viewState.shouldReflowBlock = m_webPagePrivate->m_shouldReflowBlock;
         viewState.minimumScale = m_webPagePrivate->m_minimumScale;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to