Title: [109687] trunk/Source/WebKit/blackberry
Revision
109687
Author
[email protected]
Date
2012-03-04 17:34:22 -0800 (Sun, 04 Mar 2012)

Log Message

2012-03-04 Antonio Gomes <[email protected]>

        Fixed positioned element not correctly positioned after orientation change,
        when viewport metatag is used with "initial-scale=1" MKS_2992596
        PR #138865

        Reviewed by George Staikos.

        Viewport size changes in two main scenarios:
        - orientation changes;
        - virtual keyboard pop up/hide.

        When we are setting a new viewport size, we need to
        update the FixedReportedSize of the mainframe. This size
        is used to return innerWidth|Heigth as well as to calculate
        the fixed position elements height relative to the RenderView [1].

        [1] RenderBox::containingBlockLogicalHeightForPositioned.

        When we are rotating, we need to delay setting the new FixedReportedSize
        till we layout and are able to figure out the new contents size. At this
        time we call setFixedReportedSize, but we do not reposition the fixed elemts
        afterwards.

        Patch adds a call to FrameView::repaintFixedElementsAfterScrolling, after
        setting the new size.

        Source/WebKit/blackberry:
        * Api/WebPage.cpp:
        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):

        Source/WebCore:
        * manual-tests/blackberry/meta-viewport-fixed-position-preserved-on-rotation.html: Added.

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (109686 => 109687)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-03-05 01:09:02 UTC (rev 109686)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-03-05 01:34:22 UTC (rev 109687)
@@ -3194,7 +3194,7 @@
     bool newVisibleRectContainsOldVisibleRect = (m_actualVisibleHeight <= transformedActualVisibleSize.height())
                                           && (m_actualVisibleWidth <= transformedActualVisibleSize.width());
 
-    bool atInitialScale = currentScale() == initialScale();
+    bool atInitialScale = m_webPage->isAtInitialZoom();
     bool atTop = !scrollPosition().y();
     bool atLeft = !scrollPosition().x();
 
@@ -3264,8 +3264,10 @@
     if (setViewMode(viewMode()))
         needsLayout = true;
 
+    bool needsLayoutToFindContentSize = hasPendingOrientation;
+
     // We need to update the viewport size of the WebCore::ScrollView...
-    updateViewportSize(!hasPendingOrientation /* setFixedReportedSize */, false /* sendResizeEvent */);
+    updateViewportSize(!needsLayoutToFindContentSize /* setFixedReportedSize */, false /* sendResizeEvent */);
     notifyTransformedContentsSizeChanged();
 
     // If automatic zooming is disabled, prevent zooming below.
@@ -3302,7 +3304,7 @@
     // Do our own clamping.
     scale = clampedScale(scale);
 
-    if (hasPendingOrientation) {
+    if (needsLayoutToFindContentSize) {
         // Set the fixed reported size here so that innerWidth|innerHeight works
         // with this new scale.
         TransformationMatrix rotationMatrix;
@@ -3310,6 +3312,7 @@
         IntRect viewportRect = IntRect(IntPoint::zero(), transformedActualVisibleSize);
         IntRect actualVisibleRect = enclosingIntRect(rotationMatrix.inverse().mapRect(FloatRect(viewportRect)));
         m_mainFrame->view()->setFixedReportedSize(actualVisibleRect.size());
+        m_mainFrame->view()->repaintFixedElementsAfterScrolling();
     }
 
     // We're going to need to send a resize event to _javascript_ because

Modified: trunk/Source/WebKit/blackberry/ChangeLog (109686 => 109687)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-05 01:09:02 UTC (rev 109686)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-05 01:34:22 UTC (rev 109687)
@@ -1,3 +1,34 @@
+2012-03-04  Antonio Gomes  <[email protected]>
+
+        [BlackBerry] Fixed positioned element not correctly positioned after orientation change, when viewport metatag is used
+        https://bugs.webkit.org/show_bug.cgi?id=80228
+        PR #138865
+
+        Reviewed by George Staikos.
+
+        Viewport size changes in two main scenarios:
+        - orientation changes;
+        - virtual keyboard pop up/hide.
+
+        When we are setting a new viewport size, we need to
+        update the FixedReportedSize of the mainframe. This size
+        is used to return innerWidth|Heigth as well as to calculate
+        the fixed position elements height relative to the RenderView [1].
+
+        [1] RenderBox::containingBlockLogicalHeightForPositioned.
+
+        When we are rotating, we need to delay setting the new FixedReportedSize
+        till we layout and are able to figure out the new contents size. At this
+        time we call setFixedReportedSize, but we do not reposition the fixed elemts
+        afterwards.
+
+        Patch adds a call to FrameView::repaintFixedElementsAfterScrolling, after
+        setting the new size.
+
+        Source/WebKit/blackberry:
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
+
 2012-03-02  Mike Fenton  <[email protected]>
 
         [BlackBerry] Expose WebInspector state to client and clean up WebSettings
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to