Changeset 246302 in webkit
- Timestamp:
- Jun 10, 2019 6:14:23 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r246301 r246302 1 2019-06-10 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [WinCairo][MediaFoundation] Remove the unused video window 4 https://bugs.webkit.org/show_bug.cgi?id=198523 5 6 Reviewed by Don Olmstead. 7 8 Remove the video window which had been unused since Bug 150941. 9 10 No behavior change. 11 12 * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: 13 (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation): 14 (WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation): 15 (WebCore::MediaPlayerPrivateMediaFoundation::setSize): 16 (WebCore::MediaPlayerPrivateMediaFoundation::paint): 17 (WebCore::MediaPlayerPrivateMediaFoundation::hostWindow): 18 (WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode): 19 (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow): 20 (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect): 21 (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples): 22 (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample): 23 (WebCore::MediaPlayerPrivateMediaFoundation::VideoViewWndProc): Deleted. 24 (WebCore::MediaPlayerPrivateMediaFoundation::registerVideoWindowClass): Deleted. 25 (WebCore::MediaPlayerPrivateMediaFoundation::createVideoWindow): Deleted. 26 (WebCore::MediaPlayerPrivateMediaFoundation::destroyVideoWindow): Deleted. 27 (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain): Deleted. 28 (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect): Deleted. 29 * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: 30 1 31 2019-06-10 Simon Fraser <simon.fraser@apple.com> 2 32 -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
r245846 r246302 93 93 , m_preparingToPlay(false) 94 94 , m_volume(1.0) 95 , m_hwndVideo(nullptr)96 95 , m_networkState(MediaPlayer::Empty) 97 96 , m_readyState(MediaPlayer::HaveNothing) 98 97 { 99 98 createSession(); 100 createVideoWindow();101 99 } 102 100 … … 104 102 { 105 103 notifyDeleted(); 106 destroyVideoWindow();107 104 endSession(); 108 105 } … … 360 357 return; 361 358 362 IntPoint positionInWindow(m_lastPaintRect.location());363 364 359 FrameView* view = nullptr; 365 360 float deviceScaleFactor = 1.0f; … … 369 364 } 370 365 371 LayoutPoint scrollPosition;372 if (view) {373 scrollPosition = view->scrollPositionForFixedPosition();374 positionInWindow = view->convertToContainingWindow(IntPoint(m_lastPaintRect.location()));375 }376 377 positionInWindow.move(-scrollPosition.x().toInt(), -scrollPosition.y().toInt());378 379 int x = positionInWindow.x() * deviceScaleFactor;380 int y = positionInWindow.y() * deviceScaleFactor;381 366 int w = m_size.width() * deviceScaleFactor; 382 367 int h = m_size.height() * deviceScaleFactor; 383 368 384 if (m_hwndVideo)385 ::MoveWindow(m_hwndVideo, x, y, w, h, FALSE);386 387 369 RECT rc = { 0, 0, w, h }; 388 370 videoDisplay->SetVideoPosition(nullptr, &rc); … … 393 375 if (context.paintingDisabled() || !m_player->visible()) 394 376 return; 395 396 m_lastPaintRect = rect;397 377 398 378 if (m_presenter) … … 646 626 } 647 627 648 LRESULT CALLBACK MediaPlayerPrivateMediaFoundation::VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 649 { 650 return DefWindowProc(hWnd, message, wParam, lParam); 651 } 652 653 LPCWSTR MediaPlayerPrivateMediaFoundation::registerVideoWindowClass() 654 { 655 const LPCWSTR kVideoWindowClassName = L"WebVideoWindowClass"; 656 657 static bool haveRegisteredWindowClass = false; 658 if (haveRegisteredWindowClass) 659 return kVideoWindowClassName; 660 661 haveRegisteredWindowClass = true; 662 663 WNDCLASSEX wcex; 664 665 wcex.cbSize = sizeof(WNDCLASSEX); 666 667 wcex.style = CS_DBLCLKS; 668 wcex.lpfnWndProc = VideoViewWndProc; 669 wcex.cbClsExtra = 0; 670 wcex.cbWndExtra = 0; 671 wcex.hInstance = nullptr; 672 wcex.hIcon = nullptr; 673 wcex.hCursor = ::LoadCursor(0, IDC_ARROW); 674 wcex.hbrBackground = nullptr; 675 wcex.lpszMenuName = nullptr; 676 wcex.lpszClassName = kVideoWindowClassName; 677 wcex.hIconSm = nullptr; 678 679 if (RegisterClassEx(&wcex)) 680 return kVideoWindowClassName; 681 682 return nullptr; 683 } 684 685 void MediaPlayerPrivateMediaFoundation::createVideoWindow() 686 { 687 HWND hWndParent = nullptr; 688 FrameView* view = nullptr; 689 if (!m_player || !m_player->cachedResourceLoader() || !m_player->cachedResourceLoader()->document()) 690 return; 691 view = m_player->cachedResourceLoader()->document()->view(); 692 if (!view || !view->hostWindow()) 693 return; 694 hWndParent = view->hostWindow()->platformPageClient(); 695 696 m_hwndVideo = CreateWindowEx(WS_EX_NOACTIVATE | WS_EX_TRANSPARENT, registerVideoWindowClass(), 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 697 0, 0, 0, 0, hWndParent, 0, 0, 0); 698 } 699 700 void MediaPlayerPrivateMediaFoundation::destroyVideoWindow() 701 { 702 if (m_hwndVideo) { 703 DestroyWindow(m_hwndVideo); 704 m_hwndVideo = nullptr; 705 } 628 HWND MediaPlayerPrivateMediaFoundation::hostWindow() 629 { 630 if (m_player && m_player->cachedResourceLoader() && !m_player->cachedResourceLoader()->document()) { 631 auto* view = m_player->cachedResourceLoader()->document()->view(); 632 if (view && view->hostWindow() && view->hostWindow()->platformPageClient()) 633 return view->hostWindow()->platformPageClient(); 634 } 635 return GetDesktopWindow(); 706 636 } 707 637 … … 785 715 786 716 m_presenter = new CustomVideoPresenter(this); 787 m_presenter->SetVideoWindow( m_hwndVideo);717 m_presenter->SetVideoWindow(hostWindow()); 788 718 if (FAILED(rendererActivate->SetUnknown(MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE, static_cast<IMFActivate*>(m_presenter.get())))) 789 719 return false; … … 2749 2679 LockHolder locker(m_lock); 2750 2680 m_hwnd = hwnd; 2751 updateDestRect();2752 2681 } 2753 2682 … … 2763 2692 2764 2693 m_destRect = rcDest; 2765 updateDestRect();2766 2694 2767 2695 return S_OK; … … 2793 2721 return hr; 2794 2722 } 2795 2796 updateDestRect();2797 2723 2798 2724 static const int presenterBufferCount = 3; … … 2903 2829 } 2904 2830 2905 // Since we want to draw to the GraphicsContext provided in the paint method,2906 // and not draw directly to the window, we skip presenting the swap chain:2907 2908 // COMPtr<IDirect3DSwapChain9> swapChain;2909 // hr = surface->GetContainer(__uuidof(IDirect3DSwapChain9), (LPVOID*)&swapChain));2910 // hr = presentSwapChain(swapChain, surface));2911 2912 2831 // Keep the last surface for repaints. 2913 2832 m_surfaceRepaint = surface; … … 3075 2994 } 3076 2995 3077 HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain(IDirect3DSwapChain9* swapChain, IDirect3DSurface9* surface)3078 {3079 if (!m_hwnd)3080 return MF_E_INVALIDREQUEST;3081 3082 return swapChain->Present(nullptr, &m_destRect, m_hwnd, nullptr, 0);3083 }3084 3085 2996 HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::getSwapChainPresentParameters(IMFMediaType* type, D3DPRESENT_PARAMETERS* presentParams) 3086 2997 { … … 3123 3034 } 3124 3035 3125 HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect()3126 {3127 if (!m_hwnd)3128 return S_FALSE;3129 3130 RECT rcView;3131 if (!GetClientRect(m_hwnd, &rcView))3132 return E_FAIL;3133 3134 // Clip to the client area of the window.3135 if (m_destRect.right > rcView.right)3136 m_destRect.right = rcView.right;3137 3138 if (m_destRect.bottom > rcView.bottom)3139 m_destRect.bottom = rcView.bottom;3140 3141 return S_OK;3142 }3143 3144 3036 } // namespace WebCore 3145 3037 -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
r245846 r246302 111 111 bool m_preparingToPlay; 112 112 float m_volume; 113 HWND m_hwndVideo;114 113 MediaPlayer::NetworkState m_networkState; 115 114 MediaPlayer::ReadyState m_readyState; 116 FloatRect m_lastPaintRect;117 115 118 116 class MediaPlayerListener; … … 152 150 void onSessionEnded(); 153 151 154 LPCWSTR registerVideoWindowClass(); 155 void createVideoWindow(); 156 void destroyVideoWindow(); 157 152 HWND hostWindow(); 158 153 void invalidateFrameView(); 159 154 … … 162 157 void setNaturalSize(const FloatSize&); 163 158 void notifyDeleted(); 164 165 static LRESULT CALLBACK VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);166 159 167 160 bool setAllChannelVolumes(float); … … 300 293 HRESULT createD3DDevice(); 301 294 HRESULT createD3DSample(IDirect3DSwapChain9*, COMPtr<IMFSample>& videoSample); 302 HRESULT updateDestRect();303 304 HRESULT presentSwapChain(IDirect3DSwapChain9*, IDirect3DSurface9*);305 295 306 296 UINT m_deviceResetToken { 0 };
Note: See TracChangeset
for help on using the changeset viewer.