Commit 48e83dab authored by anilsson@rim.com's avatar anilsson@rim.com
Browse files

[BlackBerry] Decouple layout viewport from visual viewport

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

Reviewed by Carlos Garcia Campos.

Setting the visual viewport would force the layout viewport equal to
the visual viewport. Decouple the viewports by allowing the user to
specify a layout viewport when setting the viewport(s). The layout
viewport could be the exact same value passed for visual viewport, if
the old behavior is desired.

Also reevaluate any viewport arguments when (only) the layout viewport
changes in WebPage::setDefaultLayoutSize() since the layout viewport is
used as input to the calculation.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setScreenOrientation):
(BlackBerry::WebKit::WebPagePrivate::setViewportSize):
(BlackBerry::WebKit::WebPage::setViewportSize):
(WebKit):
(BlackBerry::WebKit::WebPagePrivate::setDefaultLayoutSize):
(BlackBerry::WebKit::WebPage::defaultLayoutSize):
* Api/WebPage.h:
* Api/WebPage_p.h:
(WebPagePrivate):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8484e559
......@@ -3650,10 +3650,10 @@ void WebPage::applyPendingOrientationIfNeeded()
d->m_inputHandler->redrawSpellCheckDialogIfRequired(false /* shouldMoveDialog */);
}
void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize, bool ensureFocusElementVisible)
bool WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize, const IntSize& defaultLayoutSize, bool ensureFocusElementVisible)
{
if (m_pendingOrientation == -1 && transformedActualVisibleSize == this->transformedActualVisibleSize())
return;
return false;
// Suspend all screen updates to the backingstore to make sure no-one tries to blit
// while the window surface and the BackingStore are out of sync.
......@@ -3678,7 +3678,7 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize
bool atTop = !scrollPosition().y();
bool atLeft = !scrollPosition().x();
setDefaultLayoutSize(transformedActualVisibleSize);
setDefaultLayoutSize(defaultLayoutSize);
// Recompute our virtual viewport.
bool needsLayout = false;
......@@ -3898,11 +3898,16 @@ void WebPagePrivate::setViewportSize(const IntSize& transformedActualVisibleSize
m_backingStore->d->resumeScreenUpdates(screenResumeOperation);
m_inputHandler->redrawSpellCheckDialogIfRequired();
return true;
}
void WebPage::setViewportSize(const Platform::IntSize& viewportSize, bool ensureFocusElementVisible)
void WebPage::setViewportSize(const Platform::IntSize& viewportSize, const Platform::IntSize& defaultLayoutSize, bool ensureFocusElementVisible)
{
d->setViewportSize(viewportSize, ensureFocusElementVisible);
if (!d->setViewportSize(viewportSize, defaultLayoutSize, ensureFocusElementVisible)) {
// If the viewport didn't change, try to apply only the new default layout size.
setDefaultLayoutSize(defaultLayoutSize);
}
}
void WebPagePrivate::setDefaultLayoutSize(const IntSize& size)
......@@ -3912,14 +3917,30 @@ void WebPagePrivate::setDefaultLayoutSize(const IntSize& size)
m_defaultLayoutSize = size.expandedTo(minimumLayoutSize).shrunkTo(screenSize);
}
Platform::IntSize WebPage::defaultLayoutSize() const
{
return d->m_defaultLayoutSize;
}
void WebPage::setDefaultLayoutSize(const Platform::IntSize& platformSize)
{
bool needsLayout = false;
WebCore::IntSize size = platformSize;
if (size == d->m_defaultLayoutSize)
return;
d->setDefaultLayoutSize(size);
bool needsLayout = d->setViewMode(d->viewMode());
// The default layout size affects interpretation of any viewport arguments present.
Platform::IntSize virtualViewportSize = d->recomputeVirtualViewportFromViewportArguments();
if (!virtualViewportSize.isEmpty()) {
setVirtualViewportSize(virtualViewportSize);
needsLayout = true;
}
if (d->setViewMode(d->viewMode()))
needsLayout = true;
if (needsLayout) {
d->setNeedsLayout();
if (!d->isLoading())
......
......@@ -142,13 +142,20 @@ public:
void applyPendingOrientationIfNeeded();
Platform::ViewportAccessor* webkitThreadViewportAccessor() const;
// Returns the size of the visual viewport.
Platform::IntSize viewportSize() const;
void setViewportSize(const Platform::IntSize&, bool ensureFocusElementVisible = true);
// Sets the sizes of the visual viewport and the layout viewport.
void setViewportSize(const Platform::IntSize& viewportSize, const Platform::IntSize& defaultLayoutSize, bool ensureFocusElementVisible = true);
void resetVirtualViewportOnCommitted(bool reset);
void setVirtualViewportSize(const Platform::IntSize&);
// Used for default layout size unless overridden by web content or by other APIs.
// Returns the size of the layout viewport.
Platform::IntSize defaultLayoutSize() const;
// Set the size of the layout viewport, in document coordinates, independently of the visual viewport.
void setDefaultLayoutSize(const Platform::IntSize&);
bool mouseEvent(const Platform::MouseEvent&, bool* wheelDeltaAccepted = 0);
......
......@@ -375,9 +375,9 @@ public:
void setScreenOrientation(int);
// Scroll and/or zoom so that the WebPage fits the new actual
// visible size.
void setViewportSize(const WebCore::IntSize& transformedActualVisibleSize, bool ensureFocusElementVisible);
// Scroll and/or zoom so that the WebPage fits the new actual visible size, a.k.a. visual viewport.
// Also sets the default layout size, a.k.a. the layout viewport.
bool setViewportSize(const WebCore::IntSize& transformedActualVisibleSize, const WebCore::IntSize& defaultLayoutSize, bool ensureFocusElementVisible);
void scheduleDeferrableTimer(WebCore::Timer<WebPagePrivate>*, double timeOut);
void unscheduleAllDeferrableTimers();
......
2013-04-03 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] Decouple layout viewport from visual viewport
https://bugs.webkit.org/show_bug.cgi?id=113829
Reviewed by Carlos Garcia Campos.
Setting the visual viewport would force the layout viewport equal to
the visual viewport. Decouple the viewports by allowing the user to
specify a layout viewport when setting the viewport(s). The layout
viewport could be the exact same value passed for visual viewport, if
the old behavior is desired.
Also reevaluate any viewport arguments when (only) the layout viewport
changes in WebPage::setDefaultLayoutSize() since the layout viewport is
used as input to the calculation.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setScreenOrientation):
(BlackBerry::WebKit::WebPagePrivate::setViewportSize):
(BlackBerry::WebKit::WebPage::setViewportSize):
(WebKit):
(BlackBerry::WebKit::WebPagePrivate::setDefaultLayoutSize):
(BlackBerry::WebKit::WebPage::defaultLayoutSize):
* Api/WebPage.h:
* Api/WebPage_p.h:
(WebPagePrivate):
2013-04-02 Maxim Mogilnitsky <mmogilnitsky@rim.com>
 
[BlackBerry] API update for IntRect
......
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