[BlackBerry] browser video player fullscreen mode (portrait) - out of screen/focus...
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Jun 2012 14:52:55 +0000 (14:52 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Jun 2012 14:52:55 +0000 (14:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88019

Reviewed by George Staikos.
Patch by Antonio Gomes <agomes@rim.com>

When an element goes fullscreen, its wrapper/container obeys all
BlackBerry specific fixed position customizations: we fixed
against Y, but not X. Then, in order to have the wrapper element
properly positioned when entering fullscreen mode, we
temporarily scroll x to 0.

The original x scroll position is restored when we leave
fullscreen.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
(BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
(BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
* Api/WebPage_p.h:
(WebPagePrivate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119321 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/Api/WebPage_p.h
Source/WebKit/blackberry/ChangeLog

index 6975c9c..d6c2cc4 100644 (file)
@@ -358,6 +358,9 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
     , m_cursorEventMode(ProcessedCursorEvents)
     , m_touchEventMode(ProcessedTouchEvents)
 #endif
+#if ENABLE(FULLSCREEN_API)
+    , m_xScrollOffsetPriorGoingFullScreen(-1)
+#endif
     , m_currentCursor(Platform::CursorNone)
     , m_dumpRenderTree(0) // Lazy initialization.
     , m_initialScale(-1.0)
@@ -6083,6 +6086,15 @@ void WebPagePrivate::enterFullScreenForElement(Element* element)
         // is so that exitFullScreenForElement() gets called later.
         enterFullscreenForNode(element);
     } else {
+        // When an element goes fullscreen, it gets cloned and added to a higher index
+        // wrapper/container node, created out of the DOM tree. This wrapper is fixed
+        // position, but since our fixed position logic respects only the 'y' coordinate,
+        // 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_mainFrame->view()->setScrollPosition(WebCore::IntPoint(0, scrollPosition.y()));
+
         // 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.
@@ -6103,6 +6115,13 @@ void WebPagePrivate::exitFullScreenForElement(Element* element)
         // The Browser chrome has its own fullscreen video widget.
         exitFullscreenForNode(element);
     } else {
+        // When leaving fullscreen mode, we need to restore the 'x' scroll position
+        // prior going full screen.
+        WebCore::IntPoint scrollPosition = m_mainFrame->view()->scrollPosition();
+        m_mainFrame->view()->setScrollPosition(
+            WebCore::IntPoint(m_xScrollOffsetPriorGoingFullScreen, scrollPosition.y()));
+        m_xScrollOffsetPriorGoingFullScreen = -1;
+
         // This is where we would restore the browser's chrome
         // if hidden above.
         client()->fullscreenStop();
index ef46c70..807b9d3 100644 (file)
@@ -490,6 +490,10 @@ public:
     WebCore::TouchEventMode m_touchEventMode;
 #endif
 
+#if ENABLE(FULLSCREEN_API)
+    int m_xScrollOffsetPriorGoingFullScreen;
+#endif
+
     Platform::BlackBerryCursor m_currentCursor;
 
     DumpRenderTreeClient* m_dumpRenderTree;
index f26fdfb..cc70ac9 100644 (file)
@@ -1,5 +1,28 @@
 2012-06-02  Antonio Gomes  <agomes@rim.com>
 
+        [BlackBerry] browser video player fullscreen mode (portrait) - out of screen/focus - cannot navigate or use the buttons on the screen (PART II)
+        https://bugs.webkit.org/show_bug.cgi?id=88019
+
+        Reviewed by George Staikos.
+
+        When an element goes fullscreen, its wrapper/container obeys all
+        BlackBerry specific fixed position customizations: we fixed
+        against Y, but not X. Then, in order to have the wrapper element
+        properly positioned when entering fullscreen mode, we
+        temporarily scroll x to 0.
+
+        The original x scroll position is restored when we leave
+        fullscreen.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+        (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
+        (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+
+2012-06-02  Antonio Gomes  <agomes@rim.com>
+
         [BlackBerry] browser video player fullscreen mode (portrait) - out of screen/focus - cannot navigate or use the buttons on the screen (PART I)
         https://bugs.webkit.org/show_bug.cgi?id=88019
         PR #158266