Title: [246302] trunk/Source/WebCore
Revision
246302
Author
[email protected]
Date
2019-06-10 18:14:23 -0700 (Mon, 10 Jun 2019)

Log Message

[WinCairo][MediaFoundation] Remove the unused video window
https://bugs.webkit.org/show_bug.cgi?id=198523

Reviewed by Don Olmstead.

Remove the video window which had been unused since Bug 150941.

No behavior change.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
(WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation):
(WebCore::MediaPlayerPrivateMediaFoundation::setSize):
(WebCore::MediaPlayerPrivateMediaFoundation::paint):
(WebCore::MediaPlayerPrivateMediaFoundation::hostWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoViewWndProc): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::registerVideoWindowClass): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::createVideoWindow): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::destroyVideoWindow): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect): Deleted.
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246301 => 246302)


--- trunk/Source/WebCore/ChangeLog	2019-06-11 00:54:11 UTC (rev 246301)
+++ trunk/Source/WebCore/ChangeLog	2019-06-11 01:14:23 UTC (rev 246302)
@@ -1,3 +1,33 @@
+2019-06-10  Fujii Hironori  <[email protected]>
+
+        [WinCairo][MediaFoundation] Remove the unused video window
+        https://bugs.webkit.org/show_bug.cgi?id=198523
+
+        Reviewed by Don Olmstead.
+
+        Remove the video window which had been unused since Bug 150941.
+
+        No behavior change.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
+        (WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation):
+        (WebCore::MediaPlayerPrivateMediaFoundation::setSize):
+        (WebCore::MediaPlayerPrivateMediaFoundation::paint):
+        (WebCore::MediaPlayerPrivateMediaFoundation::hostWindow):
+        (WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow):
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect):
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
+        (WebCore::MediaPlayerPrivateMediaFoundation::VideoViewWndProc): Deleted.
+        (WebCore::MediaPlayerPrivateMediaFoundation::registerVideoWindowClass): Deleted.
+        (WebCore::MediaPlayerPrivateMediaFoundation::createVideoWindow): Deleted.
+        (WebCore::MediaPlayerPrivateMediaFoundation::destroyVideoWindow): Deleted.
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain): Deleted.
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect): Deleted.
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
+
 2019-06-10  Simon Fraser  <[email protected]>
 
         Add visualization of touch action regions

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (246301 => 246302)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2019-06-11 00:54:11 UTC (rev 246301)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2019-06-11 01:14:23 UTC (rev 246302)
@@ -92,18 +92,15 @@
     , m_hasVideo(false)
     , m_preparingToPlay(false)
     , m_volume(1.0)
-    , m_hwndVideo(nullptr)
     , m_networkState(MediaPlayer::Empty)
     , m_readyState(MediaPlayer::HaveNothing)
 {
     createSession();
-    createVideoWindow();
 }
 
 MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation()
 {
     notifyDeleted();
-    destroyVideoWindow();
     endSession();
 }
 
@@ -359,8 +356,6 @@
     if (!videoDisplay)
         return;
 
-    IntPoint positionInWindow(m_lastPaintRect.location());
-
     FrameView* view = nullptr;
     float deviceScaleFactor = 1.0f;
     if (m_player && m_player->cachedResourceLoader() && m_player->cachedResourceLoader()->document()) {
@@ -368,22 +363,9 @@
         deviceScaleFactor = m_player->cachedResourceLoader()->document()->deviceScaleFactor();
     }
 
-    LayoutPoint scrollPosition;
-    if (view) {
-        scrollPosition = view->scrollPositionForFixedPosition();
-        positionInWindow = view->convertToContainingWindow(IntPoint(m_lastPaintRect.location()));
-    }
-
-    positionInWindow.move(-scrollPosition.x().toInt(), -scrollPosition.y().toInt());
-
-    int x = positionInWindow.x() * deviceScaleFactor;
-    int y = positionInWindow.y() * deviceScaleFactor;
     int w = m_size.width() * deviceScaleFactor;
     int h = m_size.height() * deviceScaleFactor;
 
