Changeset 76858 in webkit
- Timestamp:
- Jan 27, 2011 3:40:41 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76856 r76858 1 2011-01-27 Adam Roben <aroben@apple.com> 2 3 Add WKCACFViewLayerTreeHost 4 5 This is a class that derives from CACFLayerTreeHost and uses a WKCACFView to render. 6 7 Fixes <http://webkit.org/b/53251> <rdar://problem/8925496> CACFLayerTreeHost should use 8 WKCACFView for rendering 9 10 * WebCore.vcproj/WebCore.vcproj: Added WKCACFViewLayerTreeHost.{cpp,h}. 11 12 * platform/graphics/ca/win/CACFLayerTreeHost.cpp: 13 (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable): Make the test window have a 14 non-zero size. WKCACFView will always say it can't render if you pass it a 0-sized window, 15 so we need a non-empty window to perform a valid test. 16 (WebCore::CACFLayerTreeHost::create): First try to create a WKCACFViewLayerTreeHost, then 17 fall back to a LegacyCACFLayerTreeHost. 18 (WebCore::CACFLayerTreeHost::flushPendingLayerChangesNow): Moved code to react to the 19 context flush from here... 20 (WebCore::CACFLayerTreeHost::contextDidChange): ...to here. Derived classes are required to 21 call this function whenever changes are flushed to the context. 22 23 * platform/graphics/ca/win/CACFLayerTreeHost.h: Added contextDidChange. 24 25 * platform/graphics/ca/win/LegacyCACFLayerTreeHost.cpp: 26 (WebCore::LegacyCACFLayerTreeHost::createRenderer): 27 (WebCore::LegacyCACFLayerTreeHost::resize): 28 Changed to use flushContext instead of flushing the context manually so that we will always 29 notify the base class when the context gets flushed. 30 31 (WebCore::LegacyCACFLayerTreeHost::flushContext): Added a call to contextDidChange so the 32 base class will know what happened. Moved code to schedule a render from here... 33 (WebCore::LegacyCACFLayerTreeHost::contextDidChange): ...to here. 34 35 * platform/graphics/ca/win/LegacyCACFLayerTreeHost.h: Added contextDidChange. 36 37 * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: Added. 38 (WebCore::WKCACFViewLayerTreeHost::create): If WebKitQuartzCoreAdditions, which provides 39 WKCACFView, isn't present, bail. Otherwise allocate and return a new host. 40 (WebCore::WKCACFViewLayerTreeHost::WKCACFViewLayerTreeHost): Initialize members. 41 (WebCore::WKCACFViewLayerTreeHost::updateViewIfNeeded): Update the view if we previously 42 marked that we needed to do so, and flush the context if our layer's bounds have changed. 43 (WebCore::WKCACFViewLayerTreeHost::contextDidChangeCallback): Call through to 44 contextDidChange. 45 (WebCore::WKCACFViewLayerTreeHost::contextDidChange): Tell the WKCACFView to start rendering 46 (if we didn't already), then call up to the base class. 47 (WebCore::WKCACFViewLayerTreeHost::initializeContext): Set the context's user data, the 48 view's layer, and hook up our "context did change" callback. 49 (WebCore::WKCACFViewLayerTreeHost::resize): Mark that the view needs to be updated the next 50 time we paint. 51 (WebCore::WKCACFViewLayerTreeHost::createRenderer): Update our view and return whether it is 52 able to render or not. 53 (WebCore::WKCACFViewLayerTreeHost::destroyRenderer): Clear out all the info we passed down 54 to the view. 55 (WebCore::WKCACFViewLayerTreeHost::lastCommitTime): Call through to the view. 56 (WebCore::WKCACFViewLayerTreeHost::flushContext): Ditto. 57 (WebCore::WKCACFViewLayerTreeHost::paint): Update the view so it will draw at the right 58 size, then call up to the base class. 59 (WebCore::WKCACFViewLayerTreeHost::render): Invalidate the view using the passed-in dirty 60 rects, then ask it to draw. 61 62 * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h: Copied from Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h. 63 1 64 2011-01-27 Adam Roben <aroben@apple.com> 2 65 -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r76856 r76858 28967 28967 > 28968 28968 </File> 28969 <File 28970 RelativePath="..\platform\graphics\ca\win\WKCACFViewLayerTreeHost.cpp" 28971 > 28972 </File> 28973 <File 28974 RelativePath="..\platform\graphics\ca\win\WKCACFViewLayerTreeHost.h" 28975 > 28976 </File> 28969 28977 </Filter> 28970 28978 </Filter> -
trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp
r76856 r76858 33 33 #include "LegacyCACFLayerTreeHost.h" 34 34 #include "PlatformCALayer.h" 35 #include "WKCACFViewLayerTreeHost.h" 35 36 #include "WebCoreInstanceHandle.h" 36 37 #include <limits.h> … … 97 98 wcex.lpszClassName = L"CoreAnimationTesterWindowClass"; 98 99 ::RegisterClassEx(&wcex); 99 HWND testWindow = ::CreateWindow(L"CoreAnimationTesterWindowClass", L"CoreAnimationTesterWindow", WS_POPUP, -500, -500, 0,0, 0, 0, 0, 0);100 HWND testWindow = ::CreateWindow(L"CoreAnimationTesterWindowClass", L"CoreAnimationTesterWindow", WS_POPUP, -500, -500, 20, 20, 0, 0, 0, 0); 100 101 101 102 if (!testWindow) { … … 117 118 if (!acceleratedCompositingAvailable()) 118 119 return 0; 119 RefPtr<CACFLayerTreeHost> host = LegacyCACFLayerTreeHost::create(); 120 RefPtr<CACFLayerTreeHost> host = WKCACFViewLayerTreeHost::create(); 121 if (!host) 122 host = LegacyCACFLayerTreeHost::create(); 120 123 host->initialize(); 121 124 return host.release(); … … 293 296 flushContext(); 294 297 298 m_isFlushingLayerChanges = false; 299 } 300 301 void CACFLayerTreeHost::contextDidChange() 302 { 295 303 // All pending animations will have been started with the flush. Fire the animationStarted calls. 296 304 notifyAnimationsStarted(); 297 298 m_isFlushingLayerChanges = false;299 305 } 300 306 -
trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
r76853 r76858 79 79 virtual bool createRenderer() = 0; 80 80 virtual void destroyRenderer(); 81 virtual void contextDidChange(); 81 82 82 83 private: -
trunk/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.cpp
r76856 r76858 190 190 if (IsWindow(window())) { 191 191 rootLayer()->setBounds(bounds()); 192 wkCACFContextFlush(m_context);192 flushContext(); 193 193 } 194 194 … … 222 222 if (rootLayer()) { 223 223 rootLayer()->setBounds(bounds()); 224 wkCACFContextFlush(m_context);224 flushContext(); 225 225 } 226 226 } … … 327 327 { 328 328 wkCACFContextFlush(m_context); 329 contextDidChange(); 330 } 331 332 void LegacyCACFLayerTreeHost::contextDidChange() 333 { 329 334 renderSoon(); 330 335 } -
trunk/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h
r76856 r76858 61 61 virtual CFTimeInterval lastCommitTime() const; 62 62 virtual void flushContext(); 63 virtual void contextDidChange(); 63 64 virtual void paint(); 64 65 virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); -
trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h
r76856 r76858 24 24 */ 25 25 26 #ifndef LegacyCACFLayerTreeHost_h27 #define LegacyCACFLayerTreeHost_h26 #ifndef WKCACFViewLayerTreeHost_h 27 #define WKCACFViewLayerTreeHost_h 28 28 29 29 #if USE(ACCELERATED_COMPOSITING) … … 31 31 #include "CACFLayerTreeHost.h" 32 32 33 typedef struct _WKCACFView* WKCACFViewRef; 34 33 35 namespace WebCore { 34 36 35 // FIXME: Currently there is a LegacyCACFLayerTreeHost for each WebView and each 36 // has its own WKCACFContext and Direct3DDevice9, which is inefficient. 37 // (https://bugs.webkit.org/show_bug.cgi?id=31855) 38 class LegacyCACFLayerTreeHost : public CACFLayerTreeHost { 37 class WKCACFViewLayerTreeHost : public CACFLayerTreeHost { 39 38 public: 40 static PassRefPtr<LegacyCACFLayerTreeHost> create(); 41 virtual ~LegacyCACFLayerTreeHost(); 39 static PassRefPtr<WKCACFViewLayerTreeHost> create(); 42 40 43 41 private: 44 LegacyCACFLayerTreeHost();42 WKCACFViewLayerTreeHost(); 45 43 46 void initD3DGeometry(); 47 48 // Call this when the device window has changed size or when IDirect3DDevice9::Present returns 49 // D3DERR_DEVICELOST. Returns true if the device was recovered, false if rendering must be 50 // aborted and reattempted soon. 51 enum ResetReason { ChangedWindowSize, LostDevice }; 52 bool resetDevice(ResetReason); 53 54 void renderSoon(); 55 void renderTimerFired(Timer<LegacyCACFLayerTreeHost>*); 44 void updateViewIfNeeded(); 45 static void contextDidChangeCallback(WKCACFViewRef, void* info); 56 46 57 47 virtual void initializeContext(void* userData, PlatformCALayer*); … … 59 49 virtual bool createRenderer(); 60 50 virtual void destroyRenderer(); 61 virtual CFTimeInterval lastCommitTime() const;62 51 virtual void flushContext(); 52 virtual void contextDidChange(); 63 53 virtual void paint(); 64 54 virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); 55 virtual CFTimeInterval lastCommitTime() const; 65 56 66 Timer<LegacyCACFLayerTreeHost> m_renderTimer; 67 COMPtr<IDirect3DDevice9> m_d3dDevice; 68 WKCACFContext* m_context; 69 bool m_mightBeAbleToCreateDeviceLater; 70 bool m_mustResetLostDeviceBeforeRendering; 71 72 #ifndef NDEBUG 73 bool m_printTree; 74 #endif 57 RetainPtr<WKCACFViewRef> m_view; 58 bool m_viewNeedsUpdate; 75 59 }; 76 60 … … 79 63 #endif // USE(ACCELERATED_COMPOSITING) 80 64 81 #endif // LegacyCACFLayerTreeHost_h65 #endif // WKCACFViewLayerTreeHost_h
Note: See TracChangeset
for help on using the changeset viewer.