Title: [86956] trunk/Source
Revision
86956
Author
jer.no...@apple.com
Date
2011-05-20 08:50:55 -0700 (Fri, 20 May 2011)

Log Message

2011-05-20  Jer Noble  <jer.no...@apple.com>

        Reviewed by Maciej Stachowiak.

        Win: non-full-screen content is briefly seen when entering full-screen mode (and vice versa)
        https://bugs.webkit.org/show_bug.cgi?id=61108

        Instead of repainting the full- and non-full-screen windows in WebCore, delegate that
        responsibility to the FullScreenControllerClient.  Because the repaint operation may
        be asynchronous, add a new method for clients to use to indicate repainting has completed.

        * platform/graphics/win/FullScreenController.cpp:
        (FullScreenController::Private::Private): Added new ivars.
        (FullScreenController::enterFullScreen): Split into two functions (pre-and post repaint)
        (FullScreenController::enterFullScreenRepaintCompleted): Ditto.
        (FullScreenController::exitFullScreen): Ditto.
        (FullScreenController::exitFullScreenRepaintCompleted): Ditto.
        (FullScreenController::repaintCompleted): Call the appropriated repaint completed function.
        * platform/graphics/win/FullScreenController.h:
        * platform/graphics/win/FullScreenControllerClient.h:
2011-05-20  Jer Noble  <jer.no...@apple.com>

        Reviewed by Maciej Stachowiak.

        Win: non-full-screen content is briefly seen when entering full-screen mode (and vice versa)
        https://bugs.webkit.org/show_bug.cgi?id=61108

        * WebView.cpp:
        (WebView::fullScreenClientForceRepaint): Repaint the view and immediately notify the
            full screen controller.
        * WebView.h:
2011-05-20  Jer Noble  <jer.no...@apple.com>

        Reviewed by Maciej Stachowiak.

        Win: non-full-screen content is briefly seen when entering full-screen mode (and vice versa)
        https://bugs.webkit.org/show_bug.cgi?id=61108

        When the fullScreenController asks us to repaint, make an async repaint request, and when the
        callback is fired, notify the fullScreenController that repaint has completed.

        * UIProcess/win/WebView.cpp:
        (WebKit::fullScreenClientForceRepaintCompleted): Added.
        (WebKit::WebView::fullScreenClientForceRepaint): Added.
        * UIProcess/win/WebView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (86955 => 86956)


--- trunk/Source/WebCore/ChangeLog	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebCore/ChangeLog	2011-05-20 15:50:55 UTC (rev 86956)
@@ -1,3 +1,24 @@
+2011-05-20  Jer Noble  <jer.no...@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Win: non-full-screen content is briefly seen when entering full-screen mode (and vice versa)
+        https://bugs.webkit.org/show_bug.cgi?id=61108
+
+        Instead of repainting the full- and non-full-screen windows in WebCore, delegate that
+        responsibility to the FullScreenControllerClient.  Because the repaint operation may 
+        be asynchronous, add a new method for clients to use to indicate repainting has completed.
+
+        * platform/graphics/win/FullScreenController.cpp:
+        (FullScreenController::Private::Private): Added new ivars.
+        (FullScreenController::enterFullScreen): Split into two functions (pre-and post repaint)
+        (FullScreenController::enterFullScreenRepaintCompleted): Ditto.
+        (FullScreenController::exitFullScreen): Ditto.
+        (FullScreenController::exitFullScreenRepaintCompleted): Ditto.
+        (FullScreenController::repaintCompleted): Call the appropriated repaint completed function.
+        * platform/graphics/win/FullScreenController.h:
+        * platform/graphics/win/FullScreenControllerClient.h:
+
 2011-05-20  Yury Semikhatsky  <yu...@chromium.org>
 
         Reviewed by Pavel Feldman.

Modified: trunk/Source/WebCore/platform/graphics/win/FullScreenController.cpp (86955 => 86956)


--- trunk/Source/WebCore/platform/graphics/win/FullScreenController.cpp	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebCore/platform/graphics/win/FullScreenController.cpp	2011-05-20 15:50:55 UTC (rev 86956)
@@ -49,6 +49,8 @@
         , m_client(client)
         , m_originalHost(0)
         , m_isFullScreen(false)
+        , m_isEnteringFullScreen(false)
+        , m_isExitingFullScreen(false)
     {
     }
     virtual ~Private() { }
@@ -63,6 +65,8 @@
     IntRect m_originalFrame;
     HWND m_originalHost;
     bool m_isFullScreen;