-    if (m_hwndVideo)
-        ::MoveWindow(m_hwndVideo, x, y, w, h, FALSE);
-
     RECT rc = { 0, 0, w, h };
     videoDisplay->SetVideoPosition(nullptr, &rc);
 }
@@ -393,8 +375,6 @@
     if (context.paintingDisabled() || !m_player->visible())
         return;
 
-    m_lastPaintRect = rect;
-
     if (m_presenter)
         m_presenter->paintCurrentFrame(context, rect);
 }
@@ -645,64 +625,14 @@
     return true;
 }
 
-LRESULT CALLBACK MediaPlayerPrivateMediaFoundation::VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+HWND MediaPlayerPrivateMediaFoundation::hostWindow()
 {
-    return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-LPCWSTR MediaPlayerPrivateMediaFoundation::registerVideoWindowClass()
-{
-    const LPCWSTR kVideoWindowClassName = L"WebVideoWindowClass";
-
-    static bool haveRegisteredWindowClass = false;
-    if (haveRegisteredWindowClass)
-        return kVideoWindowClassName;
-
-    haveRegisteredWindowClass = true;
-
-    WNDCLASSEX wcex;
-
-    wcex.cbSize = sizeof(WNDCLASSEX);
-
-    wcex.style = CS_DBLCLKS;
-    wcex.lpfnWndProc = VideoViewWndProc;
-    wcex.cbClsExtra = 0;
-    wcex.cbWndExtra = 0;
-    wcex.hInstance = nullptr;
-    wcex.hIcon = nullptr;
-    wcex.hCursor = ::LoadCursor(0, IDC_ARROW);
-    wcex.hbrBackground = nullptr;
-    wcex.lpszMenuName = nullptr;
-    wcex.lpszClassName = kVideoWindowClassName;
-    wcex.hIconSm = nullptr;
-
-    if (RegisterClassEx(&wcex))
-        return kVideoWindowClassName;
-
-    return nullptr;
-}
-
-void MediaPlayerPrivateMediaFoundation::createVideoWindow()
-{
-    HWND hWndParent = nullptr;
-    FrameView* view = nullptr;
-    if (!m_player || !m_player->cachedResourceLoader() || !m_player->cachedResourceLoader()->document())
-        return;
-    view = m_player->cachedResourceLoader()->document()->view();
-    if (!view || !view->hostWindow())
-        return;
-    hWndParent = view->hostWindow()->platformPageClient();
-
-    m_hwndVideo = CreateWindowEx(WS_EX_NOACTIVATE | WS_EX_TRANSPARENT, registerVideoWindowClass(), 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
-        0, 0, 0, 0, hWndParent, 0, 0, 0);
-}
-
-void MediaPlayerPrivateMediaFoundation::destroyVideoWindow()
-{
-    if (m_hwndVideo) {
-        DestroyWindow(m_hwndVideo);
-        m_hwndVideo = nullptr;
+    if (m_player && m_player->cachedResourceLoader() && !m_player->cachedResourceLoader()->document()) {
+        auto* view = m_player->cachedResourceLoader()->document()->view();
+        if (view && view->hostWindow() && view->hostWindow()->platformPageClient())
+            return view->hostWindow()->platformPageClient();
     }
+    return GetDesktopWindow();
 }
 
 void MediaPlayerPrivateMediaFoundation::invalidateFrameView()
@@ -784,7 +714,7 @@
             return false;
 
         m_presenter = new CustomVideoPresenter(this);
-        m_presenter->SetVideoWindow(m_hwndVideo);
+        m_presenter->SetVideoWindow(hostWindow());
         if (FAILED(rendererActivate->SetUnknown(MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE, static_cast<IMFActivate*>(m_presenter.get()))))
             return false;
         m_hasVideo = true;
@@ -2748,7 +2678,6 @@
     {
         LockHolder locker(m_lock);
         m_hwnd = hwnd;
-        updateDestRect();
     }
 
     return createD3DDevice();
@@ -2762,7 +2691,6 @@
     LockHolder locker(m_lock);
 
     m_destRect = rcDest;
-    updateDestRect();
 
     return S_OK;
 }
@@ -2793,8 +2721,6 @@
         return hr;
     }
 
