, m_touchEventModePriorGoingFullScreen(ProcessedTouchEvents)
#endif
#endif
-#if ENABLE(FULLSCREEN_API)
- , m_xScrollOffsetPriorGoingFullScreen(-1)
+#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO)
+ , m_scaleBeforeFullScreen(-1.0)
+ , m_xScrollOffsetBeforeFullScreen(-1)
#endif
, m_currentCursor(Platform::CursorNone)
, m_dumpRenderTree(0) // Lazy initialization.
// we temporarily scroll the WebPage to x:0 so that the wrapper gets properly
// positioned. The original scroll position is restored once element leaves fullscreen.
WebCore::IntPoint scrollPosition = m_mainFrame->view()->scrollPosition();
- m_xScrollOffsetPriorGoingFullScreen = scrollPosition.x();
+ m_xScrollOffsetBeforeFullScreen = scrollPosition.x();
m_mainFrame->view()->setScrollPosition(WebCore::IntPoint(0, scrollPosition.y()));
#if ENABLE(EVENT_MODE_METATAGS)
m_touchEventModePriorGoingFullScreen = m_touchEventMode;
didReceiveTouchEventMode(PureTouchEventsWithMouseConversion);
#endif
+ // The current scale can be clamped to a greater minimum scale when we relayout contents during
+ // the change of the viewport size. Cache the current scale so that we can restore it when
+ // leaving fullscreen. Otherwise, it is possible that we will use the wrong scale.
+ m_scaleBeforeFullScreen = currentScale();
+
// No fullscreen video widget has been made available by the Browser
// chrome, or this is not a video element. The webkitRequestFullScreen
// Javascript call is often made on a div element.
exitFullscreenForNode(element);
} else {
// When leaving fullscreen mode, we need to restore the 'x' scroll position
- // prior going full screen.
+ // before fullscreen.
+ // FIXME: We may need to respect 'y' position as well, because the web page always scrolls to
+ // the top when leaving fullscreen mode.
WebCore::IntPoint scrollPosition = m_mainFrame->view()->scrollPosition();
m_mainFrame->view()->setScrollPosition(
- WebCore::IntPoint(m_xScrollOffsetPriorGoingFullScreen, scrollPosition.y()));
- m_xScrollOffsetPriorGoingFullScreen = -1;
+ WebCore::IntPoint(m_xScrollOffsetBeforeFullScreen, scrollPosition.y()));
+ m_xScrollOffsetBeforeFullScreen = -1;
#if ENABLE(EVENT_MODE_METATAGS)
didReceiveTouchEventMode(m_touchEventModePriorGoingFullScreen);
m_touchEventModePriorGoingFullScreen = ProcessedTouchEvents;
#endif
+ if (m_scaleBeforeFullScreen > 0) {
+ // Restore the scale when leaving fullscreen. We can't use TransformationMatrix::scale(double) here, as it
+ // will multiply the scale rather than set the scale.
+ // FIXME: We can refactor this into setCurrentScale(double) if it is useful in the future.
+ m_transformationMatrix->setM11(m_scaleBeforeFullScreen);
+ m_transformationMatrix->setM22(m_scaleBeforeFullScreen);
+ m_scaleBeforeFullScreen = -1.0;
+ }
+
// This is where we would restore the browser's chrome
// if hidden above.
client()->fullscreenStop();
2012-06-27 Jacky Jiang <zhajiang@rim.com>
+ [BlackBerry] Wrong scale after leaving fullscreen <video>
+ https://bugs.webkit.org/show_bug.cgi?id=89546
+
+ Reviewed by Antonio Gomes.
+
+ PR: 164948
+ When we were entering fullscreen, the current scale A was clamped to a
+ greater minimum scale B as we relayouted the contents during the change
+ of the viewport size. When leaving fullscreen, we still used that scale
+ B as the current scale which was incorrect.
+ To fix this, we can save the current scale when entering fullscreen and
+ restore it when leaving fullscreen.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+ (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
+ (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+
+2012-06-27 Jacky Jiang <zhajiang@rim.com>
+
[BlackBerry] Scale was incorrect when reloading a simple web page after initial load
https://bugs.webkit.org/show_bug.cgi?id=88889