+    bool m_isEnteringFullScreen;
+    bool m_isExitingFullScreen;
 };
 
 LRESULT FullScreenController::Private::fullscreenClientWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -110,9 +114,10 @@
 
 void FullScreenController::enterFullScreen()
 {
-    if (m_private->m_isFullScreen)
+    if (m_private->m_isFullScreen || m_private->m_isEnteringFullScreen)
         return;
     m_private->m_isFullScreen = true;
+    m_private->m_isEnteringFullScreen = true;
 
     m_private->m_originalHost = m_private->m_client->fullScreenClientParentWindow();
     RECT originalFrame = {0, 0, 0, 0};
@@ -126,7 +131,6 @@
     ::AnimateWindow(m_private->m_backgroundWindow->hwnd(), kFullScreenAnimationDuration, AW_BLEND | AW_ACTIVATE);
 
     m_private->m_client->fullScreenClientWillEnterFullScreen();
-
     ASSERT(!m_private->m_fullScreenWindow);
     m_private->m_fullScreenWindow = adoptPtr(new MediaPlayerPrivateFullscreenWindow(m_private.get()));
     ASSERT(m_private->m_fullScreenWindow);
@@ -137,17 +141,26 @@
     IntRect viewFrame(IntPoint(), m_private->m_fullScreenFrame.size());
     ::SetWindowPos(m_private->m_fullScreenWindow->hwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
     ::SetWindowPos(m_private->m_client->fullScreenClientWindow(), HWND_TOP, 0, 0, viewFrame.width(), viewFrame.height(), SWP_NOACTIVATE);
-    ::RedrawWindow(m_private->m_client->fullScreenClientWindow(), 0, 0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);
 
     m_private->m_client->fullScreenClientDidEnterFullScreen();
+    m_private->m_client->fullScreenClientForceRepaint();
+}
+
+void FullScreenController::enterFullScreenRepaintCompleted()
+{
+    if (!m_private->m_isEnteringFullScreen)
+        return;
+    m_private->m_isEnteringFullScreen = false;
+
     ::AnimateWindow(m_private->m_fullScreenWindow->hwnd(), kFullScreenAnimationDuration, AW_BLEND | AW_ACTIVATE);
 }
 
 void FullScreenController::exitFullScreen()
 {
-    if (!m_private->m_isFullScreen)
+    if (!m_private->m_isFullScreen || m_private->m_isExitingFullScreen)
         return;
     m_private->m_isFullScreen = false;
+    m_private->m_isExitingFullScreen = true;
 
     ::AnimateWindow(m_private->m_fullScreenWindow->hwnd(), kFullScreenAnimationDuration, AW_HIDE | AW_BLEND);
 
@@ -155,13 +168,29 @@
     m_private->m_client->fullScreenClientSetParentWindow(m_private->m_originalHost);
     m_private->m_fullScreenWindow = nullptr;
 
-    m_private->m_client->fullScreenClientDidExitFullScreen();
     ::SetWindowPos(m_private->m_client->fullScreenClientWindow(), 0, m_private->m_originalFrame.x(), m_private->m_originalFrame.y(), m_private->m_originalFrame.width(), m_private->m_originalFrame.height(), SWP_NOACTIVATE | SWP_NOZORDER);
-    ::RedrawWindow(m_private->m_client->fullScreenClientWindow(), 0, 0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);
 
+    m_private->m_client->fullScreenClientDidExitFullScreen();
+    m_private->m_client->fullScreenClientForceRepaint();
+}
+
+void FullScreenController::exitFullScreenRepaintCompleted()
+{
+    if (!m_private->m_isExitingFullScreen)
+        return;
+    m_private->m_isExitingFullScreen = false;
+
     ASSERT(m_private->m_backgroundWindow);
     ::AnimateWindow(m_private->m_backgroundWindow->hwnd(), kFullScreenAnimationDuration, AW_HIDE | AW_BLEND);
     m_private->m_backgroundWindow = nullptr;
 }
 
+void FullScreenController::repaintCompleted()
+{
+    if (m_private->m_isEnteringFullScreen)
+        enterFullScreenRepaintCompleted();
+    else if (m_private->m_isExitingFullScreen)
+        exitFullScreenRepaintCompleted();
+}
+
 #endif

Modified: trunk/Source/WebCore/platform/graphics/win/FullScreenController.h (86955 => 86956)


--- trunk/Source/WebCore/platform/graphics/win/FullScreenController.h	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebCore/platform/graphics/win/FullScreenController.h	2011-05-20 15:50:55 UTC (rev 86956)
@@ -42,10 +42,14 @@
 public:
     void enterFullScreen();
     void exitFullScreen();
+    void repaintCompleted();
     
     bool isFullScreen() const;
 
 protected:
+    void enterFullScreenRepaintCompleted();
+    void exitFullScreenRepaintCompleted();
+
     class Private;
     friend class Private;
     OwnPtr<FullScreenController::Private> m_private;

Modified: trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h (86955 => 86956)


--- trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h	2011-05-20 15:50:55 UTC (rev 86956)
@@ -39,6 +39,7 @@
     virtual void fullScreenClientDidEnterFullScreen() = 0;
     virtual void fullScreenClientWillExitFullScreen() = 0;
     virtual void fullScreenClientDidExitFullScreen() = 0;
+    virtual void fullScreenClientForceRepaint() = 0;
 protected:
     virtual ~FullScreenControllerClient() { }
 };

