[BlackBerry] Use nested layout when rotating

https://bugs.webkit.org/show_bug.cgi?id=94117

Partially patched by Arvid Nilsson.

Patch by Leo Yang <leoyang@rim.com> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1ed197c7
......@@ -2521,6 +2521,8 @@ IntSize WebPagePrivate::fixedLayoutSize(bool snapToIncrement) const
// 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,16 +3853,25 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize
}
}
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.
......
2012-08-15 Leo Yang <leoyang@rim.com>
[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 <agomes@rim.com>
[BlackBerry] Stop copying ScrollViewBase vector all over
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment