Title: [125680] trunk/Source/WebKit/blackberry
Revision
125680
Author
[email protected]
Date
2012-08-15 09:20:39 -0700 (Wed, 15 Aug 2012)

Log Message

[BlackBerry] Use nested layout when rotating
https://bugs.webkit.org/show_bug.cgi?id=94117

Partially patched by Arvid Nilsson.

Patch by Leo Yang <[email protected]> on 2012-08-15
Reviewed by George Staikos.
Reviewed internally by Arvid Nilsson.

When rotating the content width used for fixedLayoutSize is not
correct because we are changing the rotation and the content with
should be determined after layout. So we set the with to 0 if we
are rotating and beginning the nested layout. And in setViewportSize
we need a nested layout loop to trigger zoom-to-fit.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (125679 => 125680)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-08-15 16:06:30 UTC (rev 125679)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-08-15 16:20:39 UTC (rev 125680)
@@ -2521,6 +2521,8 @@
         // If we detect an overflow larger than the contents size then use that instead since
         // it'll still be clamped by the maxWidth below...
         int width = std::max(absoluteVisibleOverflowSize().width(), contentsSize().width());
+        if (m_pendingOrientation != -1 && !m_nestedLayoutFinishedCount)
+            width = 0;
 
         if (snapToIncrement) {
             // Snap to increments of defaultLayoutWidth / 2.0.
@@ -3851,17 +3853,26 @@
         }
     }
 
-    if (needsLayout)
-        setNeedsLayout();
-
     // Need to resume so that the backingstore will start recording the invalidated
     // rects from below.
     m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::None);
 
     // We might need to layout here to get a correct contentsSize so that zoomToFit
     // is calculated correctly.
-    requestLayoutIfNeeded();
+    while (needsLayout) {
+        setNeedsLayout();
+        requestLayoutIfNeeded();
+        needsLayout = false;
 
+        // Emulate the zoomToFitWidthOnLoad algorithm if we're rotating.
+        ++m_nestedLayoutFinishedCount;
+        if (needsLayoutToFindContentSize) {
+            if (setViewMode(viewMode()))
+                needsLayout = true;
+        }
+    }
+    m_nestedLayoutFinishedCount = 0;
+
     // As a special case if we were zoomed to the initial scale at the beginning
     // of the rotation then preserve that zoom level even when it is zoomToFit.
     double scale = atInitialScale ? initialScale() : currentScale();

Modified: trunk/Source/WebKit/blackberry/ChangeLog (125679 => 125680)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-08-15 16:06:30 UTC (rev 125679)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-08-15 16:20:39 UTC (rev 125680)
@@ -1,3 +1,23 @@
+2012-08-15  Leo Yang  <[email protected]>
+
+        [BlackBerry] Use nested layout when rotating
+        https://bugs.webkit.org/show_bug.cgi?id=94117
+
+        Partially patched by Arvid Nilsson.
+
+        Reviewed by George Staikos.
+        Reviewed internally by Arvid Nilsson.
+
+        When rotating the content width used for fixedLayoutSize is not
+        correct because we are changing the rotation and the content with
+        should be determined after layout. So we set the with to 0 if we
+        are rotating and beginning the nested layout. And in setViewportSize
+        we need a nested layout loop to trigger zoom-to-fit.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::fixedLayoutSize):
+        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
+
 2012-08-14  Antonio Gomes  <[email protected]>
 
         [BlackBerry] Stop copying ScrollViewBase vector all over
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to