void LayerTreeHostCAWin::platformInitialize() { m_view.adoptCF(WKCACFViewCreate(kWKCACFViewDrawingDestinationWindow)); WKCACFViewSetContextUserData(m_view.get(), static_cast<AbstractCACFLayerTreeHost*>(this)); WKCACFViewSetLayer(m_view.get(), rootLayer()->platformLayer()); WKCACFViewSetContextDidChangeCallback(m_view.get(), contextDidChangeCallback, this); // Passing WS_DISABLED makes the window invisible to mouse events, which lets WKView's normal // event handling mechanism work even when this window is obscuring the entire WKView HWND. // Note that m_webPage->nativeWindow() is owned by the UI process, so this creates a cross- // process window hierarchy (and thus implicitly attaches the input queues of the UI and web // processes' main threads). m_window = adoptPtr(new WKCACFViewWindow(m_view.get(), m_webPage->nativeWindow(), WS_DISABLED)); CGRect bounds = m_webPage->bounds(); WKCACFViewUpdate(m_view.get(), m_window->window(), &bounds); m_layerTreeContext.window = m_window->window(); }
bool LayerTreeHostCAWin::supportsAcceleratedCompositing() { static bool initialized; static bool supportsAcceleratedCompositing; if (initialized) return supportsAcceleratedCompositing; initialized = true; RetainPtr<WKCACFViewRef> view(AdoptCF, WKCACFViewCreate(kWKCACFViewDrawingDestinationWindow)); WKCACFViewWindow dummyWindow(view.get(), 0, 0); CGRect fakeBounds = CGRectMake(0, 0, 10, 10); WKCACFViewUpdate(view.get(), dummyWindow.window(), &fakeBounds); supportsAcceleratedCompositing = WKCACFViewCanDraw(view.get()); WKCACFViewUpdate(view.get(), 0, 0); return supportsAcceleratedCompositing; }
WKCACFViewLayerTreeHost::WKCACFViewLayerTreeHost() : m_view(adoptCF(WKCACFViewCreate(kWKCACFViewDrawingDestinationWindow))) , m_viewNeedsUpdate(true) { }