Modified: trunk/Source/WebKit/win/ChangeLog (86955 => 86956)


--- trunk/Source/WebKit/win/ChangeLog	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebKit/win/ChangeLog	2011-05-20 15:50:55 UTC (rev 86956)
@@ -1,3 +1,15 @@
+2011-05-20  Jer Noble  <jer.no...@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Win: non-full-screen content is briefly seen when entering full-screen mode (and vice versa)
+        https://bugs.webkit.org/show_bug.cgi?id=61108
+
+        * WebView.cpp:
+        (WebView::fullScreenClientForceRepaint): Repaint the view and immediately notify the 
+            full screen controller.
+        * WebView.h:
+
 2011-05-13  Jon Lee  <jon...@apple.com>
 
         Reviewed by Simon Fraser.

Modified: trunk/Source/WebKit/win/WebView.cpp (86955 => 86956)


--- trunk/Source/WebKit/win/WebView.cpp	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebKit/win/WebView.cpp	2011-05-20 15:50:55 UTC (rev 86956)
@@ -6828,5 +6828,13 @@
     m_fullScreenElement = nullptr;
 }
 
+void WebView::fullScreenClientForceRepaint()
+{
+    ASSERT(m_fullScreenElement);
+    RECT windowRect = {0};
+    frameRect(&windowRect);
+    repaint(windowRect, true /*contentChanged*/, true /*immediate*/, false /*contentOnly*/);
+    m_fullscreenController->repaintCompleted();
+}
 
 #endif

Modified: trunk/Source/WebKit/win/WebView.h (86955 => 86956)


--- trunk/Source/WebKit/win/WebView.h	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebKit/win/WebView.h	2011-05-20 15:50:55 UTC (rev 86956)
@@ -1031,6 +1031,7 @@
     virtual void fullScreenClientDidEnterFullScreen();
     virtual void fullScreenClientWillExitFullScreen();
     virtual void fullScreenClientDidExitFullScreen();
+    virtual void fullScreenClientForceRepaint();
 #endif
 
     ULONG m_refCount;

Modified: trunk/Source/WebKit2/ChangeLog (86955 => 86956)


--- trunk/Source/WebKit2/ChangeLog	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebKit2/ChangeLog	2011-05-20 15:50:55 UTC (rev 86956)
@@ -1,3 +1,18 @@
+2011-05-20  Jer Noble  <jer.no...@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Win: non-full-screen content is briefly seen when entering full-screen mode (and vice versa)
+        https://bugs.webkit.org/show_bug.cgi?id=61108
+
+        When the fullScreenController asks us to repaint, make an async repaint request, and when the
+        callback is fired, notify the fullScreenController that repaint has completed.
+
+        * UIProcess/win/WebView.cpp:
+        (WebKit::fullScreenClientForceRepaintCompleted): Added.
+        (WebKit::WebView::fullScreenClientForceRepaint): Added.
+        * UIProcess/win/WebView.h:
+
 2011-05-19  Adam Roben  <aro...@apple.com>
 
         Don't try to process DownloadProxy messages twice (and robustify code that runs if we do)

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.cpp (86955 => 86956)


--- trunk/Source/WebKit2/UIProcess/win/WebView.cpp	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.cpp	2011-05-20 15:50:55 UTC (rev 86956)
@@ -1778,5 +1778,16 @@
     page()->fullScreenManager()->didExitFullScreen();
 }
 
+static void fullScreenClientForceRepaintCompleted(WKErrorRef, void* context)
+{
+    ASSERT(context);
+    static_cast<WebView*>(context)->fullScreenController()->repaintCompleted();
+}
+
+void WebView::fullScreenClientForceRepaint()
+{
+    page()->forceRepaint(VoidCallback::create(this, &fullScreenClientForceRepaintCompleted));
+}
+
 #endif
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.h (86955 => 86956)


--- trunk/Source/WebKit2/UIProcess/win/WebView.h	2011-05-20 15:18:40 UTC (rev 86955)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.h	2011-05-20 15:50:55 UTC (rev 86956)
@@ -230,6 +230,7 @@
     virtual void fullScreenClientDidEnterFullScreen();
     virtual void fullScreenClientWillExitFullScreen();
     virtual void fullScreenClientDidExitFullScreen();
+    virtual void fullScreenClientForceRepaint();
 #endif
 
     HWND m_window;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to