-    updateDestRect();
-
     static const int presenterBufferCount = 3;
 
     for (int i = 0; i < presenterBufferCount; i++) {
@@ -2902,13 +2828,6 @@
             }
         }
 
-        // Since we want to draw to the GraphicsContext provided in the paint method,
-        // and not draw directly to the window, we skip presenting the swap chain:
-
-        // COMPtr<IDirect3DSwapChain9> swapChain;
-        // hr = surface->GetContainer(__uuidof(IDirect3DSwapChain9), (LPVOID*)&swapChain));
-        // hr = presentSwapChain(swapChain, surface));
-
         // Keep the last surface for repaints.
         m_surfaceRepaint = surface;
     }
@@ -3074,14 +2993,6 @@
     return MFCreateVideoSampleFromSurfacePtr()(surface.get(), &videoSample);
 }
 
-HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain(IDirect3DSwapChain9* swapChain, IDirect3DSurface9* surface)
-{
-    if (!m_hwnd)
-        return MF_E_INVALIDREQUEST;
-
-    return swapChain->Present(nullptr, &m_destRect, m_hwnd, nullptr, 0);
-}
-
 HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::getSwapChainPresentParameters(IMFMediaType* type, D3DPRESENT_PARAMETERS* presentParams)
 {
     if (!m_hwnd)
@@ -3122,25 +3033,6 @@
     return S_OK;
 }
 
-HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect()
-{
-    if (!m_hwnd)
-        return S_FALSE;
-
-    RECT rcView;
-    if (!GetClientRect(m_hwnd, &rcView))
-        return E_FAIL;
-
-    // Clip to the client area of the window.
-    if (m_destRect.right > rcView.right)
-        m_destRect.right = rcView.right;
-
-    if (m_destRect.bottom > rcView.bottom)
-        m_destRect.bottom = rcView.bottom;
-
-    return S_OK;
-}
-
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h (246301 => 246302)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h	2019-06-11 00:54:11 UTC (rev 246301)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h	2019-06-11 01:14:23 UTC (rev 246302)
@@ -110,10 +110,8 @@
     bool m_hasVideo;
     bool m_preparingToPlay;
     float m_volume;
-    HWND m_hwndVideo;
     MediaPlayer::NetworkState m_networkState;
     MediaPlayer::ReadyState m_readyState;
-    FloatRect m_lastPaintRect;
 
     class MediaPlayerListener;
     HashSet<MediaPlayerListener*> m_listeners;
@@ -151,10 +149,7 @@
     void onSessionStarted();
     void onSessionEnded();
 
-    LPCWSTR registerVideoWindowClass();
-    void createVideoWindow();
-    void destroyVideoWindow();
-
+    HWND hostWindow();
     void invalidateFrameView();
 
     void addListener(MediaPlayerListener*);
@@ -162,8 +157,6 @@
     void setNaturalSize(const FloatSize&);
     void notifyDeleted();
 
-    static LRESULT CALLBACK VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
-
     bool setAllChannelVolumes(float);
 
     class MediaPlayerListener {
@@ -299,10 +292,7 @@
         HRESULT getSwapChainPresentParameters(IMFMediaType*, D3DPRESENT_PARAMETERS* presentParams);
         HRESULT createD3DDevice();
         HRESULT createD3DSample(IDirect3DSwapChain9*, COMPtr<IMFSample>& videoSample);
-        HRESULT updateDestRect();
 
-        HRESULT presentSwapChain(IDirect3DSwapChain9*, IDirect3DSurface9*);
-
         UINT m_deviceResetToken { 0 };
         HWND m_hwnd { nullptr };
         RECT m_destRect;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to