Changeset 129909 in webkit


Ignore:
Timestamp:
Sep 28, 2012, 9:34:07 AM (13 years ago)
Author:
tonikitoo@webkit.org
Message:

[BlackBerry] Exiting fullscreen does not set the correct scroll position
https://bugs.webkit.org/show_bug.cgi?id=97917
PR #212920

Reviewed by Yong Li.
Patch by Antonio Gomes <agomes@rim.com>
Internally reviewed by Jacky Jiang.

Restore the zoom level and scroll position at the time when know
the fullscreen exit routine has ended (i.e. in ::setViewportSize
instead of ::exitFullScreenForElement).

Also patch caches now the scroll position instead of only the
"x scroll position.

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
(BlackBerry::WebKit::WebPagePrivate::setViewportSize):
(BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
(BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):

  • Api/WebPage_p.h:

(WebPagePrivate):

Location:
trunk/Source/WebKit/blackberry
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r129883 r129909  
    391391#if ENABLE(VIDEO)
    392392    , m_scaleBeforeFullScreen(-1.0)
    393     , m_xScrollOffsetBeforeFullScreen(-1)
    394393#endif
    395394    , m_isTogglingFullScreenState(false)
     
    38813880#if ENABLE(FULLSCREEN_API)
    38823881    if (m_isTogglingFullScreenState) {
     3882        if (!m_fullscreenVideoNode) {
     3883            // When leaving fullscreen mode, we need to restore the scroll position and
     3884            // zoom level it was at before fullscreen.
     3885            // FIXME: The cached values might get imprecise if user have rotated the
     3886            // device while in fullscreen.
     3887            if (m_scaleBeforeFullScreen > 0) {
     3888                // Restore the scale when leaving fullscreen. We can't use TransformationMatrix::scale(double) here, as it
     3889                // will multiply the scale rather than set the scale.
     3890                // FIXME: We can refactor this into setCurrentScale(double) if it is useful in the future.
     3891                m_transformationMatrix->setM11(m_scaleBeforeFullScreen);
     3892                m_transformationMatrix->setM22(m_scaleBeforeFullScreen);
     3893                m_scaleBeforeFullScreen = -1.0;
     3894            }
     3895            m_mainFrame->view()->setScrollPosition(m_scrollOffsetBeforeFullScreen);
     3896        }
     3897
    38833898        m_backingStore->d->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit);
    38843899        m_isTogglingFullScreenState = false;
     
    59595974        // position might change. So we keep track of it here, in order to restore it
    59605975        // once element leaves fullscreen.
    5961         WebCore::IntPoint scrollPosition = m_mainFrame->view()->scrollPosition();
    5962         m_xScrollOffsetBeforeFullScreen = scrollPosition.x();
     5976        m_scrollOffsetBeforeFullScreen = m_mainFrame->view()->scrollPosition();
    59635977
    59645978        // The current scale can be clamped to a greater minimum scale when we relayout contents during
     
    59876001        exitFullscreenForNode(element);
    59886002    } else {
    5989         // When leaving fullscreen mode, we need to restore the 'x' scroll position
    5990         // before fullscreen.
    5991         // FIXME: We may need to respect 'y' position as well, because the web page always scrolls to
    5992         // the top when leaving fullscreen mode.
    5993         WebCore::IntPoint scrollPosition = m_mainFrame->view()->scrollPosition();
    5994         m_mainFrame->view()->setScrollPosition(
    5995             WebCore::IntPoint(m_xScrollOffsetBeforeFullScreen, scrollPosition.y()));
    5996         m_xScrollOffsetBeforeFullScreen = -1;
    5997 
    5998         if (m_scaleBeforeFullScreen > 0) {
    5999             // Restore the scale when leaving fullscreen. We can't use TransformationMatrix::scale(double) here, as it
    6000             // will multiply the scale rather than set the scale.
    6001             // FIXME: We can refactor this into setCurrentScale(double) if it is useful in the future.
    6002             m_transformationMatrix->setM11(m_scaleBeforeFullScreen);
    6003             m_transformationMatrix->setM22(m_scaleBeforeFullScreen);
    6004             m_scaleBeforeFullScreen = -1.0;
    6005         }
    6006 
    60076003        // This is where we would restore the browser's chrome
    60086004        // if hidden above.
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r129419 r129909  
    524524#if ENABLE(VIDEO)
    525525    double m_scaleBeforeFullScreen;
    526     int m_xScrollOffsetBeforeFullScreen;
     526    WebCore::IntPoint m_scrollOffsetBeforeFullScreen;
    527527#endif
    528528    bool m_isTogglingFullScreenState;
  • trunk/Source/WebKit/blackberry/ChangeLog

    r129903 r129909  
     12012-09-28  Antonio Gomes  <agomes@rim.com>
     2
     3        [BlackBerry] Exiting fullscreen does not set the correct scroll position
     4        https://bugs.webkit.org/show_bug.cgi?id=97917
     5        PR #212920
     6
     7        Reviewed by Yong Li.
     8        Internally reviewed by Jacky Jiang.
     9
     10        Restore the zoom level and scroll position at the time when know
     11        the fullscreen exit routine has ended (i.e. in ::setViewportSize
     12        instead of ::exitFullScreenForElement).
     13
     14        Also patch caches now the scroll position instead of only the
     15        "x scroll position.
     16
     17        * Api/WebPage.cpp:
     18        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
     19        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
     20        (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
     21        (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
     22        * Api/WebPage_p.h:
     23        (WebPagePrivate):
     24
    1252012-09-28  Kent Tamura  <tkent@chromium.org>
    226
Note: See TracChangeset for help on using the changeset viewer.