WebKit/win/FullscreenVideoController.h

3939namespace WebCore {
4040class GraphicsContext;
4141#if USE(ACCELERATED_COMPOSITING)
42 class WKCACFLayer;
 42class PlatformCALayer;
4343#endif
4444}
4545

157157 WebCore::IntPoint m_hudPosition;
158158 OwnPtr<WebCore::MediaPlayerPrivateFullscreenWindow> m_fullscreenWindow;
159159#if USE(ACCELERATED_COMPOSITING)
160  RefPtr<WebCore::WKCACFLayer> m_rootChild;
161  class LayoutClient;
162  friend class LayoutClient;
163  OwnPtr<LayoutClient> m_layoutClient;
 160 class LayerClient;
 161 friend class LayerClient;
 162 OwnPtr<LayerClient> m_layerClient;
 163 RefPtr<WebCore::PlatformCALayer> m_rootChild;
164164#endif
165165
166166 HUDButton m_playPauseButton;
75227

WebKit/win/ChangeLog

 12011-01-07 Chris Marrin <cmarrin@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations
 6 https://bugs.webkit.org/show_bug.cgi?id=49388
 7
 8 Change client API for the fullscreen video controller. It now uses a
 9 PlatformCALayerClient so it can use a PlaformCALayer directly. Also
 10 updated how to connect the layer tree to the view to reflect the updated
 11 hardware compositing logic.
 12
 13 * FullscreenVideoController.cpp:
 14 (FullscreenVideoController::LayerClient::LayerClient):
 15 (FullscreenVideoController::LayerClient::platformCALayerRespondsToLayoutChanges):
 16 (FullscreenVideoController::LayerClient::platformCALayerAnimationStarted):
 17 (FullscreenVideoController::LayerClient::platformCALayerContentsOrientation):
 18 (FullscreenVideoController::LayerClient::platformCALayerPaintContents):
 19 (FullscreenVideoController::LayerClient::platformCALayerShowDebugBorders):
 20 (FullscreenVideoController::LayerClient::platformCALayerShowRepaintCounter):
 21 (FullscreenVideoController::LayerClient::platformCALayerIncrementRepaintCount):
 22 (FullscreenVideoController::LayerClient::platformCALayerContentsOpaque):
 23 (FullscreenVideoController::LayerClient::platformCALayerDrawsContent):
 24 (FullscreenVideoController::LayerClient::platformCALayerLayerDidDisplay):
 25 (FullscreenVideoController::LayerClient::platformCALayerLayoutSublayersOfLayer):
 26 (FullscreenVideoController::FullscreenVideoController):
 27 (FullscreenVideoController::~FullscreenVideoController):
 28 (FullscreenVideoController::enterFullscreen):
 29 * FullscreenVideoController.h:
 30 * WebCoreSupport/WebChromeClient.cpp:
 31 (WebChromeClient::attachRootGraphicsLayer):
 32 (WebChromeClient::scheduleCompositingLayerSync):
 33 * WebView.cpp:
 34 (WebView::setRootChildLayer):
 35 (WebView::animationsStarted):
 36 (WebView::syncCompositingState):
 37 * WebView.h:
 38 (WebView::setRootLayerNeedsDisplay):
 39
1402011-01-05 Steve Falkenburg <sfalken@apple.com>
241
342 Reviewed by Darin Adler.
75256

WebKit/win/WebView.cpp

62316231}
62326232
62336233#if USE(ACCELERATED_COMPOSITING)
6234 void WebView::setRootChildLayer(WebCore::WKCACFLayer* layer)
 6234void WebView::setRootChildLayer(WebCore::PlatformCALayer* layer)
62356235{
62366236 setAcceleratedCompositing(layer ? true : false);
62376237 if (m_layerRenderer)

64696469
64706470 return !frameView->layoutPending();
64716471}
 6472
 6473void WebView::animationsStarted(CFTimeInterval t)
 6474{
 6475 // Tell the animation controller that its animations have started
 6476 m_page->mainFrame()->animation()->notifyAnimationStarted(0, t);
 6477}
 6478
 6479void WebView::syncCompositingState()
 6480{
 6481 Frame* coreFrame = core(m_mainFrame);
 6482 if (coreFrame && coreFrame->view())
 6483 coreFrame->view()->syncCompositingStateRecursive();
 6484}
 6485
64726486#endif
64736487
64746488class EnumTextMatches : public IEnumTextMatches
75227

WebKit/win/WebCoreSupport/WebChromeClient.cpp

820820#if USE(ACCELERATED_COMPOSITING)
821821void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
822822{
823  m_webView->setRootChildLayer(graphicsLayer ? static_cast<WKCACFLayer*>(graphicsLayer->platformLayer()) : 0);
 823 m_webView->setRootChildLayer(graphicsLayer ? PlatformCALayer::platformCALayer(graphicsLayer->platformLayer()) : 0);
824824}
825825
826826void WebChromeClient::scheduleCompositingLayerSync()
827827{
828  m_webView->setRootLayerNeedsDisplay();
 828 m_webView->setRootLayerNeedsDisplay(true);
829829}
830830
831831#endif
75227

WebKit/win/FullscreenVideoController.cpp

3838#include <WebCore/FontSelector.h>
3939#include <WebCore/GraphicsContext.h>
4040#include <WebCore/Page.h>
 41#include <WebCore/PlatformCALayer.h>
4142#include <WebCore/TextRun.h>
42 #include <WebCore/WKCACFLayer.h>
4343#include <WebKitSystemInterface/WebKitSystemInterface.h>
4444#include <windowsx.h>
4545#include <wtf/StdLibExtras.h>

174174}
175175
176176#if USE(ACCELERATED_COMPOSITING)
177 class FullscreenVideoController::LayoutClient : public WKCACFLayerLayoutClient {
 177class FullscreenVideoController::LayerClient : public WebCore::PlatformCALayerClient {
178178public:
179  LayoutClient(FullscreenVideoController* parent);
180  void layoutSublayersOfLayer(WKCACFLayer* layer);
 179 LayerClient(FullscreenVideoController* parent) : m_parent(parent) { }
181180
 181private:
 182 virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*);
 183 virtual bool platformCALayerRespondsToLayoutChanges() const { return true; }
 184
 185 virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime) { }
 186 virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return GraphicsLayer::CompositingCoordinatesBottomUp; }
 187 virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) { }
 188 virtual bool platformCALayerShowDebugBorders() const { return false; }
 189 virtual bool platformCALayerShowRepaintCounter() const { return false; }
 190 virtual int platformCALayerIncrementRepaintCount() { return 0; }
 191
 192 virtual bool platformCALayerContentsOpaque() const { return false; }
 193 virtual bool platformCALayerDrawsContent() const { return false; }
 194 virtual void platformCALayerLayerDidDisplay(PlatformLayer*) { }
 195
182196 FullscreenVideoController* m_parent;
183197};
184198
185 FullscreenVideoController::LayoutClient::LayoutClient(FullscreenVideoController* parent)
186  : m_parent(parent)
 199void FullscreenVideoController::LayerClient::platformCALayerLayoutSublayersOfLayer(PlatformCALayer* layer)
187200{
188 }
189 
190 void FullscreenVideoController::LayoutClient::layoutSublayersOfLayer(WKCACFLayer* layer)
191 {
192201 ASSERT_ARG(layer, layer == m_parent->m_rootChild);
193202
194203 HTMLMediaElement* mediaElement = m_parent->m_mediaElement.get();
195204 if (!mediaElement)
196205 return;
197206
198  WKCACFLayer* videoLayer = mediaElement->platformLayer();
 207
 208 PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(mediaElement->platformLayer());
199209 if (!videoLayer || videoLayer->superlayer() != layer)
200210 return;
201211

232242 , m_movingWindow(false)
233243 , m_timer(this, &FullscreenVideoController::timerFired)
234244#if USE(ACCELERATED_COMPOSITING)
235  , m_rootChild(WKCACFLayer::create(WKCACFLayer::Layer))
236  , m_layoutClient(new LayoutClient(this))
 245 , m_layerClient(new LayerClient(this))
 246 , m_rootChild(PlatformCALayer::create(PlatformCALayer::LayerTypeLayer, m_layerClient.get()))
237247#endif
238248 , m_fullscreenWindow(new MediaPlayerPrivateFullscreenWindow(this))
239249{
240 #if USE(ACCELERATED_COMPOSITING)
241  m_rootChild->setLayoutClient(m_layoutClient.get());
242 #endif
243250}
244251
245252FullscreenVideoController::~FullscreenVideoController()
246253{
247254#if USE(ACCELERATED_COMPOSITING)
248  m_rootChild->setLayoutClient(0);
 255 m_rootChild->setOwner(0);
249256#endif
250257}
251258

273280#if USE(ACCELERATED_COMPOSITING)
274281 m_fullscreenWindow->setRootChildLayer(m_rootChild);
275282
276  WKCACFLayer* videoLayer = m_mediaElement->platformLayer();
277  m_rootChild->addSublayer(videoLayer);
 283 PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(m_mediaElement->platformLayer());
 284 m_rootChild->appendSublayer(videoLayer);
278285 m_rootChild->setNeedsLayout();
279286 m_rootChild->setGeometryFlipped(1);
280287#endif
75227

WebKit/win/WebView.h

4040#include <wtf/RefPtr.h>
4141
4242#if USE(ACCELERATED_COMPOSITING)
43 #include <WebCore/WKCACFLayer.h>
 43#include <WebCore/PlatformCALayer.h>
4444#include <WebCore/WKCACFLayerRenderer.h>
4545#endif
4646

904904 void downloadURL(const WebCore::KURL&);
905905
906906#if USE(ACCELERATED_COMPOSITING)
907  void setRootLayerNeedsDisplay() { if (m_layerRenderer) m_layerRenderer->setNeedsDisplay(); }
908  void setRootChildLayer(WebCore::WKCACFLayer* layer);
 907 void setRootLayerNeedsDisplay(bool sync = false)
 908 {
 909 if (m_layerRenderer)
 910 m_layerRenderer->setNeedsDisplay(sync);
 911 }
 912 void setRootChildLayer(WebCore::PlatformCALayer*);
909913#endif
910914
911915 void enterFullscreenForNode(WebCore::Node*);

941945#if USE(ACCELERATED_COMPOSITING)
942946 // WKCACFLayerRendererClient
943947 virtual bool shouldRender() const;
 948 virtual void animationsStarted(CFTimeInterval);
 949 virtual void syncCompositingState();
944950#endif
945951
946952protected:
75227

WebCore/config.h

220220#define WTF_USE_SAFARI_THEME 1
221221#endif
222222
 223// CoreAnimation is available to IOS, Mac and Windows if using CG
 224#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && PLATFORM(CG))
 225#define WTF_PLATFORM_CA 1
 226#endif
 227
223228#if PLATFORM(QT) && USE(V8) && defined(Q_WS_X11)
224229/* protect ourselves from evil X11 defines */
225230#include <bridge/npruntime_internal.h>
75227

WebCore/ChangeLog

 12011-01-07 Chris Marrin <cmarrin@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations
 6 https://bugs.webkit.org/show_bug.cgi?id=49388
 7
 8 Final step in unifying GraphicsLayer logic across Win and Mac. This
 9 implements the Windows side classes for PlatformCALayer and supporting
 10 classes. Also changed MediaPlayer to use new PlatformCALayerClient
 11 so it can use PlatformCALayer directly rather than a dummy GraphicsLayer.
 12 WKCACFLayerRenderer now does the task of notifying animations of their
 13 start time. Also commented out an assert in AnimationBase because
 14 AnimationController's frame time is not in sync with the new
 15 AnimationTimeController. I've opened a new bug for that issue:
 16
 17 https://bugs.webkit.org/show_bug.cgi?id=52037
 18
 19
 20 * WebCore.vcproj/WebCore.vcproj:
 21 * WebCore.vcproj/WebCoreCommon.vsprops:
 22 * WebCore.vcproj/copyForwardingHeaders.cmd:
 23 * WebCore.xcodeproj/project.pbxproj:
 24 * config.h:
 25 * page/animation/AnimationBase.cpp:
 26 (WebCore::AnimationBase::freezeAtTime):
 27 (WebCore::AnimationBase::getElapsedTime):
 28 * page/animation/AnimationController.cpp:
 29 (WebCore::AnimationControllerPrivate::beginAnimationUpdateTime):
 30 * page/animation/KeyframeAnimation.cpp:
 31 (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty):
 32 * platform/graphics/GraphicsLayer.h:
 33 (WebCore::GraphicsLayer::layerDidDisplay):
 34 (WebCore::GraphicsLayer::showDebugBorders):
 35 (WebCore::GraphicsLayer::showRepaintCounter):
 36 * platform/graphics/ca/GraphicsLayerCA.cpp:
 37 (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted):
 38 (WebCore::GraphicsLayerCA::setContentsToImage):
 39 (WebCore::GraphicsLayerCA::setContentsToMedia):
 40 (WebCore::GraphicsLayerCA::layerDidDisplay):
 41 (WebCore::GraphicsLayerCA::updateSublayerList):
 42 * platform/graphics/ca/GraphicsLayerCA.h:
 43 (WebCore::GraphicsLayerCA::platformCALayer):
 44 (WebCore::GraphicsLayerCA::platformCALayerLayoutSublayersOfLayer):
 45 (WebCore::GraphicsLayerCA::platformCALayerRespondsToLayoutChanges):
 46 (WebCore::GraphicsLayerCA::platformCALayerContentsOrientation):
 47 (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
 48 (WebCore::GraphicsLayerCA::platformCALayerShowDebugBorders):
 49 (WebCore::GraphicsLayerCA::platformCALayerShowRepaintCounter):
 50 (WebCore::GraphicsLayerCA::platformCALayerIncrementRepaintCount):
 51 (WebCore::GraphicsLayerCA::platformCALayerContentsOpaque):
 52 (WebCore::GraphicsLayerCA::platformCALayerDrawsContent):
 53 (WebCore::GraphicsLayerCA::platformCALayerLayerDidDisplay):
 54 * platform/graphics/ca/PlatformCAAnimation.h:
 55 * platform/graphics/ca/PlatformCALayer.h:
 56 (WebCore::PlatformCALayer::owner):
 57 (WebCore::PlatformCALayer::animationStarted):
 58 * platform/graphics/ca/PlatformCALayerClient.h: Copied from WebCore/platform/graphics/ca/PlatformCALayerClient.h.
 59 * platform/graphics/ca/mac/PlatformCALayerMac.mm:
 60 (PlatformCALayer::setOwner):
 61 (PlatformCALayer::create):
 62 (PlatformCALayer::PlatformCALayer):
 63 (PlatformCALayer::contents):
 64 (PlatformCALayer::setContents):
 65 * platform/graphics/ca/win: Added.
 66 * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: Added.
 67 * platform/graphics/ca/win/PlatformCALayerWin.cpp: Added.
 68 * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: Added.
 69 * platform/graphics/ca/win/PlatformCALayerWinInternal.h: Added.
 70 (WebCore::PlatformCALayerWinInternal::owner):
 71 * platform/graphics/mac/WebGLLayer.mm:
 72 (-[WebGLLayer display]):
 73 * platform/graphics/mac/WebLayer.h:
 74 * platform/graphics/mac/WebLayer.mm:
 75 (drawLayerContents):
 76 (setLayerNeedsDisplayInRect):
 77 (-[WebLayer setNeedsDisplay]):
 78 (-[WebLayer display]):
 79 * platform/graphics/mac/WebTiledLayer.mm:
 80 (-[WebTiledLayer setNeedsDisplay]):
 81 (-[WebTiledLayer display]):
 82 * platform/graphics/win/GraphicsContextCGWin.cpp:
 83 (WebCore::CGContextWithHDC):
 84 * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
 85 (WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer):
 86 (WebCore::MediaPlayerPrivateFullscreenWindow::wndProc):
 87 * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
 88 (WebCore::MediaPlayerPrivateFullscreenWindow::rootChildLayer):
 89 * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
 90 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::~LayerClient):
 91 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerRespondsToLayoutChanges):
 92 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerAnimationStarted):
 93 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerContentsOrientation):
 94 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerPaintContents):
 95 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerShowDebugBorders):
 96 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerShowRepaintCounter):
 97 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerIncrementRepaintCount):
 98 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerContentsOpaque):
 99 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerDrawsContent):
 100 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerLayerDidDisplay):
 101 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerLayoutSublayersOfLayer):
 102 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext):
 103 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::platformMedia):
 104 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage):
 105 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::createLayerForMovie):
 106 * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
 107 * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
 108 (WebCore::MediaPlayerPrivate::movieNewImageAvailable):
 109 (WebCore::MediaPlayerPrivate::createLayerForMovie):
 110 * platform/graphics/win/WKCACFLayerRenderer.cpp:
 111 (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer):
 112 (WebCore::WKCACFLayerRenderer::rootLayer):
 113 (WebCore::WKCACFLayerRenderer::addPendingAnimatedLayer):
 114 (WebCore::WKCACFLayerRenderer::setRootChildLayer):
 115 (WebCore::WKCACFLayerRenderer::setNeedsDisplay):
 116 (WebCore::WKCACFLayerRenderer::destroyRenderer):
 117 (WebCore::WKCACFLayerRenderer::render):
 118 * platform/graphics/win/WKCACFLayerRenderer.h:
 119 (WebCore::WKCACFLayerRendererClient::animationsStarted):
 120 (WebCore::WKCACFLayerRendererClient::syncCompositingState):
 121 * rendering/RenderLayerBacking.cpp:
 122 (WebCore::RenderLayerBacking::showDebugBorders):
 123 (WebCore::RenderLayerBacking::showRepaintCounter):
 124 * rendering/RenderLayerCompositor.cpp:
 125 (WebCore::RenderLayerCompositor::ensureRootPlatformLayer):
 126 * rendering/RenderLayerCompositor.h:
 127 (WebCore::RenderLayerCompositor::compositorShowDebugBorders):
 128 (WebCore::RenderLayerCompositor::compositorShowRepaintCounter):
 129 (WebCore::RenderLayerCompositor::notifyAnimationStarted):
 130 (WebCore::RenderLayerCompositor::notifySyncRequired):
 131 (WebCore::RenderLayerCompositor::paintContents):
 132 (WebCore::RenderLayerCompositor::showDebugBorders):
 133 (WebCore::RenderLayerCompositor::showRepaintCounter):
 134
11352011-01-07 Alejandro G. Castro <alex@igalia.com>
2136
3137 Reviewed by Martin Robinson.
75256

WebCore/WebCore.vcproj/WebCore.vcproj

2699626996 >
2699726997 </File>
2699826998 <File
26999  RelativePath="..\platform\graphics\win\GraphicsLayerCACF.cpp"
27000  >
27001  <FileConfiguration
27002  Name="Debug_Cairo_CFLite|Win32"
27003  ExcludedFromBuild="true"
27004  >
27005  <Tool
27006  Name="VCCLCompilerTool"
27007  />
27008  </FileConfiguration>
27009  <FileConfiguration
27010  Name="Release_Cairo_CFLite|Win32"
27011  ExcludedFromBuild="true"
27012  >
27013  <Tool
27014  Name="VCCLCompilerTool"
27015  />
27016  </FileConfiguration>
27017  </File>
27018  <File
27019  RelativePath="..\platform\graphics\win\GraphicsLayerCACF.h"
27020  >
27021  <FileConfiguration
27022  Name="Debug_Cairo_CFLite|Win32"
27023  ExcludedFromBuild="true"
27024  >
27025  <Tool
27026  Name="VCCustomBuildTool"
27027  />
27028  </FileConfiguration>
27029  <FileConfiguration
27030  Name="Release_Cairo_CFLite|Win32"
27031  ExcludedFromBuild="true"
27032  >
27033  <Tool
27034  Name="VCCustomBuildTool"
27035  />
27036  </FileConfiguration>
27037  </File>
27038  <File
2703926999 RelativePath="..\platform\graphics\win\IconWin.cpp"
2704027000 >
2704127001 </File>

2732827288 >
2732927289 </File>
2733027290 <File
27331  RelativePath="..\platform\graphics\win\WebLayer.cpp"
27332  >
27333  <FileConfiguration
27334  Name="Debug_Cairo_CFLite|Win32"
27335  ExcludedFromBuild="true"
27336  >
27337  <Tool
27338  Name="VCCLCompilerTool"
27339  />
27340  </FileConfiguration>
27341  <FileConfiguration
27342  Name="Release_Cairo_CFLite|Win32"
27343  ExcludedFromBuild="true"
27344  >
27345  <Tool
27346  Name="VCCLCompilerTool"
27347  />
27348  </FileConfiguration>
27349  </File>
27350  <File
27351  RelativePath="..\platform\graphics\win\WebLayer.h"
27352  >
27353  <FileConfiguration
27354  Name="Debug_Cairo_CFLite|Win32"
27355  ExcludedFromBuild="true"
27356  >
27357  <Tool
27358  Name="VCCustomBuildTool"
27359  />
27360  </FileConfiguration>
27361  <FileConfiguration
27362  Name="Release_Cairo_CFLite|Win32"
27363  ExcludedFromBuild="true"
27364  >
27365  <Tool
27366  Name="VCCustomBuildTool"
27367  />
27368  </FileConfiguration>
27369  </File>
27370  <File
27371  RelativePath="..\platform\graphics\win\WebTiledLayer.cpp"
27372  >
27373  <FileConfiguration
27374  Name="Debug_Cairo_CFLite|Win32"
27375  ExcludedFromBuild="true"
27376  >
27377  <Tool
27378  Name="VCCLCompilerTool"
27379  />
27380  </FileConfiguration>
27381  <FileConfiguration
27382  Name="Release_Cairo_CFLite|Win32"
27383  ExcludedFromBuild="true"
27384  >
27385  <Tool
27386  Name="VCCLCompilerTool"
27387  />
27388  </FileConfiguration>
27389  </File>
27390  <File
27391  RelativePath="..\platform\graphics\win\WebTiledLayer.h"
27392  >
27393  <FileConfiguration
27394  Name="Debug_Cairo_CFLite|Win32"
27395  ExcludedFromBuild="true"
27396  >
27397  <Tool
27398  Name="VCCustomBuildTool"
27399  />
27400  </FileConfiguration>
27401  <FileConfiguration
27402  Name="Release_Cairo_CFLite|Win32"
27403  ExcludedFromBuild="true"
27404  >
27405  <Tool
27406  Name="VCCustomBuildTool"
27407  />
27408  </FileConfiguration>
27409  </File>
27410  <File
2741127291 RelativePath="..\platform\graphics\win\WKCACFContextFlusher.cpp"
2741227292 >
2741327293 <FileConfiguration

2744827328 </FileConfiguration>
2744927329 </File>
2745027330 <File
27451  RelativePath="..\platform\graphics\win\WKCACFLayer.cpp"
27452  >
27453  <FileConfiguration
27454  Name="Debug_Cairo_CFLite|Win32"
27455  ExcludedFromBuild="true"
27456  >
27457  <Tool
27458  Name="VCCLCompilerTool"
27459  />
27460  </FileConfiguration>
27461  <FileConfiguration
27462  Name="Release_Cairo_CFLite|Win32"
27463  ExcludedFromBuild="true"
27464  >
27465  <Tool
27466  Name="VCCLCompilerTool"
27467  />
27468  </FileConfiguration>
27469  </File>
27470  <File
27471  RelativePath="..\platform\graphics\win\WKCACFLayer.h"
27472  >
27473  <FileConfiguration
27474  Name="Debug_Cairo_CFLite|Win32"
27475  ExcludedFromBuild="true"
27476  >
27477  <Tool
27478  Name="VCCustomBuildTool"
27479  />
27480  </FileConfiguration>
27481  <FileConfiguration
27482  Name="Release_Cairo_CFLite|Win32"
27483  ExcludedFromBuild="true"
27484  >
27485  <Tool
27486  Name="VCCustomBuildTool"
27487  />
27488  </FileConfiguration>
27489  </File>
27490  <File
2749127331 RelativePath="..\platform\graphics\win\WKCACFLayerRenderer.cpp"
2749227332 >
2749327333 <FileConfiguration

2895628796 >
2895728797 </File>
2895828798 </Filter>
28959  </Filter>
 28799 <Filter
 28800 Name="ca"
 28801 >
 28802 <File
 28803 RelativePath="..\platform\graphics\ca\GraphicsLayerCA.cpp"
 28804 >
 28805 </File>
 28806 <File
 28807 RelativePath="..\platform\graphics\ca\GraphicsLayerCA.h"
 28808 >
 28809 </File>
 28810 <File
 28811 RelativePath="..\platform\graphics\ca\PlatformCAAnimation.h"
 28812 >
 28813 </File>
 28814 <File
 28815 RelativePath="..\platform\graphics\ca\PlatformCALayer.h"
 28816 >
 28817 </File>
 28818 <File
 28819 RelativePath="..\platform\graphics\ca\PlatformCALayerClient.h"
 28820 >
 28821 </File>
 28822 <File
 28823 RelativePath="..\platform\graphics\ca\TransformationMatrixCA.cpp"
 28824 >
 28825 </File>
 28826 <Filter
 28827 Name="win"
 28828 >
 28829 <File
 28830 RelativePath="..\platform\graphics\ca\win\PlatformCAAnimationWin.cpp"
 28831 >
 28832 </File>
 28833 <File
 28834 RelativePath="..\platform\graphics\ca\win\PlatformCALayerWin.cpp"
 28835 >
 28836 </File>
 28837 <File
 28838 RelativePath="..\platform\graphics\ca\win\PlatformCALayerWinInternal.cpp"
 28839 >
 28840 </File>
 28841 <File
 28842 RelativePath="..\platform\graphics\ca\win\PlatformCALayerWinInternal.h"
 28843 >
 28844 </File>
 28845 </Filter>
 28846 </Filter>
 28847 </Filter>
2896028848 <Filter
2896128849 Name="network"
2896228850 >
75227

WebCore/WebCore.vcproj/copyForwardingHeaders.cmd

3838xcopy /y /d "%ProjectDir%..\platform\graphics\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
3939xcopy /y /d "%ProjectDir%..\platform\graphics\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
4040xcopy /y /d "%ProjectDir%..\platform\graphics\transforms\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
 41xcopy /y /d "%ProjectDir%..\platform\graphics\ca\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
4142xcopy /y /d "%ProjectDir%..\platform\graphics\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
4243xcopy /y /d "%ProjectDir%..\platform\graphics\win\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
4344xcopy /y /d "%ProjectDir%..\platform\graphics\opentype\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
75227

WebCore/WebCore.vcproj/WebCoreCommon.vsprops

77 >
88 <Tool
99 Name="VCCLCompilerTool"
10  AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\fileapi&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\rendering\svg&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\bindings\js\specialization&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\html\parser&quot;;&quot;$(ProjectDir)..\html\shadow&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\cache&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\mathml&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(ConfigurationBuildDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\properties&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(ConfigurationBuildDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\zlib&quot;"
 10 AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\fileapi&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\rendering\svg&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\bindings\js\specialization&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\html\parser&quot;;&quot;$(ProjectDir)..\html\shadow&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\cache&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\mathml&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\ca&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(ConfigurationBuildDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\properties&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(ConfigurationBuildDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\zlib&quot;"
1111 PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
1212 UsePrecompiledHeader="2"
1313 PrecompiledHeaderThrough="WebCorePrefix.h"
75227

WebCore/page/animation/AnimationController.cpp

317317{
318318 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet)
319319 m_beginAnimationUpdateTime = m_frame->currentAnimationTime();
 320
320321 return m_beginAnimationUpdateTime;
321322}
322323
75227

WebCore/page/animation/KeyframeAnimation.cpp

7474
7575 double fractionalTime = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1;
7676
77  ASSERT(fractionalTime >= 0);
 77 // FIXME: startTime can be before the current animation "frame" time. This is to sync with the frame time
 78 // concept in AnimationTimeController. So we need to somehow sync the two. Until then, the possible
 79 // error is small and will probably not be noticeable. Until we fix this, remove the assert.
 80 // https://bugs.webkit.org/show_bug.cgi?id=52037
 81 // ASSERT(fractionalTime >= 0);
7882 if (fractionalTime < 0)
7983 fractionalTime = 0;
8084
75227

WebCore/page/animation/AnimationBase.cpp

13621362
13631363void AnimationBase::freezeAtTime(double t)
13641364{
 1365 if (!m_startTime) {
 1366 // If we haven't started yet, just generate the start event now
 1367 m_compAnim->animationController()->receivedStartTimeResponse(currentTime());
 1368 }
 1369
13651370 ASSERT(m_startTime); // if m_startTime is zero, we haven't started yet, so we'll get a bad pause time.
13661371 m_pauseTime = m_startTime + t - m_animation->delay();
13671372

13871392 return 0;
13881393 if (postActive())
13891394 return 1;
 1395
13901396 return beginAnimationUpdateTime() - m_startTime;
13911397}
13921398
75227

WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

105105 return sHaveValueFunction;
106106}
107107
108 void PlatformCALayer::setOwner(GraphicsLayerCA* owner)
 108void PlatformCALayer::setOwner(PlatformCALayerClient* owner)
109109{
110110 m_owner = owner;
111111

145145}
146146#endif
147147
148 PassRefPtr<PlatformCALayer> PlatformCALayer::create(LayerType layerType, GraphicsLayerCA* owner)
 148PassRefPtr<PlatformCALayer> PlatformCALayer::create(LayerType layerType, PlatformCALayerClient* owner)
149149{
150150 return adoptRef(new PlatformCALayer(layerType, 0, owner));
151151}
152152
153 PassRefPtr<PlatformCALayer> PlatformCALayer::create(void* platformLayer, GraphicsLayerCA* owner)
 153PassRefPtr<PlatformCALayer> PlatformCALayer::create(void* platformLayer, PlatformCALayerClient* owner)
154154{
155155 return adoptRef(new PlatformCALayer(LayerTypeCustom, static_cast<PlatformLayer*>(platformLayer), owner));
156156}
157157
158 PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, GraphicsLayerCA* owner)
 158PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
159159 : m_owner(owner)
160160{
161161 BEGIN_BLOCK_OBJC_EXCEPTIONS

168168 Class layerClass = Nil;
169169 switch(layerType) {
170170 case LayerTypeLayer:
 171 case LayerTypeRootLayer:
171172 layerClass = [CALayer class];
172173 break;
173174 case LayerTypeWebLayer:

568569#endif
569570}
570571
571 void* PlatformCALayer::contents() const
 572CFTypeRef PlatformCALayer::contents() const
572573{
573574 return [m_layer.get() contents];
574575}
575576
576 void PlatformCALayer::setContents(void* value)
 577void PlatformCALayer::setContents(CFTypeRef value)
577578{
578579 BEGIN_BLOCK_OBJC_EXCEPTIONS
579  [m_layer.get() setContents:static_cast<id>(value)];
 580 [m_layer.get() setContents:static_cast<id>(const_cast<void*>(value))];
580581 END_BLOCK_OBJC_EXCEPTIONS
581582}
582583
75227

WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

640640 noteLayerPropertyChanged(AnimationChanged);
641641}
642642
643 void GraphicsLayerCA::animationStarted(CFTimeInterval startTime)
 643void GraphicsLayerCA::platformCALayerAnimationStarted(CFTimeInterval startTime)
644644{
645645 if (m_client)
646646 m_client->notifyAnimationStarted(this, startTime);

660660
661661 m_uncorrectedContentsImage = newImage;
662662 m_pendingContentsImage = newImage;
 663
 664#if !PLATFORM(WIN)
663665 CGColorSpaceRef colorSpace = CGImageGetColorSpace(m_pendingContentsImage.get());
664666
665667 static CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();

669671 static CGColorSpaceRef genericRGB = CGDisplayCopyColorSpace(kCGDirectMainDisplay);
670672 m_pendingContentsImage.adoptCF(CGImageCreateCopyWithColorSpace(m_pendingContentsImage.get(), genericRGB));
671673 }
 674#endif
672675 m_contentsLayerPurpose = ContentsLayerForImage;
673676 if (!m_contentsLayer)
674677 noteSublayersChanged();

688691 if (m_contentsLayer && mediaLayer == m_contentsLayer->platformLayer())
689692 return;
690693
691  // Create the PlatformCALayer to wrap the incoming layer
692  m_contentsLayer = mediaLayer ? PlatformCALayer::create(mediaLayer, this) : 0;
693 
 694 // FIXME: The passed in layer might be a raw layer or an externally created
 695 // PlatformCALayer. To determine this we attempt to get the
 696 // PlatformCALayer pointer. If this returns a null pointer we assume it's
 697 // raw. This test might be invalid if the raw layer is, for instance, the
 698 // PlatformCALayer is using a user data pointer in the raw layer, and
 699 // the creator of the raw layer is using it for some other purpose.
 700 // For now we don't support such a case.
 701 PlatformCALayer* platformCALayer = PlatformCALayer::platformCALayer(mediaLayer);
 702 m_contentsLayer = mediaLayer ? (platformCALayer ? platformCALayer : PlatformCALayer::create(mediaLayer, this)) : 0;
694703 m_contentsLayerPurpose = mediaLayer ? ContentsLayerForMedia : NoContentsLayer;
695704
696705 noteSublayersChanged();

711720 noteLayerPropertyChanged(ContentsCanvasLayerChanged);
712721}
713722
714 void GraphicsLayerCA::didDisplay(PlatformLayer* layer)
 723void GraphicsLayerCA::layerDidDisplay(PlatformLayer* layer)
715724{
716725 PlatformCALayer* currentLayer = PlatformCALayer::platformCALayer(layer);
717726 PlatformCALayer* sourceLayer;

903912 newSublayers.append(childLayer);
904913 }
905914
906  for (size_t i = 0; i < newSublayers.size(); ++i)
 915 for (size_t i = 0; i < newSublayers.size(); --i)
907916 newSublayers[i]->removeFromSuperlayer();
908917 }
909918
75227

WebCore/platform/graphics/ca/GraphicsLayerCA.h

3131#include "GraphicsLayer.h"
3232#include "Image.h"
3333#include "PlatformCAAnimation.h"
 34#include "PlatformCALayerClient.h"
3435#include <wtf/HashMap.h>
3536#include <wtf/HashSet.h>
3637#include <wtf/RetainPtr.h>

4041
4142class PlatformCALayer;
4243
43 class GraphicsLayerCA : public GraphicsLayer {
 44class GraphicsLayerCA : public GraphicsLayer, public PlatformCALayerClient {
4445public:
4546 // The width and height of a single tile in a tiled layer. Should be large enough to
4647 // avoid lots of small tiles (and therefore lots of drawing callbacks), but small enough

4950
5051 GraphicsLayerCA(GraphicsLayerClient*);
5152 virtual ~GraphicsLayerCA();
52 
53  virtual void animationStarted(CFTimeInterval beginTime);
5453
5554 virtual void setName(const String&);
5655
5756 virtual PlatformLayer* platformLayer() const;
 57 virtual PlatformCALayer* platformCALayer() const { return primaryLayer(); }
5858
5959 virtual bool setChildren(const Vector<GraphicsLayer*>&);
6060 virtual void addChild(GraphicsLayer*);

112112 virtual void setDebugBackgroundColor(const Color&);
113113 virtual void setDebugBorder(const Color&, float borderWidth);
114114
115  virtual void didDisplay(PlatformLayer*);
 115 virtual void layerDidDisplay(PlatformLayer*);
116116
117117 void recursiveCommitChanges();
118118

123123 virtual void setOpacityInternal(float);
124124
125125private:
 126 // PlatformCALayerClient overrides
 127 virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*) { }
 128 virtual bool platformCALayerRespondsToLayoutChanges() const { return false; }
 129
 130 virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime);
 131 virtual CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return contentsOrientation(); }
 132 virtual void platformCALayerPaintContents(GraphicsContext& context, const IntRect& clip) { paintGraphicsLayerContents(context, clip); }
 133 virtual bool platformCALayerShowDebugBorders() const { return showDebugBorders(); }
 134 virtual bool platformCALayerShowRepaintCounter() const { return showRepaintCounter(); }
 135 virtual int platformCALayerIncrementRepaintCount() { return incrementRepaintCount(); }
 136
 137 virtual bool platformCALayerContentsOpaque() const { return contentsOpaque(); }
 138 virtual bool platformCALayerDrawsContent() const { return drawsContent(); }
 139 virtual void platformCALayerLayerDidDisplay(PlatformLayer* layer) { return layerDidDisplay(layer); }
 140
126141 void updateOpacityOnLayer();
127142
128143 PlatformCALayer* primaryLayer() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); }
75227

WebCore/platform/graphics/ca/PlatformCALayer.h

2929#if USE(ACCELERATED_COMPOSITING)
3030
3131#include "GraphicsContext.h"
32 #include "GraphicsLayerCA.h"
3332#include "PlatformCAAnimation.h"
 33#include "PlatformCALayerClient.h"
3434#include "PlatformString.h"
3535#include <wtf/HashMap.h>
3636#include <wtf/PassRefPtr.h>

4747
4848class PlatformCALayer : public RefCounted<PlatformCALayer> {
4949public:
50  // TiledLayer used in GraphicsLayer has constant settings:
51  // cTiledLayerTileSize = 512
52  // setTileSize:(cTiledLayerTileSize, cTiledLayerTileSize)
53  // setLevelsOfDetail:1
54  // setLevelsOfDetailBias:0
55  // setContentsGravity:@"bottomLeft"
56  //
57  // TiledLayer also has drawing functions like WebLayer
58  //
59  // WebLayer is a CALayer with drawing functions specific to WebKit
60  //
61  // Layer and TransformLayer are used as is
62 
63  enum LayerType { LayerTypeLayer, LayerTypeWebLayer, LayerTypeTransformLayer, LayerTypeWebTiledLayer, LayerTypeCustom };
 50 // LayerTypeRootLayer is used on some platforms. It has no backing store, so setNeedsDisplay
 51 // should not call CACFLayerSetNeedsDisplay, but rather just notify the renderer that it
 52 // has changed and should be re-rendered.
 53 enum LayerType { LayerTypeLayer, LayerTypeWebLayer, LayerTypeTransformLayer, LayerTypeWebTiledLayer, LayerTypeRootLayer, LayerTypeCustom };
6454 enum FilterType { Linear, Nearest, Trilinear };
6555
66  static PassRefPtr<PlatformCALayer> create(LayerType, GraphicsLayerCA*);
 56 static PassRefPtr<PlatformCALayer> create(LayerType, PlatformCALayerClient*);
6757
6858 // This function passes the layer as a void* rather than a PlatformLayer because PlatformLayer
6959 // is defined differently for Obj C and C++. This allows callers from both languages.
70  static PassRefPtr<PlatformCALayer> create(void* platformLayer, GraphicsLayerCA*);
 60 static PassRefPtr<PlatformCALayer> create(void* platformLayer, PlatformCALayerClient*);
7161
7262 ~PlatformCALayer();
7363

7666 static PlatformCALayer* platformCALayer(void* platformLayer);
7767
7868 PlatformLayer* platformLayer() const;
 69
 70 PlatformCALayer* rootLayer() const;
7971
8072 static bool isValueFunctionSupported();
8173
82  GraphicsLayerCA* owner() const { return m_owner; }
83  void setOwner(GraphicsLayerCA* owner);
 74 PlatformCALayerClient* owner() const { return m_owner; }
 75 void setOwner(PlatformCALayerClient*);
8476
8577 void animationStarted(CFTimeInterval beginTime)
8678 {
8779 if (m_owner)
88  m_owner->animationStarted(beginTime);
 80 m_owner->platformCALayerAnimationStarted(beginTime);
8981 }
9082
 83 // Layout support
 84 void setNeedsLayout();
 85
 86
9187 void setNeedsDisplay(const FloatRect* dirtyRect = 0);
9288
 89 // This tells the layer tree to commit changes and perform a render, without do a setNeedsDisplay on any layer.
 90 void setNeedsCommit();
 91
9392 void setContentsChanged();
9493
9594 LayerType layerType() const { return m_layerType; }

104103 size_t sublayerCount() const;
105104
106105 // This method removes the sublayers from the source and reparents them to the current layer.
 106 // Any sublayers previously in the current layer are removed.
107107 void adoptSublayers(PlatformCALayer* source);
108108
109109 void addAnimationForKey(const String& key, PlatformCAAnimation* animation);

150150 bool acceleratesDrawing() const;
151151 void setAcceleratesDrawing(bool);
152152
153  void* contents() const;
154  void setContents(void*);
 153 CFTypeRef contents() const;
 154 void setContents(CFTypeRef);
155155
156156 FloatRect contentsRect() const;
157157 void setContentsRect(const FloatRect&);

183183 CFTimeInterval timeOffset() const;
184184 void setTimeOffset(CFTimeInterval);
185185
 186#if PLATFORM(WIN) && !defined(NDEBUG)
 187 void printTree() const;
 188#endif
 189
186190protected:
187  PlatformCALayer(LayerType, PlatformLayer*, GraphicsLayerCA*);
 191 PlatformCALayer(LayerType, PlatformLayer*, PlatformCALayerClient*);
188192
189193private:
190 
191  GraphicsLayerCA* m_owner;
 194 PlatformCALayerClient* m_owner;
192195 LayerType m_layerType;
193196
194197#if PLATFORM(MAC) || PLATFORM(WIN)
195198 RetainPtr<PlatformLayer> m_layer;
196199#endif
197200
 201#if PLATFORM(WIN)
 202 HashMap<String, RefPtr<PlatformCAAnimation> > m_animations;
 203#endif
 204
198205#if PLATFORM(MAC)
199206#ifdef __OBJC__
200207 RetainPtr<NSObject> m_delegate;
75227

WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp

 1/*
 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27
 28#if USE(ACCELERATED_COMPOSITING)
 29
 30#include "PlatformCALayerWinInternal.h"
 31
 32#include "Font.h"
 33#include "PlatformCALayer.h"
 34#include <QuartzCore/CACFLayer.h>
 35
 36using namespace std;
 37using namespace WebCore;
 38
 39// The width and height of a single tile in a tiled layer. Should be large enough to
 40// avoid lots of small tiles (and therefore lots of drawing callbacks), but small enough
 41// to keep the overall tile cost low.
 42static const int cTiledLayerTileSize = 512;
 43
 44PlatformCALayerWinInternal::PlatformCALayerWinInternal(PlatformCALayer* owner)
 45 : m_tileSize(CGSizeMake(cTiledLayerTileSize, cTiledLayerTileSize))
 46 , m_constrainedSize(constrainedSize(owner->bounds().size()))
 47 , m_owner(owner)
 48{
 49 if (m_owner->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 50 // Tiled layers are placed in a child layer that is always the first child of the TiledLayer
 51 m_tileParent.adoptCF(CACFLayerCreate(kCACFLayer));
 52 CACFLayerInsertSublayer(m_owner->platformLayer(), m_tileParent.get(), 0);
 53 updateTiles();
 54 }
 55}
 56
 57PlatformCALayerWinInternal::~PlatformCALayerWinInternal()
 58{
 59}
 60
 61void PlatformCALayerWinInternal::displayCallback(CACFLayerRef caLayer, CGContextRef context)
 62{
 63 if (!owner() || !owner()->owner())
 64 return;
 65
 66 CGContextSaveGState(context);
 67
 68 CGRect layerBounds = owner()->bounds();
 69 if (owner()->owner()->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
 70 CGContextScaleCTM(context, 1, -1);
 71 CGContextTranslateCTM(context, 0, -layerBounds.size.height);
 72 }
 73
 74 if (owner()->owner()) {
 75 GraphicsContext graphicsContext(context);
 76
 77 // It's important to get the clip from the context, because it may be significantly
 78 // smaller than the layer bounds (e.g. tiled layers)
 79 CGRect clipBounds = CGContextGetClipBoundingBox(context);
 80 IntRect clip(enclosingIntRect(clipBounds));
 81 owner()->owner()->platformCALayerPaintContents(graphicsContext, clip);
 82 }
 83#ifndef NDEBUG
 84 else {
 85 ASSERT_NOT_REACHED();
 86
 87 // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is a plain color,
 88 // so CA never makes backing store for it (which is what -setNeedsDisplay will do above).
 89 CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f);
 90 CGContextFillRect(context, layerBounds);
 91 }
 92#endif
 93
 94 if (owner()->owner()->platformCALayerShowRepaintCounter()) {
 95 String text = String::number(owner()->owner()->platformCALayerIncrementRepaintCount());
 96
 97 CGContextSaveGState(context);
 98
 99 // Make the background of the counter the same as the border color,
 100 // unless there is no border, then make it red
 101 float borderWidth = CACFLayerGetBorderWidth(caLayer);
 102 if (borderWidth > 0) {
 103 CGColorRef borderColor = CACFLayerGetBorderColor(caLayer);
 104 const CGFloat* colors = CGColorGetComponents(borderColor);
 105 CGContextSetRGBFillColor(context, colors[0], colors[1], colors[2], colors[3]);
 106 } else
 107 CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.8f);
 108
 109 CGRect aBounds = layerBounds;
 110
 111 aBounds.size.width = 10 + 10 * text.length();
 112 aBounds.size.height = 22;
 113 CGContextFillRect(context, aBounds);
 114
 115 FontDescription desc;
 116
 117 NONCLIENTMETRICS metrics;
 118 metrics.cbSize = sizeof(metrics);
 119 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
 120 FontFamily family;
 121 family.setFamily(metrics.lfSmCaptionFont.lfFaceName);
 122 desc.setFamily(family);
 123
 124 desc.setComputedSize(18);
 125
 126 Font font = Font(desc, 0, 0);
 127 font.update(0);
 128
 129 GraphicsContext cg(context);
 130 cg.setFillColor(Color::black, ColorSpaceDeviceRGB);
 131 cg.drawText(font, TextRun(text), IntPoint(aBounds.origin.x + 5, aBounds.origin.y + 17));
 132
 133 CGContextRestoreGState(context);
 134 }
 135
 136 CGContextRestoreGState(context);
 137
 138 owner()->owner()->platformCALayerLayerDidDisplay(caLayer);
 139}
 140
 141void PlatformCALayerWinInternal::internalSetNeedsDisplay(const FloatRect* dirtyRect)
 142{
 143 if (dirtyRect) {
 144 CGRect rect = *dirtyRect;
 145 CACFLayerSetNeedsDisplay(owner()->platformLayer(), &rect);
 146 } else
 147 CACFLayerSetNeedsDisplay(owner()->platformLayer(), 0);
 148}
 149
 150void PlatformCALayerWinInternal::setNeedsDisplay(const FloatRect* dirtyRect)
 151{
 152 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 153 // FIXME: Only setNeedsDisplay for tiles that are currently visible
 154 int numTileLayers = tileCount();
 155 CGRect rect;
 156 if (dirtyRect)
 157 rect = *dirtyRect;
 158 for (int i = 0; i < numTileLayers; ++i)
 159 CACFLayerSetNeedsDisplay(tileAtIndex(i), dirtyRect ? &rect : 0);
 160
 161 if (m_owner->owner() && m_owner->owner()->platformCALayerShowRepaintCounter()) {
 162 CGRect layerBounds = m_owner->bounds();
 163 CGRect indicatorRect = CGRectMake(layerBounds.origin.x, layerBounds.origin.y, 80, 25);
 164 CACFLayerSetNeedsDisplay(tileAtIndex(0), &indicatorRect);
 165 }
 166 } else if (owner()->layerType() == PlatformCALayer::LayerTypeWebLayer) {
 167 if (owner() && owner()->owner()) {
 168 if (owner()->owner()->platformCALayerShowRepaintCounter()) {
 169 FloatRect layerBounds = owner()->bounds();
 170 FloatRect repaintCounterRect = layerBounds;
 171
 172 // We assume a maximum of 4 digits and a font size of 18.
 173 repaintCounterRect.setWidth(80);
 174 repaintCounterRect.setHeight(22);
 175 if (owner()->owner()->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown)
 176 repaintCounterRect.setY(layerBounds.height() - (layerBounds.y() + repaintCounterRect.height()));
 177 internalSetNeedsDisplay(&repaintCounterRect);
 178 }
 179 if (dirtyRect && owner()->owner()->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
 180 FloatRect flippedDirtyRect = *dirtyRect;
 181 flippedDirtyRect.setY(owner()->bounds().height() - (flippedDirtyRect.y() + flippedDirtyRect.height()));
 182 internalSetNeedsDisplay(&flippedDirtyRect);
 183 return;
 184 }
 185 }
 186
 187 internalSetNeedsDisplay(dirtyRect);
 188 }
 189 owner()->setNeedsCommit();
 190}
 191
 192void PlatformCALayerWinInternal::setSublayers(const PlatformCALayerList& list)
 193{
 194 // Remove all the current sublayers and add the passed layers
 195 CACFLayerSetSublayers(owner()->platformLayer(), 0);
 196
 197 // Perform removeFromSuperLayer in a separate pass. CACF requires superlayer to
 198 // be null or CACFLayerInsertSublayer silently fails.
 199 for (size_t i = 0; i < list.size(); i++)
 200 CACFLayerRemoveFromSuperlayer(list[i]->platformLayer());
 201
 202 for (size_t i = 0; i < list.size(); i++)
 203 CACFLayerInsertSublayer(owner()->platformLayer(), list[i]->platformLayer(), i);
 204
 205 owner()->setNeedsCommit();
 206
 207 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 208 // Preserve the tile parent after set
 209 CACFLayerInsertSublayer(owner()->platformLayer(), m_tileParent.get(), 0);
 210 }
 211}
 212
 213void PlatformCALayerWinInternal::removeAllSublayers()
 214{
 215 CACFLayerSetSublayers(owner()->platformLayer(), 0);
 216 owner()->setNeedsCommit();
 217
 218 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 219 // Restore the tile parent after removal
 220 CACFLayerInsertSublayer(owner()->platformLayer(), m_tileParent.get(), 0);
 221 }
 222}
 223
 224void PlatformCALayerWinInternal::insertSublayer(PlatformCALayer* layer, size_t index)
 225{
 226 index = min(index, sublayerCount());
 227 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 228 // Add 1 to account for the tile parent layer
 229 index++;
 230 }
 231
 232 layer->removeFromSuperlayer();
 233 CACFLayerInsertSublayer(owner()->platformLayer(), layer->platformLayer(), index);
 234 owner()->setNeedsCommit();
 235}
 236
 237size_t PlatformCALayerWinInternal::sublayerCount() const
 238{
 239 CFArrayRef sublayers = CACFLayerGetSublayers(owner()->platformLayer());
 240 size_t count = sublayers ? CFArrayGetCount(sublayers) : 0;
 241
 242 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 243 // Subtract 1 to account for the tile parent layer
 244 ASSERT(count > 0);
 245 count--;
 246 }
 247
 248 return count;
 249}
 250
 251int PlatformCALayerWinInternal::indexOfSublayer(const PlatformCALayer* reference)
 252{
 253 CACFLayerRef ref = reference->platformLayer();
 254 if (!ref)
 255 return -1;
 256
 257 CFArrayRef sublayers = CACFLayerGetSublayers(owner()->platformLayer());
 258 if (!sublayers)
 259 return -1;
 260
 261 size_t n = CFArrayGetCount(sublayers);
 262
 263 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 264 for (size_t i = 1; i < n; ++i) {
 265 if (CFArrayGetValueAtIndex(sublayers, i) == ref)
 266 return i - 1;
 267 }
 268 } else {
 269 for (size_t i = 0; i < n; ++i) {
 270 if (CFArrayGetValueAtIndex(sublayers, i) == ref)
 271 return i;
 272 }
 273 }
 274
 275 return -1;
 276}
 277
 278PlatformCALayer* PlatformCALayerWinInternal::sublayerAtIndex(int index) const
 279{
 280 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 281 // Add 1 to account for the tile parent layer
 282 index++;
 283 }
 284
 285 CFArrayRef sublayers = CACFLayerGetSublayers(owner()->platformLayer());
 286 if (!sublayers || index < 0 || CFArrayGetCount(sublayers) <= index)
 287 return 0;
 288
 289 return PlatformCALayer::platformCALayer(static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(sublayers, index))));
 290}
 291
 292void PlatformCALayerWinInternal::setBounds(const FloatRect& rect)
 293{
 294 if (CGRectEqualToRect(rect, owner()->bounds()))
 295 return;
 296
 297 CACFLayerSetBounds(owner()->platformLayer(), rect);
 298 owner()->setNeedsCommit();
 299
 300 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
 301 m_constrainedSize = constrainedSize(rect.size());
 302 updateTiles();
 303 }
 304}
 305
 306void PlatformCALayerWinInternal::setFrame(const FloatRect& rect)
 307{
 308 CGRect oldFrame = owner()->frame();
 309 if (CGRectEqualToRect(rect, oldFrame))
 310 return;
 311
 312 CACFLayerSetFrame(owner()->platformLayer(), rect);
 313 owner()->setNeedsCommit();
 314
 315 if (owner()->layerType() == PlatformCALayer::LayerTypeWebTiledLayer)
 316 updateTiles();
 317}
 318
 319CGSize PlatformCALayerWinInternal::constrainedSize(const CGSize& size) const
 320{
 321 const int cMaxTileCount = 512;
 322 const float cSqrtMaxTileCount = sqrtf(cMaxTileCount);
 323
 324 CGSize constrainedSize = size;
 325
 326 int tileColumns = ceilf(constrainedSize.width / m_tileSize.width);
 327 int tileRows = ceilf(constrainedSize.height / m_tileSize.height);
 328 int numTiles = tileColumns * tileRows;
 329
 330 // If number of tiles vertically or horizontally is < sqrt(cMaxTileCount)
 331 // just shorten the longer dimension. Otherwise shorten both dimensions
 332 // according to the ratio of width to height
 333
 334 if (numTiles > cMaxTileCount) {
 335 if (tileRows < cSqrtMaxTileCount)
 336 tileColumns = floorf(cMaxTileCount / tileRows);
 337 else if (tileColumns < cSqrtMaxTileCount)
 338 tileRows = floorf(cMaxTileCount / tileColumns);
 339 else {
 340 tileRows = ceilf(sqrtf(cMaxTileCount * constrainedSize.height / constrainedSize.width));
 341 tileColumns = floorf(cMaxTileCount / tileRows);
 342 }
 343
 344 constrainedSize.width = tileColumns * m_tileSize.width;
 345 constrainedSize.height = tileRows * m_tileSize.height;
 346 }
 347
 348 return constrainedSize;
 349}
 350
 351void PlatformCALayerWinInternal::tileDisplayCallback(CACFLayerRef layer, CGContextRef context)
 352{
 353 static_cast<PlatformCALayerWinInternal*>(CACFLayerGetUserData(layer))->drawTile(layer, context);
 354}
 355
 356void PlatformCALayerWinInternal::addTile()
 357{
 358 RetainPtr<CACFLayerRef> newLayer(AdoptCF, CACFLayerCreate(kCACFLayer));
 359 CACFLayerSetAnchorPoint(newLayer.get(), CGPointMake(0, 1));
 360 CACFLayerSetUserData(newLayer.get(), this);
 361 CACFLayerSetDisplayCallback(newLayer.get(), tileDisplayCallback);
 362
 363 CFArrayRef sublayers = CACFLayerGetSublayers(m_tileParent.get());
 364 CACFLayerInsertSublayer(m_tileParent.get(), newLayer.get(), sublayers ? CFArrayGetCount(sublayers) : 0);
 365
 366 if (owner()->owner()->platformCALayerShowDebugBorders()) {
 367 CGColorRef borderColor = CGColorCreateGenericRGB(0.5, 0, 0.5, 0.7);
 368 CACFLayerSetBorderColor(newLayer.get(), borderColor);
 369 CGColorRelease(borderColor);
 370 CACFLayerSetBorderWidth(newLayer.get(), 2);
 371 }
 372}
 373
 374void PlatformCALayerWinInternal::removeTile()
 375{
 376 CACFLayerRemoveFromSuperlayer(tileAtIndex(tileCount() - 1));
 377}
 378
 379CACFLayerRef PlatformCALayerWinInternal::tileAtIndex(int index)
 380{
 381 CFArrayRef sublayers = CACFLayerGetSublayers(m_tileParent.get());
 382 if (!sublayers || index < 0 || index >= tileCount())
 383 return 0;
 384
 385 return static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(sublayers, index)));
 386}
 387
 388int PlatformCALayerWinInternal::tileCount() const
 389{
 390 CFArrayRef sublayers = CACFLayerGetSublayers(m_tileParent.get());
 391 return sublayers ? CFArrayGetCount(sublayers) : 0;
 392}
 393
 394void PlatformCALayerWinInternal::updateTiles()
 395{
 396 // FIXME: In addition to redoing the number of tiles, we need to only render and have backing
 397 // store for visible layers
 398 int numTilesHorizontal = ceil(m_constrainedSize.width / m_tileSize.width);
 399 int numTilesVertical = ceil(m_constrainedSize.height / m_tileSize.height);
 400 int numTilesTotal = numTilesHorizontal * numTilesVertical;
 401
 402 int numTilesToChange = numTilesTotal - tileCount();
 403 if (numTilesToChange >= 0) {
 404 // Add new tiles
 405 for (int i = 0; i < numTilesToChange; ++i)
 406 addTile();
 407 } else {
 408 // Remove old tiles
 409 numTilesToChange = -numTilesToChange;
 410 for (int i = 0; i < numTilesToChange; ++i)
 411 removeTile();
 412 }
 413
 414 // Set coordinates for all tiles
 415 CFArrayRef tileArray = CACFLayerGetSublayers(m_tileParent.get());
 416
 417 for (int i = 0; i < numTilesHorizontal; ++i) {
 418 for (int j = 0; j < numTilesVertical; ++j) {
 419 CACFLayerRef tile = static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(tileArray, i * numTilesVertical + j)));
 420 CACFLayerSetPosition(tile, CGPointMake(i * m_tileSize.width, j * m_tileSize.height));
 421 int width = min(m_tileSize.width, m_constrainedSize.width - i * m_tileSize.width);
 422 int height = min(m_tileSize.height, m_constrainedSize.height - j * m_tileSize.height);
 423 CACFLayerSetBounds(tile, CGRectMake(i * m_tileSize.width, j * m_tileSize.height, width, height));
 424
 425 // Flip Y to compensate for the flipping that happens during render to match the CG context coordinate space
 426 CATransform3D transform = CATransform3DMakeScale(1, -1, 1);
 427 CATransform3DTranslate(transform, 0, height, 0);
 428 CACFLayerSetTransform(tile, transform);
 429
 430#ifndef NDEBUG
 431 String name = "Tile (" + String::number(i) + "," + String::number(j) + ")";
 432 CACFLayerSetName(tile, RetainPtr<CFStringRef>(AdoptCF, name.createCFString()).get());
 433#endif
 434 }
 435 }
 436}
 437
 438void PlatformCALayerWinInternal::drawTile(CACFLayerRef tile, CGContextRef context)
 439{
 440 CGPoint tilePosition = CACFLayerGetPosition(tile);
 441 CGRect tileBounds = CACFLayerGetBounds(tile);
 442
 443 CGContextSaveGState(context);
 444
 445 // Transform context to be at the origin of the parent layer
 446 CGContextTranslateCTM(context, -tilePosition.x, -tilePosition.y);
 447
 448 // Set the context clipping rectangle to the current tile
 449 CGContextClipToRect(context, CGRectMake(tilePosition.x, tilePosition.y, tileBounds.size.width, tileBounds.size.height));
 450
 451 if (owner()->owner()->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
 452 // If the layer is rendering top-down, it will flip the coordinates in y. Tiled layers are
 453 // already flipping, so we need to undo that here.
 454 CGContextTranslateCTM(context, 0, owner()->bounds().height());
 455 CGContextScaleCTM(context, 1, -1);
 456 }
 457
 458 // Draw the tile
 459 displayCallback(owner()->platformLayer(), context);
 460
 461 CGContextRestoreGState(context);
 462}
 463
 464#endif // USE(ACCELERATED_COMPOSITING)
0

WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp

 1/*
 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27
 28#if USE(ACCELERATED_COMPOSITING)
 29
 30#include "PlatformCALayer.h"
 31
 32#include "Font.h"
 33#include "GraphicsContext.h"
 34#include "PlatformCALayerWinInternal.h"
 35#include "WKCACFLayerRenderer.h"
 36#include <QuartzCore/CACFAnimation.h>
 37#include <QuartzCore/CACFContext.h>
 38#include <QuartzCore/CACFLayer.h>
 39#include <wtf/CurrentTime.h>
 40#include <wtf/text/CString.h>
 41
 42using namespace WebCore;
 43
 44bool PlatformCALayer::isValueFunctionSupported()
 45{
 46 return true;
 47}
 48
 49void PlatformCALayer::setOwner(PlatformCALayerClient* owner)
 50{
 51 m_owner = owner;
 52}
 53
 54static CFStringRef toCACFLayerType(PlatformCALayer::LayerType type)
 55{
 56 return (type == PlatformCALayer::LayerTypeTransformLayer) ? kCACFTransformLayer : kCACFLayer;
 57}
 58
 59static CFStringRef toCACFFilterType(PlatformCALayer::FilterType type)
 60{
 61 switch (type) {
 62 case PlatformCALayer::Linear: return kCACFFilterLinear;
 63 case PlatformCALayer::Nearest: return kCACFFilterNearest;
 64 case PlatformCALayer::Trilinear: return kCACFFilterTrilinear;
 65 default: return 0;
 66 }
 67}
 68
 69static WKCACFLayerRenderer* rendererForLayer(const PlatformCALayer* layer)
 70{
 71 // We need the WKCACFLayerRenderer associated with this layer, which is stored in the UserData of the CACFContext
 72 CACFContextRef context = CACFLayerGetContext(layer->platformLayer());
 73 if (!context)
 74 return 0;
 75
 76 WKCACFLayerRenderer* renderer = static_cast<WKCACFLayerRenderer*>(CACFContextGetUserData(context));
 77 ASSERT(renderer);
 78 return renderer;
 79}
 80
 81static PlatformCALayerWinInternal* intern(const PlatformCALayer* layer)
 82{
 83 return static_cast<PlatformCALayerWinInternal*>(CACFLayerGetUserData(layer->platformLayer()));
 84}
 85
 86static PlatformCALayerWinInternal* intern(void* layer)
 87{
 88 return static_cast<PlatformCALayerWinInternal*>(CACFLayerGetUserData(static_cast<CACFLayerRef>(layer)));
 89}
 90
 91PassRefPtr<PlatformCALayer> PlatformCALayer::create(LayerType layerType, PlatformCALayerClient* owner)
 92{
 93 return adoptRef(new PlatformCALayer(layerType, 0, owner));
 94}
 95
 96PassRefPtr<PlatformCALayer> PlatformCALayer::create(void* platformLayer, PlatformCALayerClient* owner)
 97{
 98 return adoptRef(new PlatformCALayer(LayerTypeCustom, static_cast<PlatformLayer*>(platformLayer), owner));
 99}
 100
 101static void displayCallback(CACFLayerRef caLayer, CGContextRef context)
 102{
 103 ASSERT_ARG(caLayer, CACFLayerGetUserData(caLayer));
 104 intern(caLayer)->displayCallback(caLayer, context);
 105}
 106
 107static void layoutSublayersProc(CACFLayerRef caLayer)
 108{
 109 PlatformCALayer* layer = PlatformCALayer::platformCALayer(caLayer);
 110 if (layer && layer->owner())
 111 layer->owner()->platformCALayerLayoutSublayersOfLayer(layer);
 112}
 113
 114PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
 115 : m_owner(owner)
 116{
 117 if (layer) {
 118 m_layerType = LayerTypeCustom;
 119 m_layer = layer;
 120 } else {
 121 m_layerType = layerType;
 122 m_layer.adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
 123
 124 // Create the PlatformCALayerWinInternal object and point to it in the userdata.
 125 PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
 126 CACFLayerSetUserData(m_layer.get(), intern);
 127
 128 // Set the display callback
 129 CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
 130 CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);
 131 }
 132}
 133
 134PlatformCALayer::~PlatformCALayer()
 135{
 136 // Toss all the kids
 137 removeAllSublayers();
 138
 139 // Get rid of the user data
 140 PlatformCALayerWinInternal* layerIntern = intern(this);
 141 CACFLayerSetUserData(m_layer.get(), 0);
 142
 143 delete layerIntern;
 144}
 145
 146PlatformCALayer* PlatformCALayer::platformCALayer(void* platformLayer)
 147{
 148 if (!platformLayer)
 149 return 0;
 150
 151 PlatformCALayerWinInternal* layerIntern = intern(platformLayer);
 152 return layerIntern ? layerIntern->owner() : 0;
 153}
 154
 155PlatformLayer* PlatformCALayer::platformLayer() const
 156{
 157 return m_layer.get();
 158}
 159
 160PlatformCALayer* PlatformCALayer::rootLayer() const
 161{
 162 WKCACFLayerRenderer* renderer = rendererForLayer(this);
 163 return renderer ? renderer->rootLayer() : 0;
 164}
 165
 166void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect)
 167{
 168 intern(this)->setNeedsDisplay(dirtyRect);
 169}
 170
 171void PlatformCALayer::setNeedsCommit()
 172{
 173 WKCACFLayerRenderer* renderer = rendererForLayer(this);
 174 if (renderer)
 175 renderer->layerTreeDidChange();
 176}
 177
 178void PlatformCALayer::setContentsChanged()
 179{
 180 // FIXME: There is no equivalent of setContentsChanged in CACF. For now I will
 181 // set contents to 0 and then back to its original value to see if that
 182 // kicks CACF into redisplaying.
 183 RetainPtr<CFTypeRef> contents = CACFLayerGetContents(m_layer.get());
 184 CACFLayerSetContents(m_layer.get(), 0);
 185 CACFLayerSetContents(m_layer.get(), contents.get());
 186 setNeedsCommit();
 187}
 188
 189void PlatformCALayer::setNeedsLayout()
 190{
 191 if (!m_owner || !m_owner->platformCALayerRespondsToLayoutChanges())
 192 return;
 193
 194 CACFLayerSetNeedsLayout(m_layer.get());
 195 setNeedsCommit();
 196}
 197
 198PlatformCALayer* PlatformCALayer::superlayer() const
 199{
 200 return platformCALayer(CACFLayerGetSuperlayer(m_layer.get()));
 201}
 202
 203void PlatformCALayer::removeFromSuperlayer()
 204{
 205 CACFLayerRemoveFromSuperlayer(m_layer.get());
 206 setNeedsCommit();
 207}
 208
 209void PlatformCALayer::setSublayers(const PlatformCALayerList& list)
 210{
 211 intern(this)->setSublayers(list);
 212}
 213
 214void PlatformCALayer::removeAllSublayers()
 215{
 216 intern(this)->removeAllSublayers();
 217}
 218
 219void PlatformCALayer::appendSublayer(PlatformCALayer* layer)
 220{
 221 // This must be in terms of insertSublayer instead of a direct call so PlatformCALayerInternal can override.
 222 insertSublayer(layer, sublayerCount());
 223}
 224
 225void PlatformCALayer::insertSublayer(PlatformCALayer* layer, size_t index)
 226{
 227 intern(this)->insertSublayer(layer, index);
 228}
 229
 230void PlatformCALayer::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* newLayer)
 231{
 232 // This must not use direct calls to allow PlatformCALayerInternal to override.
 233 ASSERT_ARG(reference, reference);
 234 ASSERT_ARG(reference, reference->superlayer() == this);
 235
 236 if (reference == newLayer)
 237 return;
 238
 239 int referenceIndex = intern(this)->indexOfSublayer(reference);
 240 ASSERT(referenceIndex != -1);
 241 if (referenceIndex == -1)
 242 return;
 243
 244 reference->removeFromSuperlayer();
 245
 246 if (newLayer) {
 247 newLayer->removeFromSuperlayer();
 248 insertSublayer(newLayer, referenceIndex);
 249 }
 250}
 251
 252size_t PlatformCALayer::sublayerCount() const
 253{
 254 return intern(this)->sublayerCount();
 255}
 256
 257void PlatformCALayer::adoptSublayers(PlatformCALayer* source)
 258{
 259 // Make a list of the sublayers from source
 260 PlatformCALayerList sublayers;
 261 size_t n = source->sublayerCount();
 262 CFArrayRef sourceSublayers = CACFLayerGetSublayers(source->platformLayer());
 263
 264 for (size_t i = 0; i < n; ++i) {
 265 CACFLayerRef layer = static_cast<CACFLayerRef>(const_cast<void*>(CFArrayGetValueAtIndex(sourceSublayers, i)));
 266 sublayers.append(platformCALayer(layer));
 267 }
 268
 269 // Use setSublayers() because it properly nulls out the superlayer pointers.
 270 setSublayers(sublayers);
 271}
 272
 273void PlatformCALayer::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
 274{
 275 // Add it to the animation list
 276 m_animations.add(key, animation);
 277
 278 RetainPtr<CFStringRef> s(AdoptCF, key.createCFString());
 279 CACFLayerAddAnimation(m_layer.get(), s.get(), animation->platformAnimation());
 280 setNeedsCommit();
 281
 282 // Tell the renderer about it so we can fire the start animation event
 283 WKCACFLayerRenderer* renderer = rendererForLayer(this);
 284 if (renderer)
 285 renderer->addPendingAnimatedLayer(this);
 286}
 287
 288void PlatformCALayer::removeAnimationForKey(const String& key)
 289{
 290 // Remove it from the animation list
 291 m_animations.remove(key);
 292
 293 RetainPtr<CFStringRef> s(AdoptCF, key.createCFString());
 294 CACFLayerRemoveAnimation(m_layer.get(), s.get());
 295
 296 // We don't "remove" a layer from WKCACFLayerRenderer when it loses an animation.
 297 // There may be other active animations on the layer and if an animation
 298 // callback is fired on a layer without any animations no harm is done.
 299
 300 setNeedsCommit();
 301}
 302
 303PassRefPtr<PlatformCAAnimation> PlatformCALayer::animationForKey(const String& key)
 304{
 305 HashMap<String, RefPtr<PlatformCAAnimation> >::iterator it = m_animations.find(key);
 306 if (it == m_animations.end())
 307 return 0;
 308
 309 return it->second;
 310}
 311
 312PlatformCALayer* PlatformCALayer::mask() const
 313{
 314 return platformCALayer(CACFLayerGetMask(m_layer.get()));
 315}
 316
 317void PlatformCALayer::setMask(PlatformCALayer* layer)
 318{
 319 CACFLayerSetMask(m_layer.get(), layer ? layer->platformLayer() : 0);
 320 setNeedsCommit();
 321}
 322
 323bool PlatformCALayer::isOpaque() const
 324{
 325 return CACFLayerIsOpaque(m_layer.get());
 326}
 327
 328void PlatformCALayer::setOpaque(bool value)
 329{
 330 CACFLayerSetOpaque(m_layer.get(), value);
 331 setNeedsCommit();
 332}
 333
 334FloatRect PlatformCALayer::bounds() const
 335{
 336 return CACFLayerGetBounds(m_layer.get());
 337}
 338
 339void PlatformCALayer::setBounds(const FloatRect& value)
 340{
 341 intern(this)->setBounds(value);
 342 setNeedsLayout();
 343}
 344
 345FloatPoint3D PlatformCALayer::position() const
 346{
 347 CGPoint point = CACFLayerGetPosition(m_layer.get());
 348 return FloatPoint3D(point.x, point.y, CACFLayerGetZPosition(m_layer.get()));
 349}
 350
 351void PlatformCALayer::setPosition(const FloatPoint3D& value)
 352{
 353 CACFLayerSetPosition(m_layer.get(), CGPointMake(value.x(), value.y()));
 354 CACFLayerSetZPosition(m_layer.get(), value.z());
 355 setNeedsCommit();
 356}
 357
 358FloatPoint3D PlatformCALayer::anchorPoint() const
 359{
 360 CGPoint point = CACFLayerGetAnchorPoint(m_layer.get());
 361 float z = CACFLayerGetAnchorPointZ(m_layer.get());
 362 return FloatPoint3D(point.x, point.y, z);
 363}
 364
 365void PlatformCALayer::setAnchorPoint(const FloatPoint3D& value)
 366{
 367 CACFLayerSetAnchorPoint(m_layer.get(), CGPointMake(value.x(), value.y()));
 368 CACFLayerSetAnchorPointZ(m_layer.get(), value.z());
 369 setNeedsCommit();
 370}
 371
 372TransformationMatrix PlatformCALayer::transform() const
 373{
 374 return CACFLayerGetTransform(m_layer.get());
 375}
 376
 377void PlatformCALayer::setTransform(const TransformationMatrix& value)
 378{
 379 CACFLayerSetTransform(m_layer.get(), value);
 380 setNeedsCommit();
 381}
 382
 383TransformationMatrix PlatformCALayer::sublayerTransform() const
 384{
 385 return CACFLayerGetSublayerTransform(m_layer.get());
 386}
 387
 388void PlatformCALayer::setSublayerTransform(const TransformationMatrix& value)
 389{
 390 CACFLayerSetSublayerTransform(m_layer.get(), value);
 391 setNeedsCommit();
 392}
 393
 394TransformationMatrix PlatformCALayer::contentsTransform() const
 395{
 396 // ContentsTransform is not used
 397 return TransformationMatrix();
 398}
 399
 400void PlatformCALayer::setContentsTransform(const TransformationMatrix&)
 401{
 402 // ContentsTransform is not used
 403}
 404
 405bool PlatformCALayer::isHidden() const
 406{
 407 return CACFLayerIsHidden(m_layer.get());
 408}
 409
 410void PlatformCALayer::setHidden(bool value)
 411{
 412 CACFLayerSetHidden(m_layer.get(), value);
 413 setNeedsCommit();
 414}
 415
 416bool PlatformCALayer::isGeometryFlipped() const
 417{
 418 return CACFLayerIsGeometryFlipped(m_layer.get());
 419}
 420
 421void PlatformCALayer::setGeometryFlipped(bool value)
 422{
 423 CACFLayerSetGeometryFlipped(m_layer.get(), value);
 424 setNeedsCommit();
 425}
 426
 427bool PlatformCALayer::isDoubleSided() const
 428{
 429 return CACFLayerIsDoubleSided(m_layer.get());
 430}
 431
 432void PlatformCALayer::setDoubleSided(bool value)
 433{
 434 CACFLayerSetDoubleSided(m_layer.get(), value);
 435 setNeedsCommit();
 436}
 437
 438bool PlatformCALayer::masksToBounds() const
 439{
 440 return CACFLayerGetMasksToBounds(m_layer.get());
 441}
 442
 443void PlatformCALayer::setMasksToBounds(bool value)
 444{
 445 CACFLayerSetMasksToBounds(m_layer.get(), value);
 446 setNeedsCommit();
 447}
 448
 449bool PlatformCALayer::acceleratesDrawing() const
 450{
 451 return false;
 452}
 453
 454void PlatformCALayer::setAcceleratesDrawing(bool)
 455{
 456}
 457
 458CFTypeRef PlatformCALayer::contents() const
 459{
 460 return CACFLayerGetContents(m_layer.get());
 461}
 462
 463void PlatformCALayer::setContents(CFTypeRef value)
 464{
 465 CACFLayerSetContents(m_layer.get(), value);
 466 setNeedsCommit();
 467}
 468
 469FloatRect PlatformCALayer::contentsRect() const
 470{
 471 return CACFLayerGetContentsRect(m_layer.get());
 472}
 473
 474void PlatformCALayer::setContentsRect(const FloatRect& value)
 475{
 476 CACFLayerSetContentsRect(m_layer.get(), value);
 477 setNeedsCommit();
 478}
 479
 480void PlatformCALayer::setMinificationFilter(FilterType value)
 481{
 482 CACFLayerSetMinificationFilter(m_layer.get(), toCACFFilterType(value));
 483}
 484
 485void PlatformCALayer::setMagnificationFilter(FilterType value)
 486{
 487 CACFLayerSetMagnificationFilter(m_layer.get(), toCACFFilterType(value));
 488 setNeedsCommit();
 489}
 490
 491Color PlatformCALayer::backgroundColor() const
 492{
 493 return CACFLayerGetBackgroundColor(m_layer.get());
 494}
 495
 496void PlatformCALayer::setBackgroundColor(const Color& value)
 497{
 498 CGFloat components[4];
 499 value.getRGBA(components[0], components[1], components[2], components[3]);
 500
 501 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
 502 RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
 503
 504 CACFLayerSetBackgroundColor(m_layer.get(), color.get());
 505 setNeedsCommit();
 506}
 507
 508float PlatformCALayer::borderWidth() const
 509{
 510 return CACFLayerGetBorderWidth(m_layer.get());
 511}
 512
 513void PlatformCALayer::setBorderWidth(float value)
 514{
 515 CACFLayerSetBorderWidth(m_layer.get(), value);
 516 setNeedsCommit();
 517}
 518
 519Color PlatformCALayer::borderColor() const
 520{
 521 return CACFLayerGetBorderColor(m_layer.get());
 522}
 523
 524void PlatformCALayer::setBorderColor(const Color& value)
 525{
 526 CGFloat components[4];
 527 value.getRGBA(components[0], components[1], components[2], components[3]);
 528
 529 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
 530 RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
 531
 532 CACFLayerSetBorderColor(m_layer.get(), color.get());
 533 setNeedsCommit();
 534}
 535
 536float PlatformCALayer::opacity() const
 537{
 538 return CACFLayerGetOpacity(m_layer.get());
 539}
 540
 541void PlatformCALayer::setOpacity(float value)
 542{
 543 CACFLayerSetOpacity(m_layer.get(), value);
 544 setNeedsCommit();
 545}
 546
 547String PlatformCALayer::name() const
 548{
 549 return CACFLayerGetName(m_layer.get());
 550}
 551
 552void PlatformCALayer::setName(const String& value)
 553{
 554 RetainPtr<CFStringRef> s(AdoptCF, value.createCFString());
 555 CACFLayerSetName(m_layer.get(), s.get());
 556 setNeedsCommit();
 557}
 558
 559FloatRect PlatformCALayer::frame() const
 560{
 561 return CACFLayerGetFrame(m_layer.get());
 562}
 563
 564void PlatformCALayer::setFrame(const FloatRect& value)
 565{
 566 intern(this)->setFrame(value);
 567 setNeedsLayout();
 568}
 569
 570float PlatformCALayer::speed() const
 571{
 572 return CACFLayerGetSpeed(m_layer.get());
 573}
 574
 575void PlatformCALayer::setSpeed(float value)
 576{
 577 CACFLayerSetSpeed(m_layer.get(), value);
 578 setNeedsCommit();
 579}
 580
 581CFTimeInterval PlatformCALayer::timeOffset() const
 582{
 583 return CACFLayerGetTimeOffset(m_layer.get());
 584}
 585
 586void PlatformCALayer::setTimeOffset(CFTimeInterval value)
 587{
 588 CACFLayerSetTimeOffset(m_layer.get(), value);
 589 setNeedsCommit();
 590}
 591
 592#ifndef NDEBUG
 593static void printIndent(int indent)
 594{
 595 for ( ; indent > 0; --indent)
 596 fprintf(stderr, " ");
 597}
 598
 599static void printTransform(const CATransform3D& transform)
 600{
 601 fprintf(stderr, "[%g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g]",
 602 transform.m11, transform.m12, transform.m13, transform.m14,
 603 transform.m21, transform.m22, transform.m23, transform.m24,
 604 transform.m31, transform.m32, transform.m33, transform.m34,
 605 transform.m41, transform.m42, transform.m43, transform.m44);
 606}
 607
 608static void printLayer(const PlatformCALayer* layer, int indent)
 609{
 610 FloatPoint3D layerPosition = layer->position();
 611 FloatPoint3D layerAnchorPoint = layer->anchorPoint();
 612 FloatRect layerBounds = layer->bounds();
 613 printIndent(indent);
 614
 615 char* layerTypeName = 0;
 616 switch (layer->layerType()) {
 617 case PlatformCALayer::LayerTypeLayer: layerTypeName = "layer"; break;
 618 case PlatformCALayer::LayerTypeWebLayer: layerTypeName = "web-layer"; break;
 619 case PlatformCALayer::LayerTypeTransformLayer: layerTypeName = "transform-layer"; break;
 620 case PlatformCALayer::LayerTypeWebTiledLayer: layerTypeName = "web-tiled-layer"; break;
 621 case PlatformCALayer::LayerTypeRootLayer: layerTypeName = "root-layer"; break;
 622 case PlatformCALayer::LayerTypeCustom: layerTypeName = "custom-layer"; break;
 623 }
 624
 625 fprintf(stderr, "(%s [%g %g %g] [%g %g %g %g] [%g %g %g] superlayer=%p\n",
 626 layerTypeName,
 627 layerPosition.x(), layerPosition.y(), layerPosition.z(),
 628 layerBounds.x(), layerBounds.y(), layerBounds.width(), layerBounds.height(),
 629 layerAnchorPoint.x(), layerAnchorPoint.y(), layerAnchorPoint.z(), layer->superlayer());
 630
 631 // Print name if needed
 632 String layerName = layer->name();
 633 if (!layerName.isEmpty()) {
 634 printIndent(indent + 1);
 635 fprintf(stderr, "(name %s)\n", layerName.utf8().data());
 636 }
 637
 638 // Print masksToBounds if needed
 639 bool layerMasksToBounds = layer->masksToBounds();
 640 if (layerMasksToBounds) {
 641 printIndent(indent + 1);
 642 fprintf(stderr, "(masksToBounds true)\n");
 643 }
 644
 645 // Print opacity if needed
 646 float layerOpacity = layer->opacity();
 647 if (layerOpacity != 1) {
 648 printIndent(indent + 1);
 649 fprintf(stderr, "(opacity %hf)\n", layerOpacity);
 650 }
 651
 652 // Print sublayerTransform if needed
 653 TransformationMatrix layerTransform = layer->sublayerTransform();
 654 if (!layerTransform.isIdentity()) {
 655 printIndent(indent + 1);
 656 fprintf(stderr, "(sublayerTransform ");
 657 printTransform(layerTransform);
 658 fprintf(stderr, ")\n");
 659 }
 660
 661 // Print transform if needed
 662 layerTransform = layer->transform();
 663 if (!layerTransform.isIdentity()) {
 664 printIndent(indent + 1);
 665 fprintf(stderr, "(transform ");
 666 printTransform(layerTransform);
 667 fprintf(stderr, ")\n");
 668 }
 669
 670 // Print contents if needed
 671 CFTypeRef layerContents = layer->contents();
 672 if (layerContents) {
 673 if (CFGetTypeID(layerContents) == CGImageGetTypeID()) {
 674 CGImageRef imageContents = static_cast<CGImageRef>(const_cast<void*>(layerContents));
 675 printIndent(indent + 1);
 676 fprintf(stderr, "(contents (image [%d %d]))\n",
 677 CGImageGetWidth(imageContents), CGImageGetHeight(imageContents));
 678 }
 679 }
 680
 681 // Print sublayers if needed
 682 int n = layer->sublayerCount();
 683 if (n > 0) {
 684 printIndent(indent + 1);
 685 fprintf(stderr, "(sublayers\n");
 686
 687 CFArrayRef sublayers = CACFLayerGetSublayers(layer->platformLayer());
 688 for (int i = 0; i < n; ++i) {
 689 PlatformCALayer* sublayer = PlatformCALayer::platformCALayer(const_cast<void*>(CFArrayGetValueAtIndex(sublayers, i)));
 690 printLayer(sublayer, indent + 2);
 691 }
 692
 693 printIndent(indent + 1);
 694 fprintf(stderr, ")\n");
 695 }
 696
 697 printIndent(indent);
 698 fprintf(stderr, ")\n");
 699}
 700
 701void PlatformCALayer::printTree() const
 702{
 703 // Print heading info
 704 CGRect rootBounds = bounds();
 705 fprintf(stderr, "\n\n** Render tree at time %g (bounds %g, %g %gx%g) **\n\n",
 706 currentTime(), rootBounds.origin.x, rootBounds.origin.y, rootBounds.size.width, rootBounds.size.height);
 707
 708 // Print layer tree from the root
 709 printLayer(this, 0);
 710}
 711#endif // #ifndef NDEBUG
 712
 713#endif // USE(ACCELERATED_COMPOSITING)
0

WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h

 1/*
 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef PlatformCALayerWinInternal_h
 27#define PlatformCALayerWinInternal_h
 28
 29#if USE(ACCELERATED_COMPOSITING)
 30
 31#include <CoreGraphics/CGGeometry.h>
 32#include <wtf/RetainPtr.h>
 33#include <wtf/Vector.h>
 34
 35typedef struct _CACFLayer *CACFLayerRef;
 36typedef struct CGContext *CGContextRef;
 37
 38namespace WebCore {
 39
 40class FloatRect;
 41class PlatformCALayer;
 42
 43typedef Vector<RefPtr<PlatformCALayer> > PlatformCALayerList;
 44
 45class PlatformCALayerWinInternal {
 46public:
 47 PlatformCALayerWinInternal(PlatformCALayer*);
 48 ~PlatformCALayerWinInternal();
 49
 50 void displayCallback(CACFLayerRef, CGContextRef);
 51 void setNeedsDisplay(const FloatRect*);
 52 PlatformCALayer* owner() const { return m_owner; }
 53
 54 void setSublayers(const PlatformCALayerList&);
 55 void removeAllSublayers();
 56 void insertSublayer(PlatformCALayer*, size_t);
 57 size_t sublayerCount() const;
 58 int indexOfSublayer(const PlatformCALayer* reference);
 59
 60 void setBounds(const FloatRect&);
 61 void setFrame(const FloatRect&);
 62
 63private:
 64 void internalSetNeedsDisplay(const FloatRect*);
 65 PlatformCALayer* sublayerAtIndex(int) const;
 66
 67 static void tileDisplayCallback(CACFLayerRef, CGContextRef);
 68
 69 void drawTile(CACFLayerRef, CGContextRef);
 70 CGSize constrainedSize(const CGSize&) const;
 71 void addTile();
 72 void removeTile();
 73 CACFLayerRef tileAtIndex(int);
 74 int tileCount() const;
 75 void updateTiles();
 76
 77 PlatformCALayer* m_owner;
 78
 79 CGSize m_tileSize;
 80 CGSize m_constrainedSize;
 81 RetainPtr<CACFLayerRef> m_tileParent;
 82};
 83
 84}
 85
 86#endif // USE(ACCELERATED_COMPOSITING)
 87
 88#endif // PlatformCALayerWinInternal_h
0

WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp

 1/*
 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27
 28#if USE(ACCELERATED_COMPOSITING)
 29
 30#include "PlatformCAAnimation.h"
 31
 32#include "FloatConversion.h"
 33#include "PlatformString.h"
 34#include "TimingFunction.h"
 35#include <QuartzCore/CACFAnimation.h>
 36#include <QuartzCore/CACFTiming.h>
 37#include <QuartzCore/CACFTimingFunction.h>
 38#include <QuartzCore/CACFValueFunction.h>
 39#include <QuartzCore/CACFVector.h>
 40#include <wtf/UnusedParam.h>
 41
 42using namespace WebCore;
 43
 44static String toCACFFillModeType(PlatformCAAnimation::FillModeType type)
 45{
 46 switch (type) {
 47 case PlatformCAAnimation::NoFillMode:
 48 case PlatformCAAnimation::Forwards: return kCACFFillModeForwards;
 49 case PlatformCAAnimation::Backwards: return kCACFFillModeBackwards;
 50 case PlatformCAAnimation::Both: return kCACFFillModeBoth;
 51 }
 52 return "";
 53}
 54
 55static PlatformCAAnimation::FillModeType fromCACFFillModeType(const String& string)
 56{
 57 if (string == kCACFFillModeBackwards)
 58 return PlatformCAAnimation::Backwards;
 59
 60 if (string == kCACFFillModeBoth)
 61 return PlatformCAAnimation::Both;
 62
 63 return PlatformCAAnimation::Forwards;
 64}
 65
 66static String toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type)
 67{
 68 switch (type) {
 69 case PlatformCAAnimation::NoValueFunction: return "";
 70 case PlatformCAAnimation::RotateX: return kCACFValueFunctionRotateX;
 71 case PlatformCAAnimation::RotateY: return kCACFValueFunctionRotateY;
 72 case PlatformCAAnimation::RotateZ: return kCACFValueFunctionRotateZ;
 73 case PlatformCAAnimation::ScaleX: return kCACFValueFunctionScaleX;
 74 case PlatformCAAnimation::ScaleY: return kCACFValueFunctionScaleY;
 75 case PlatformCAAnimation::ScaleZ: return kCACFValueFunctionScaleZ;
 76 case PlatformCAAnimation::Scale: return kCACFValueFunctionScale;
 77 case PlatformCAAnimation::TranslateX: return kCACFValueFunctionTranslateX;
 78 case PlatformCAAnimation::TranslateY: return kCACFValueFunctionTranslateY;
 79 case PlatformCAAnimation::TranslateZ: return kCACFValueFunctionTranslateZ;
 80 case PlatformCAAnimation::Translate: return kCACFValueFunctionTranslate;
 81 }
 82 return "";
 83}
 84
 85static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(const String string)
 86{
 87 if (string == kCACFValueFunctionRotateX)
 88 return PlatformCAAnimation::RotateX;
 89
 90 if (string == kCACFValueFunctionRotateY)
 91 return PlatformCAAnimation::RotateY;
 92
 93 if (string == kCACFValueFunctionRotateZ)
 94 return PlatformCAAnimation::RotateZ;
 95
 96 if (string == kCACFValueFunctionScaleX)
 97 return PlatformCAAnimation::ScaleX;
 98
 99 if (string == kCACFValueFunctionScaleY)
 100 return PlatformCAAnimation::ScaleY;
 101
 102 if (string == kCACFValueFunctionScaleZ)
 103 return PlatformCAAnimation::ScaleZ;
 104
 105 if (string == kCACFValueFunctionScale)
 106 return PlatformCAAnimation::Scale;
 107
 108 if (string == kCACFValueFunctionTranslateX)
 109 return PlatformCAAnimation::TranslateX;
 110
 111 if (string == kCACFValueFunctionTranslateY)
 112 return PlatformCAAnimation::TranslateY;
 113
 114 if (string == kCACFValueFunctionTranslateZ)
 115 return PlatformCAAnimation::TranslateZ;
 116
 117 if (string == kCACFValueFunctionTranslate)
 118 return PlatformCAAnimation::Translate;
 119
 120 return PlatformCAAnimation::NoValueFunction;
 121}
 122
 123static CACFTimingFunctionRef toCACFTimingFunction(const TimingFunction* timingFunction)
 124{
 125 if (!timingFunction)
 126 return CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f);
 127
 128 if (timingFunction->isCubicBezierTimingFunction()) {
 129 const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction);
 130 return CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2()));
 131 }
 132
 133 return CACFTimingFunctionGetFunctionWithName(kCACFTimingFunctionLinear);
 134}
 135
 136PassRefPtr<PlatformCAAnimation> PlatformCAAnimation::create(AnimationType type, const String& keyPath)
 137{
 138 return adoptRef(new PlatformCAAnimation(type, keyPath));
 139}
 140
 141PassRefPtr<PlatformCAAnimation> PlatformCAAnimation::create(PlatformAnimationRef animation)
 142{
 143 return adoptRef(new PlatformCAAnimation(animation));
 144}
 145
 146PassRefPtr<PlatformCAAnimation> PlatformCAAnimation::create(const PlatformCAAnimation* animation)
 147{
 148 return adoptRef(new PlatformCAAnimation(animation));
 149}
 150
 151PlatformCAAnimation::PlatformCAAnimation(AnimationType type, const String& keyPath)
 152 : m_type(type)
 153{
 154 if (type == Basic)
 155 m_animation.adoptCF(CACFAnimationCreate(kCACFBasicAnimation));
 156 else
 157 m_animation.adoptCF(CACFAnimationCreate(kCACFKeyframeAnimation));
 158
 159 RetainPtr<CFStringRef> s(AdoptCF, keyPath.createCFString());
 160 CACFAnimationSetKeyPath(m_animation.get(), s.get());
 161}
 162
 163PlatformCAAnimation::PlatformCAAnimation(PlatformAnimationRef animation)
 164{
 165 if (String(CACFAnimationGetClass(animation)) == kCACFBasicAnimation)
 166 m_type = Basic;
 167 else if (String(CACFAnimationGetClass(animation)) == kCACFKeyframeAnimation)
 168 m_type = Keyframe;
 169 else {
 170 ASSERT(0);
 171 return;
 172 }
 173
 174 m_animation = animation;
 175}
 176
 177PlatformCAAnimation::PlatformCAAnimation(const PlatformCAAnimation* animation)
 178{
 179 m_animation.adoptCF(CACFAnimationCreate((animation->animationType() == Basic) ? kCACFBasicAnimation : kCACFKeyframeAnimation));
 180 RetainPtr<CFStringRef> keyPath(AdoptCF, animation->keyPath().createCFString());
 181 CACFAnimationSetKeyPath(m_animation.get(), keyPath.get());
 182
 183 setBeginTime(animation->beginTime());
 184 setDuration(animation->duration());
 185 setSpeed(animation->speed());
 186 setTimeOffset(animation->timeOffset());
 187 setRepeatCount(animation->repeatCount());
 188 setAutoreverses(animation->autoreverses());
 189 setFillMode(animation->fillMode());
 190 setRemovedOnCompletion(animation->isRemovedOnCompletion());
 191 setAdditive(animation->isAdditive());
 192 copyTimingFunctionFrom(animation);
 193 setValueFunction(animation->valueFunction());
 194
 195 // Copy the specific Basic or Keyframe values
 196 if (animation->animationType() == Keyframe) {
 197 copyValuesFrom(animation);
 198 copyKeyTimesFrom(animation);
 199 copyTimingFunctionsFrom(animation);
 200 } else {
 201 copyFromValueFrom(animation);
 202 copyToValueFrom(animation);
 203 }
 204}
 205
 206PlatformCAAnimation::~PlatformCAAnimation()
 207{
 208}
 209
 210bool PlatformCAAnimation::supportsValueFunction()
 211{
 212 return true;
 213}
 214
 215PlatformAnimationRef PlatformCAAnimation::platformAnimation() const
 216{
 217 return m_animation.get();
 218}
 219
 220String PlatformCAAnimation::keyPath() const
 221{
 222 return CACFAnimationGetKeyPath(m_animation.get());
 223}
 224
 225CFTimeInterval PlatformCAAnimation::beginTime() const
 226{
 227 return CACFAnimationGetBeginTime(m_animation.get());
 228}
 229
 230void PlatformCAAnimation::setBeginTime(CFTimeInterval value)
 231{
 232 CACFAnimationSetBeginTime(m_animation.get(), value);
 233}
 234
 235CFTimeInterval PlatformCAAnimation::duration() const
 236{
 237 return CACFAnimationGetDuration(m_animation.get());
 238}
 239
 240void PlatformCAAnimation::setDuration(CFTimeInterval value)
 241{
 242 CACFAnimationSetDuration(m_animation.get(), value);
 243}
 244
 245float PlatformCAAnimation::speed() const
 246{
 247 return CACFAnimationGetSpeed(m_animation.get());
 248}
 249
 250void PlatformCAAnimation::setSpeed(float value)
 251{
 252 CACFAnimationSetSpeed(m_animation.get(), value);
 253}
 254
 255CFTimeInterval PlatformCAAnimation::timeOffset() const
 256{
 257 return CACFAnimationGetTimeOffset(m_animation.get());
 258}
 259
 260void PlatformCAAnimation::setTimeOffset(CFTimeInterval value)
 261{
 262 CACFAnimationSetTimeOffset(m_animation.get(), value);
 263}
 264
 265float PlatformCAAnimation::repeatCount() const
 266{
 267 return CACFAnimationGetRepeatCount(m_animation.get());
 268}
 269
 270void PlatformCAAnimation::setRepeatCount(float value)
 271{
 272 CACFAnimationSetRepeatCount(m_animation.get(), value);
 273}
 274
 275bool PlatformCAAnimation::autoreverses() const
 276{
 277 return CACFAnimationGetAutoreverses(m_animation.get());
 278}
 279
 280void PlatformCAAnimation::setAutoreverses(bool value)
 281{
 282 CACFAnimationSetAutoreverses(m_animation.get(), value);
 283}
 284
 285PlatformCAAnimation::FillModeType PlatformCAAnimation::fillMode() const
 286{
 287 return fromCACFFillModeType(CACFAnimationGetFillMode(m_animation.get()));
 288}
 289
 290void PlatformCAAnimation::setFillMode(FillModeType value)
 291{
 292 RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFFillModeType(value).createCFString());
 293 CACFAnimationSetFillMode(m_animation.get(), keyPath.get());
 294}
 295
 296void PlatformCAAnimation::setTimingFunction(const TimingFunction* value)
 297{
 298 CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value));
 299}
 300
 301void PlatformCAAnimation::copyTimingFunctionFrom(const PlatformCAAnimation* value)
 302{
 303 CACFAnimationSetTimingFunction(m_animation.get(), CACFAnimationGetTimingFunction(value->m_animation.get()));
 304}
 305
 306bool PlatformCAAnimation::isRemovedOnCompletion() const
 307{
 308 return CACFAnimationIsRemovedOnCompletion(m_animation.get());
 309}
 310
 311void PlatformCAAnimation::setRemovedOnCompletion(bool value)
 312{
 313 CACFAnimationSetRemovedOnCompletion(m_animation.get(), value);
 314}
 315
 316bool PlatformCAAnimation::isAdditive() const
 317{
 318 return CACFAnimationIsAdditive(m_animation.get());
 319}
 320
 321void PlatformCAAnimation::setAdditive(bool value)
 322{
 323 CACFAnimationSetAdditive(m_animation.get(), value);
 324}
 325
 326PlatformCAAnimation::ValueFunctionType PlatformCAAnimation::valueFunction() const
 327{
 328 return fromCACFValueFunctionType(CACFValueFunctionGetName(CACFAnimationGetValueFunction(m_animation.get())));
 329}
 330
 331void PlatformCAAnimation::setValueFunction(ValueFunctionType value)
 332{
 333 RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFValueFunctionType(value).createCFString());
 334 CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(keyPath.get()));
 335}
 336
 337void PlatformCAAnimation::setFromValue(float value)
 338{
 339 if (animationType() != Basic)
 340 return;
 341
 342 RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value));
 343 CACFAnimationSetFromValue(m_animation.get(), v.get());
 344}
 345
 346void PlatformCAAnimation::setFromValue(const WebCore::TransformationMatrix& value)
 347{
 348 if (animationType() != Basic)
 349 return;
 350
 351 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreateTransform(value));
 352 CACFAnimationSetFromValue(m_animation.get(), v.get());
 353}
 354
 355void PlatformCAAnimation::setFromValue(const FloatPoint3D& value)
 356{
 357 if (animationType() != Basic)
 358 return;
 359
 360 float a[3] = { value.x(), value.y(), value.z() };
 361 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(3, a));
 362 CACFAnimationSetFromValue(m_animation.get(), v.get());
 363}
 364
 365void PlatformCAAnimation::setFromValue(const WebCore::Color& value)
 366{
 367 if (animationType() != Basic)
 368 return;
 369
 370 float a[4] = { value.red(), value.green(), value.blue(), value.alpha() };
 371 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
 372 CACFAnimationSetFromValue(m_animation.get(), v.get());
 373}
 374
 375void PlatformCAAnimation::copyFromValueFrom(const PlatformCAAnimation* value)
 376{
 377 if (animationType() != Basic || value->animationType() != Basic)
 378 return;
 379
 380 CACFAnimationSetFromValue(m_animation.get(), CACFAnimationGetFromValue(value->platformAnimation()));
 381}
 382
 383void PlatformCAAnimation::setToValue(float value)
 384{
 385 if (animationType() != Basic)
 386 return;
 387
 388 RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value));
 389 CACFAnimationSetToValue(m_animation.get(), v.get());
 390}
 391
 392void PlatformCAAnimation::setToValue(const WebCore::TransformationMatrix& value)
 393{
 394 if (animationType() != Basic)
 395 return;
 396
 397 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreateTransform(value));
 398 CACFAnimationSetToValue(m_animation.get(), v.get());
 399}
 400
 401void PlatformCAAnimation::setToValue(const FloatPoint3D& value)
 402{
 403 if (animationType() != Basic)
 404 return;
 405
 406 float a[3] = { value.x(), value.y(), value.z() };
 407 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(3, a));
 408 CACFAnimationSetToValue(m_animation.get(), v.get());
 409}
 410
 411void PlatformCAAnimation::setToValue(const WebCore::Color& value)
 412{
 413 if (animationType() != Basic)
 414 return;
 415
 416 float a[4] = { value.red(), value.green(), value.blue(), value.alpha() };
 417 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
 418 CACFAnimationSetToValue(m_animation.get(), v.get());
 419}
 420
 421void PlatformCAAnimation::copyToValueFrom(const PlatformCAAnimation* value)
 422{
 423 if (animationType() != Basic || value->animationType() != Basic)
 424 return;
 425
 426 CACFAnimationSetToValue(m_animation.get(), CACFAnimationGetToValue(value->platformAnimation()));
 427}
 428
 429
 430// Keyframe-animation properties.
 431void PlatformCAAnimation::setValues(const Vector<float>& value)
 432{
 433 if (animationType() != Keyframe)
 434 return;
 435
 436 RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
 437 for (size_t i = 0; i < value.size(); ++i) {
 438 RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
 439 CFArrayAppendValue(array.get(), v.get());
 440 }
 441
 442 CACFAnimationSetValues(m_animation.get(), array.get());
 443}
 444
 445void PlatformCAAnimation::setValues(const Vector<WebCore::TransformationMatrix>& value)
 446{
 447 if (animationType() != Keyframe)
 448 return;
 449
 450 RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
 451 for (size_t i = 0; i < value.size(); ++i) {
 452 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreateTransform(value[i]));
 453 CFArrayAppendValue(array.get(), v.get());
 454 }
 455
 456 CACFAnimationSetValues(m_animation.get(), array.get());
 457}
 458
 459void PlatformCAAnimation::setValues(const Vector<FloatPoint3D>& value)
 460{
 461 if (animationType() != Keyframe)
 462 return;
 463
 464 RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
 465 for (size_t i = 0; i < value.size(); ++i) {
 466 float a[3] = { value[i].x(), value[i].y(), value[i].z() };
 467 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(3, a));
 468 CFArrayAppendValue(array.get(), v.get());
 469 }
 470
 471 CACFAnimationSetValues(m_animation.get(), array.get());
 472}
 473
 474void PlatformCAAnimation::setValues(const Vector<WebCore::Color>& value)
 475{
 476 if (animationType() != Keyframe)
 477 return;
 478
 479 RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
 480 for (size_t i = 0; i < value.size(); ++i) {
 481 float a[4] = { value[i].red(), value[i].green(), value[i].blue(), value[i].alpha() };
 482 RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
 483 CFArrayAppendValue(array.get(), v.get());
 484 }
 485
 486 CACFAnimationSetValues(m_animation.get(), array.get());
 487}
 488
 489void PlatformCAAnimation::copyValuesFrom(const PlatformCAAnimation* value)
 490{
 491 if (animationType() != Keyframe || value->animationType() != Keyframe)
 492 return;
 493
 494 CACFAnimationSetValues(m_animation.get(), CACFAnimationGetValues(value->platformAnimation()));
 495}
 496
 497void PlatformCAAnimation::setKeyTimes(const Vector<float>& value)
 498{
 499 if (animationType() != Keyframe)
 500 return;
 501
 502 RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
 503 for (size_t i = 0; i < value.size(); ++i) {
 504 RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
 505 CFArrayAppendValue(array.get(), v.get());
 506 }
 507
 508 CACFAnimationSetKeyTimes(m_animation.get(), array.get());
 509}
 510
 511void PlatformCAAnimation::copyKeyTimesFrom(const PlatformCAAnimation* value)
 512{
 513 if (animationType() != Keyframe)
 514 return;
 515
 516 CACFAnimationSetKeyTimes(m_animation.get(), CACFAnimationGetKeyTimes(value->platformAnimation()));
 517}
 518
 519void PlatformCAAnimation::setTimingFunctions(const Vector<const TimingFunction*>& value)
 520{
 521 if (animationType() != Keyframe)
 522 return;
 523
 524 RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
 525 for (size_t i = 0; i < value.size(); ++i) {
 526 RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
 527 CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]));
 528 }
 529
 530 CACFAnimationSetTimingFunctions(m_animation.get(), array.get());
 531}
 532
 533void PlatformCAAnimation::copyTimingFunctionsFrom(const PlatformCAAnimation* value)
 534{
 535 CACFAnimationSetTimingFunctions(m_animation.get(), CACFAnimationGetTimingFunctions(value->platformAnimation()));
 536}
 537
 538#endif // USE(ACCELERATED_COMPOSITING)
0

WebCore/platform/graphics/ca/PlatformCAAnimation.h

4444typedef void* PlatformAnimationRef;
4545#endif
4646#elif PLATFORM(WIN)
47 namespace WebCore {
48 class WKCACFAnimation;
49 typedef WKCACFAnimation* PlatformAnimationRef;
50 }
 47typedef struct _CACFAnimation* CACFAnimationRef;
 48typedef CACFAnimationRef PlatformAnimationRef;
5149#endif
5250
5351namespace WebCore {
75227

WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h

2828
2929#if ENABLE(VIDEO)
3030
31 #include "GraphicsLayer.h"
3231#include "MediaPlayerPrivate.h"
3332#include "Timer.h"
3433#include <wtf/Forward.h>

5150class IntRect;
5251
5352#if USE(ACCELERATED_COMPOSITING)
54 class WKCACFLayer;
 53class PlatformCALayer;
5554class WKCAImageQueue;
5655#endif
5756

6766 virtual bool supportsFullscreen() const;
6867 virtual PlatformMedia platformMedia() const;
6968#if USE(ACCELERATED_COMPOSITING)
70  PlatformLayer* platformLayer() const;
 69 virtual PlatformLayer* platformLayer() const;
7170#endif
 71
7272 IntSize naturalSize() const;
7373 bool hasVideo() const;
7474 bool hasAudio() const;

161161 class LayerClient;
162162 friend class LayerClient;
163163 OwnPtr<LayerClient> m_layerClient;
164 
165  class LayoutClient;
166  friend class LayoutClient;
167  OwnPtr<LayoutClient> m_layoutClient;
168164#endif
169165
170166 class VisualContextClient;

178174 MediaPlayer* m_player;
179175 RefPtr<QTMovie> m_movie;
180176#if USE(ACCELERATED_COMPOSITING)
181  RefPtr<WKCACFLayer> m_qtVideoLayer;
182  OwnPtr<GraphicsLayer> m_transformLayer;
 177 RefPtr<PlatformCALayer> m_qtVideoLayer;
 178 RefPtr<PlatformCALayer> m_transformLayer;
183179 OwnPtr<WKCAImageQueue> m_imageQueue;
184180 OwnPtr<QTDecompressionSession> m_decompressionSession;
185181 CGAffineTransform m_movieTransform;
75227

WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp

9090}
9191
9292#if USE(ACCELERATED_COMPOSITING)
93 void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<WKCACFLayer> rootChild)
 93void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<PlatformCALayer> rootChild)
9494{
9595 if (m_rootChild == rootChild)
9696 return;

104104 return;
105105
106106 m_layerRenderer->setRootChildLayer(m_rootChild.get());
107  WKCACFLayer* rootLayer = m_rootChild->rootLayer();
 107 PlatformCALayer* rootLayer = m_rootChild->rootLayer();
108108 CGRect rootBounds = m_rootChild->rootLayer()->bounds();
109109 m_rootChild->setFrame(rootBounds);
110110 m_rootChild->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack));

160160 break;
161161#if USE(ACCELERATED_COMPOSITING)
162162 m_layerRenderer->resize();
163  WKCACFLayer* rootLayer = m_rootChild->rootLayer();
 163 PlatformCALayer* rootLayer = m_rootChild->rootLayer();
164164 CGRect rootBounds = m_rootChild->rootLayer()->bounds();
165165 m_rootChild->setFrame(rootBounds);
166166 m_rootChild->setNeedsLayout();
75227

WebCore/platform/graphics/win/GraphicsContextCGWin.cpp

4343 BITMAP info;
4444
4545 GetObject(bitmap, sizeof(info), &info);
46  ASSERT(info.bmBitsPixel == 32);
4746
 47 // FIXME: We can get here because we asked for a bitmap that is too big
 48 // when we have a tiled layer and we're compositing. In that case
 49 // bmBitsPixel will be 0. This seems to be benign, so for now we will
 50 // exit gracefully and look at it later:
 51 // https://bugs.webkit.org/show_bug.cgi?id=52041
 52 // ASSERT(info.bmBitsPixel == 32);
 53 if (info.bmBitsPixel != 32)
 54 return 0;
 55
4856 CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | (hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst);
4957 CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
5058 info.bmWidthBytes, deviceRGBColorSpaceRef(), bitmapInfo);
75227

WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h

2727#define MediaPlayerPrivateFullscreenWindow_h
2828
2929#if USE(ACCELERATED_COMPOSITING)
30 #include "WKCACFLayer.h"
 30#include "PlatformCALayer.h"
3131#include "WKCACFLayerRenderer.h"
3232#endif
3333#include <wtf/OwnPtr.h>

6161#if USE(ACCELERATED_COMPOSITING)
6262 WKCACFLayerRenderer* layerRenderer() const { return m_layerRenderer.get(); }
6363
64  WKCACFLayer* rootChildLayer() const { return m_rootChild.get(); }
65  void setRootChildLayer(PassRefPtr<WKCACFLayer>);
 64 PlatformCALayer* rootChildLayer() const { return m_rootChild.get(); }
 65 void setRootChildLayer(PassRefPtr<PlatformCALayer>);
6666#endif
6767
6868private:

7272 MediaPlayerPrivateFullscreenClient* m_client;
7373#if USE(ACCELERATED_COMPOSITING)
7474 OwnPtr<WKCACFLayerRenderer> m_layerRenderer;
75  RefPtr<WKCACFLayer> m_rootChild;
 75 RefPtr<PlatformCALayer> m_rootChild;
7676#endif
7777 HWND m_hwnd;
7878};
75227

WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp

3333
3434#include "WKCACFLayerRenderer.h"
3535
 36#include "PlatformCALayer.h"
3637#include "WKCACFContextFlusher.h"
37 #include "WKCACFLayer.h"
3838#include "WebCoreInstanceHandle.h"
3939#include <WebKitSystemInterface/WebKitSystemInterface.h>
 40#include <limits.h>
 41#include <wtf/CurrentTime.h>
4042#include <wtf/HashMap.h>
4143#include <wtf/OwnArrayPtr.h>
4244#include <wtf/OwnPtr.h>

4547#include <d3d9.h>
4648#include <d3dx9.h>
4749
 50using namespace std;
 51
4852#pragma comment(lib, "d3d9")
4953#pragma comment(lib, "d3dx9")
5054#ifdef DEBUG_ALL

7983
8084namespace WebCore {
8185
82 // Subclass of WKCACFLayer to allow the root layer to have a back pointer to the layer renderer
83 // to fire off a draw
84 class WKCACFRootLayer : public WKCACFLayer {
85 public:
86  WKCACFRootLayer(WKCACFLayerRenderer* renderer)
87  : WKCACFLayer(WKCACFLayer::Layer)
88  {
89  m_renderer = renderer;
90  }
91 
92  static PassRefPtr<WKCACFRootLayer> create(WKCACFLayerRenderer* renderer)
93  {
94  if (!WKCACFLayerRenderer::acceleratedCompositingAvailable())
95  return 0;
96  return adoptRef(new WKCACFRootLayer(renderer));
97  }
98 
99  virtual void setNeedsRender() { m_renderer->layerTreeDidChange(); }
100 
101  // Overload this to avoid calling setNeedsDisplay on the layer, which would override the contents
102  // we have placed on the root layer.
103  virtual void setNeedsDisplay(const CGRect* dirtyRect) { setNeedsCommit(); }
104 
105 private:
106  WKCACFLayerRenderer* m_renderer;
107 };
108 
10986static D3DPRESENT_PARAMETERS initialPresentationParameters()
11087{
11188 D3DPRESENT_PARAMETERS parameters = {0};

206183WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client)
207184 : m_client(client)
208185 , m_mightBeAbleToCreateDeviceLater(true)
209  , m_rootLayer(WKCACFRootLayer::create(this))
 186 , m_rootLayer(PlatformCALayer::create(PlatformCALayer::LayerTypeRootLayer, 0))
210187 , m_context(wkCACFContextCreate())
211188 , m_hostWindow(0)
212189 , m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
213190 , m_backingStoreDirty(false)
214191 , m_mustResetLostDeviceBeforeRendering(false)
 192 , m_syncLayerChanges(false)
215193{
 194 // Point the CACFContext to this
 195 wkCACFContextSetUserData(m_context, this);
 196
216197 // Under the root layer, we have a clipping layer to clip the content,
217198 // that contains a scroll layer that we use for scrolling the content.
218199 // The root layer is the size of the client area of the window.

223204 // Scrolling will affect only the position of the scroll layer without affecting the bounds.
224205
225206 m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
226  m_rootLayer->setAnchorPoint(CGPointMake(0, 0));
 207 m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0));
227208 m_rootLayer->setGeometryFlipped(true);
228209
229210#ifndef NDEBUG

233214#endif
234215
235216 if (m_context)
236  m_rootLayer->becomeRootLayerForContext(m_context);
 217 wkCACFContextSetLayer(m_context, m_rootLayer->platformLayer());
237218
238219#ifndef NDEBUG
239220 char* printTreeFlag = getenv("CA_PRINT_TREE");

247228 wkCACFContextDestroy(m_context);
248229}
249230
250 WKCACFLayer* WKCACFLayerRenderer::rootLayer() const
 231PlatformCALayer* WKCACFLayerRenderer::rootLayer() const
251232{
252233 return m_rootLayer.get();
253234}
254235
 236void WKCACFLayerRenderer::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer)
 237{
 238 m_pendingAnimatedLayers.add(layer);
 239}
 240
255241void WKCACFLayerRenderer::setRootContents(CGImageRef image)
256242{
257243 ASSERT(m_rootLayer);

266252 paint();
267253}
268254
269 void WKCACFLayerRenderer::setRootChildLayer(WKCACFLayer* layer)
 255void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer)
270256{
271257 m_rootLayer->removeAllSublayers();
272258 m_rootChildLayer = layer;
273259 if (m_rootChildLayer)
274  m_rootLayer->addSublayer(m_rootChildLayer);
 260 m_rootLayer->appendSublayer(m_rootChildLayer.get());
275261}
276262
277263void WKCACFLayerRenderer::layerTreeDidChange()

280266 renderSoon();
281267}
282268
283 void WKCACFLayerRenderer::setNeedsDisplay()
 269void WKCACFLayerRenderer::setNeedsDisplay(bool sync)
284270{
 271 if (!m_syncLayerChanges && sync)
 272 m_syncLayerChanges = true;
 273
285274 ASSERT(m_rootLayer);
286275 m_rootLayer->setNeedsDisplay(0);
287276 renderSoon();

361350
362351void WKCACFLayerRenderer::destroyRenderer()
363352{
364  if (m_context)
365  WKCACFContextFlusher::shared().removeContext(m_context);
 353 wkCACFContextSetLayer(m_context, m_rootLayer->platformLayer());
366354
367355 m_d3dDevice = 0;
368356 if (s_d3d)

463451 return;
464452 }
465453
 454 // Sync the layer if needed
 455 if (m_syncLayerChanges) {
 456 m_client->syncCompositingState();
 457 m_syncLayerChanges = false;
 458 }
 459
466460 // Flush the root layer to the render tree.
467  WKCACFContextFlusher::shared().flushAllContexts();
 461 wkCACFContextFlush(m_context);
468462
 463 // All pending animations will have been started with the flush. Fire the animationStarted calls
 464 double currentTime = WTF::currentTime();
 465 double currentMediaTime = CACurrentMediaTime();
 466 double t = currentTime + wkCACFContextGetLastCommitTime(m_context) - currentMediaTime;
 467 ASSERT(t <= currentTime);
 468
 469 HashSet<RefPtr<PlatformCALayer> >::iterator end = m_pendingAnimatedLayers.end();
 470 for (HashSet<RefPtr<PlatformCALayer> >::iterator it = m_pendingAnimatedLayers.begin(); it != end; ++it) {
 471 PlatformCALayerClient* owner = (*it)->owner();
 472 owner->platformCALayerAnimationStarted(t);
 473 }
 474
 475 m_pendingAnimatedLayers.clear();
 476
469477 CGRect bounds = this->bounds();
470478
471  CFTimeInterval t = CACurrentMediaTime();
472 
473479 // Give the renderer some space to use. This needs to be valid until the
474480 // wkCACFContextFinishUpdate() call below.
475481 char space[4096];
476  if (!wkCACFContextBeginUpdate(m_context, space, sizeof(space), t, bounds, windowDirtyRects.data(), windowDirtyRects.size()))
 482 if (!wkCACFContextBeginUpdate(m_context, space, sizeof(space), currentMediaTime, bounds, windowDirtyRects.data(), windowDirtyRects.size()))
477483 return;
478484
479485 HRESULT err = S_OK;
 486 CFTimeInterval timeToNextRender = numeric_limits<CFTimeInterval>::infinity();
 487
480488 do {
481489 // FIXME: don't need to clear dirty region if layer tree is opaque.
482490

496504 }
497505 wkCACFUpdateRectEnumeratorRelease(e);
498506
 507 timeToNextRender = wkCACFContextGetNextUpdateTime(m_context);
 508
499509 if (rects.isEmpty())
500510 break;
501511

523533 if (m_printTree)
524534 m_rootLayer->printTree();
525535#endif
 536
 537 // If timeToNextRender is not infinity, it means animations are running, so queue up to render again
 538 if (timeToNextRender != numeric_limits<CFTimeInterval>::infinity())
 539 renderSoon();
526540}
527541
528542void WKCACFLayerRenderer::renderSoon()
75227

WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp

5757#include <wtf/text/StringHash.h>
5858
5959#if USE(ACCELERATED_COMPOSITING)
60 #include "GraphicsLayerCACF.h"
61 #include "WKCACFLayer.h"
 60#include "PlatformCALayer.h"
6261#include "WKCAImageQueue.h"
6362#endif
6463

8584};
8685
8786#if USE(ACCELERATED_COMPOSITING)
88 // Interface declaration for MediaPlayerPrivateQuickTimeVisualContext's GraphicsLayerClient aggregate
89 class MediaPlayerPrivateQuickTimeVisualContext::LayerClient : public GraphicsLayerClient {
 87class MediaPlayerPrivateQuickTimeVisualContext::LayerClient : public PlatformCALayerClient {
9088public:
9189 LayerClient(MediaPlayerPrivateQuickTimeVisualContext* parent) : m_parent(parent) {}
9290 virtual ~LayerClient() { m_parent = 0; }
93  virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip);
94  virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { }
95  virtual void notifySyncRequired(const GraphicsLayer*) { }
96  virtual bool showDebugBorders() const { return false; }
97  virtual bool showRepaintCounter() const { return false; }
98 private:
99  MediaPlayerPrivateQuickTimeVisualContext* m_parent;
100 };
10191
102 class MediaPlayerPrivateQuickTimeVisualContext::LayoutClient : public WKCACFLayerLayoutClient {
103 public:
104  LayoutClient(MediaPlayerPrivateQuickTimeVisualContext* parent) : m_parent(parent) {}
105  virtual void layoutSublayersOfLayer(WKCACFLayer*);
10692private:
 93 virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*);
 94 virtual bool platformCALayerRespondsToLayoutChanges() const { return true; }
 95
 96 virtual void platformCALayerAnimationStarted(CFTimeInterval beginTime) { }
 97 virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const { return GraphicsLayer::CompositingCoordinatesBottomUp; }
 98 virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) { }
 99 virtual bool platformCALayerShowDebugBorders() const { return false; }
 100 virtual bool platformCALayerShowRepaintCounter() const { return false; }
 101 virtual int platformCALayerIncrementRepaintCount() { return 0; }
 102
 103 virtual bool platformCALayerContentsOpaque() const { return false; }
 104 virtual bool platformCALayerDrawsContent() const { return false; }
 105 virtual void platformCALayerLayerDidDisplay(PlatformLayer*) { }
 106
107107 MediaPlayerPrivateQuickTimeVisualContext* m_parent;
108108};
109109
110 void MediaPlayerPrivateQuickTimeVisualContext::LayoutClient::layoutSublayersOfLayer(WKCACFLayer* layer)
 110void MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerLayoutSublayersOfLayer(PlatformCALayer* layer)
111111{
112112 ASSERT(m_parent);
113  ASSERT(m_parent->m_transformLayer->platformLayer() == layer);
 113 ASSERT(m_parent->m_transformLayer == layer);
114114
115  CGSize parentSize = layer->bounds().size;
116  CGSize naturalSize = m_parent->naturalSize();
 115 FloatSize parentSize = layer->bounds().size();
 116 FloatSize naturalSize = m_parent->naturalSize();
117117
118118 // Calculate the ratio of these two sizes and use that ratio to scale the qtVideoLayer:
119  CGSize ratio = CGSizeMake(parentSize.width / naturalSize.width, parentSize.height / naturalSize.height);
 119 FloatSize ratio(parentSize.width() / naturalSize.width(), parentSize.height() / naturalSize.height());
120120
121121 int videoWidth = 0;
122122 int videoHeight = 0;
123123 m_parent->m_movie->getNaturalSize(videoWidth, videoHeight);
124  CGRect videoBounds = CGRectMake(0, 0, videoWidth * ratio.width, videoHeight * ratio.height);
125  CGPoint videoAnchor = m_parent->m_qtVideoLayer->anchorPoint();
 124 FloatRect videoBounds(0, 0, videoWidth * ratio.width(), videoHeight * ratio.height());
 125 FloatPoint3D videoAnchor = m_parent->m_qtVideoLayer->anchorPoint();
126126
127127 // Calculate the new position based on the parent's size:
128  CGPoint position = CGPointMake(parentSize.width * 0.5 - videoBounds.size.width * (0.5 - videoAnchor.x),
129  parentSize.height * 0.5 - videoBounds.size.height * (0.5 - videoAnchor.y));
 128 FloatPoint position(parentSize.width() * 0.5 - videoBounds.width() * (0.5 - videoAnchor.x()),
 129 parentSize.height() * 0.5 - videoBounds.height() * (0.5 - videoAnchor.y()));
130130
131131 m_parent->m_qtVideoLayer->setBounds(videoBounds);
132132 m_parent->m_qtVideoLayer->setPosition(position);

171171 , m_movieClient(new MediaPlayerPrivateQuickTimeVisualContext::MovieClient(this))
172172#if USE(ACCELERATED_COMPOSITING)
173173 , m_layerClient(new MediaPlayerPrivateQuickTimeVisualContext::LayerClient(this))
174  , m_layoutClient(new MediaPlayerPrivateQuickTimeVisualContext::LayoutClient(this))
175174 , m_movieTransform(CGAffineTransformIdentity)
176175#endif
177176 , m_visualContextClient(new MediaPlayerPrivateQuickTimeVisualContext::VisualContextClient(this))

203202 p.media.qtMovieVisualContext = m_visualContext.get();
204203 return p;
205204}
206 
207205#if USE(ACCELERATED_COMPOSITING)
 206
208207PlatformLayer* MediaPlayerPrivateQuickTimeVisualContext::platformLayer() const
209208{
210209 return m_transformLayer ? m_transformLayer->platformLayer() : 0;

866865 if (!buffer.pixelBufferRef())
867866 return;
868867
869  WKCACFLayer* layer = m_qtVideoLayer.get();
 868 PlatformCALayer* layer = m_qtVideoLayer.get();
870869
871870 if (!buffer.lockBaseAddress()) {
872871 if (requiredDllsAvailable()) {

900899 }
901900
902901 buffer.unlockBaseAddress();
903  layer->rootLayer()->setNeedsRender();
 902 layer->setNeedsCommit();
904903 }
905904 } else
906905#endif

11791178 if (!m_movie || m_qtVideoLayer)
11801179 return;
11811180
1182  // Create a GraphicsLayer that won't be inserted directly into the render tree, but will used
1183  // as a wrapper for a WKCACFLayer which gets inserted as the content layer of the video
1184  // renderer's GraphicsLayer.
1185  m_transformLayer.set(new GraphicsLayerCACF(m_layerClient.get()));
 1181 // Create a PlatformCALayer which will transform the contents of the video layer
 1182 // which is in m_qtVideoLayer.
 1183 m_transformLayer = PlatformCALayer::create(PlatformCALayer::LayerTypeLayer, m_layerClient.get());
11861184 if (!m_transformLayer)
11871185 return;
11881186
1189  // Mark the layer as drawing itself, anchored in the top left, and bottom-up.
1190  m_transformLayer->setDrawsContent(false);
 1187 // Mark the layer as anchored in the top left.
11911188 m_transformLayer->setAnchorPoint(FloatPoint3D());
1192  m_transformLayer->setContentsOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
1193  m_transformLayer->platformLayer()->setLayoutClient(m_layoutClient.get());
11941189
1195  m_qtVideoLayer = WKCACFLayer::create(WKCACFLayer::Layer);
 1190 m_qtVideoLayer = PlatformCALayer::create(PlatformCALayer::LayerTypeLayer, 0);
11961191 if (!m_qtVideoLayer)
11971192 return;
11981193

12091204#ifndef NDEBUG
12101205 m_qtVideoLayer->setName("Video layer");
12111206#endif
1212  m_transformLayer->platformLayer()->addSublayer(m_qtVideoLayer.get());
1213  m_transformLayer->platformLayer()->setNeedsLayout();
 1207 m_transformLayer->appendSublayer(m_qtVideoLayer.get());
 1208 m_transformLayer->setNeedsLayout();
12141209 // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration().
12151210#endif
12161211

12381233}
12391234
12401235#if USE(ACCELERATED_COMPOSITING)
1241 void MediaPlayerPrivateQuickTimeVisualContext::LayerClient::paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip)
1242 {
1243 }
1244 
12451236bool MediaPlayerPrivateQuickTimeVisualContext::supportsAcceleratedRendering() const
12461237{
12471238 return isReadyForRendering();
75227

WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp

5050
5151#if USE(ACCELERATED_COMPOSITING)
5252#include "GraphicsLayerCACF.h"
53 #include "WKCACFLayer.h"
 53#include "PlatformCALayer.h"
5454#endif
5555
5656#if DRAW_FRAME_RATE

760760
761761#if USE(ACCELERATED_COMPOSITING)
762762 if (m_qtVideoLayer)
763  m_qtVideoLayer->platformLayer()->setNeedsDisplay();
 763 m_qtVideoLayer->setNeedsDisplay();
764764 else
765765#endif
766766 m_player->repaint();

887887 return;
888888
889889 // Create a GraphicsLayer that won't be inserted directly into the render tree, but will used
890  // as a wrapper for a WKCACFLayer which gets inserted as the content layer of the video
 890 // as a wrapper for a PlatformCALayer which gets inserted as the content layer of the video
891891 // renderer's GraphicsLayer.
892892 m_qtVideoLayer.set(new GraphicsLayerCACF(this));
893893 if (!m_qtVideoLayer)
75227

WebCore/platform/graphics/win/WKCACFLayerRenderer.h

3030
3131#include "COMPtr.h"
3232#include "Timer.h"
33 #include "WKCACFLayer.h"
3433
 34#include <wtf/HashSet.h>
3535#include <wtf/Noncopyable.h>
36 
 36#include <wtf/PassOwnPtr.h>
3737#include <wtf/PassRefPtr.h>
3838#include <wtf/RefPtr.h>
3939#include <wtf/RetainPtr.h>
 40#include <wtf/Vector.h>
4041
4142#include <CoreGraphics/CGGeometry.h>
4243
4344interface IDirect3DDevice9;
4445struct WKCACFContext;
4546
 47typedef struct CGImage* CGImageRef;
 48
4649namespace WebCore {
4750
48 class WKCACFRootLayer;
 51class PlatformCALayer;
4952
5053class WKCACFLayerRendererClient {
5154public:
5255 virtual ~WKCACFLayerRendererClient() { }
5356 virtual bool shouldRender() const = 0;
 57 virtual void animationsStarted(CFTimeInterval) { }
 58 virtual void syncCompositingState() { }
5459};
5560
5661// FIXME: Currently there is a WKCACFLayerRenderer for each WebView and each
5762// has its own CARenderOGLContext and Direct3DDevice9, which is inefficient.
5863// (https://bugs.webkit.org/show_bug.cgi?id=31855)
5964class WKCACFLayerRenderer : public Noncopyable {
 65 friend PlatformCALayer;
 66
6067public:
6168 static PassOwnPtr<WKCACFLayerRenderer> create(WKCACFLayerRendererClient*);
6269 ~WKCACFLayerRenderer();

6572
6673 void setRootContents(CGImageRef);
6774 void setRootContentsAndDisplay(CGImageRef);
68  void setRootChildLayer(WKCACFLayer* layer);
 75 void setRootChildLayer(PlatformCALayer*);
6976 void layerTreeDidChange();
70  void setNeedsDisplay();
 77 void setNeedsDisplay(bool sync = false);
7178 void setHostWindow(HWND window) { m_hostWindow = window; }
7279 void setBackingStoreDirty(bool dirty) { m_backingStoreDirty = dirty; }
7380 bool createRenderer();

7683 void renderSoon();
7784
7885protected:
79  WKCACFLayer* rootLayer() const;
 86 PlatformCALayer* rootLayer() const;
 87 void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>);
8088
8189private:
8290 WKCACFLayerRenderer(WKCACFLayerRendererClient*);

99107 WKCACFLayerRendererClient* m_client;
100108 bool m_mightBeAbleToCreateDeviceLater;
101109 COMPtr<IDirect3DDevice9> m_d3dDevice;
102  RefPtr<WKCACFRootLayer> m_rootLayer;
103  RefPtr<WKCACFLayer> m_rootChildLayer;
 110 RefPtr<PlatformCALayer> m_rootLayer;
 111 RefPtr<PlatformCALayer> m_rootChildLayer;
104112 WKCACFContext* m_context;
105113 HWND m_hostWindow;
106114 Timer<WKCACFLayerRenderer> m_renderTimer;
107115 bool m_backingStoreDirty;
108116 bool m_mustResetLostDeviceBeforeRendering;
 117 bool m_syncLayerChanges;
 118 HashSet<RefPtr<PlatformCALayer> > m_pendingAnimatedLayers;
 119
109120#ifndef NDEBUG
110121 bool m_printTree;
111122#endif
75227

WebCore/platform/graphics/mac/WebLayer.mm

4040
4141@implementation WebLayer
4242
43 void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::GraphicsLayer* layerContents)
 43void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCALayerClient* layerContents)
4444{
4545 if (!layerContents)
4646 return;

4848 CGContextSaveGState(context);
4949
5050 CGRect layerBounds = [layer bounds];
51  if (layerContents->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp) {
 51 if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp) {
5252 CGContextScaleCTM(context, 1, -1);
5353 CGContextTranslateCTM(context, 0, -layerBounds.size.height);
5454 }
5555
56  if (layerContents->client()) {
57  [NSGraphicsContext saveGraphicsState];
 56 [NSGraphicsContext saveGraphicsState];
5857
59  // Set up an NSGraphicsContext for the context, so that parts of AppKit that rely on
60  // the current NSGraphicsContext (e.g. NSCell drawing) get the right one.
61  NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES];
62  [NSGraphicsContext setCurrentContext:layerContext];
 58 // Set up an NSGraphicsContext for the context, so that parts of AppKit that rely on
 59 // the current NSGraphicsContext (e.g. NSCell drawing) get the right one.
 60 NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES];
 61 [NSGraphicsContext setCurrentContext:layerContext];
6362
64  GraphicsContext graphicsContext(context);
 63 GraphicsContext graphicsContext(context);
6564
66  if (!layerContents->contentsOpaque()) {
67  // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
68  graphicsContext.setShouldSmoothFonts(false);
69  }
70 
71  // It's important to get the clip from the context, because it may be significantly
72  // smaller than the layer bounds (e.g. tiled layers)
73  CGRect clipBounds = CGContextGetClipBoundingBox(context);
74  IntRect clip(enclosingIntRect(clipBounds));
75  layerContents->paintGraphicsLayerContents(graphicsContext, clip);
76 
77  [NSGraphicsContext restoreGraphicsState];
 65 if (!layerContents->platformCALayerContentsOpaque()) {
 66 // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
 67 graphicsContext.setShouldSmoothFonts(false);
7868 }
79 #ifndef NDEBUG
80  else {
81  ASSERT_NOT_REACHED();
 69
 70 // It's important to get the clip from the context, because it may be significantly
 71 // smaller than the layer bounds (e.g. tiled layers)
 72 CGRect clipBounds = CGContextGetClipBoundingBox(context);
 73 IntRect clip(enclosingIntRect(clipBounds));
 74 layerContents->platformCALayerPaintContents(graphicsContext, clip);
8275
83  // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is a plain color,
84  // so CA never makes backing store for it (which is what -setNeedsDisplay will do above).
85  CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f);
86  CGContextFillRect(context, layerBounds);
87  }
88 #endif
 76 [NSGraphicsContext restoreGraphicsState];
8977
90  if (layerContents->showRepaintCounter()) {
 78 if (layerContents->platformCALayerShowRepaintCounter()) {
9179 bool isTiledLayer = [layer isKindOfClass:[CATiledLayer class]];
9280
9381 char text[16]; // that's a lot of repaints
94  snprintf(text, sizeof(text), "%d", layerContents->incrementRepaintCount());
 82 snprintf(text, sizeof(text), "%d", layerContents->platformCALayerIncrementRepaintCount());
9583
9684 CGContextSaveGState(context);
9785 if (isTiledLayer)

117105 CGContextRestoreGState(context);
118106}
119107
120 void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::GraphicsLayer* layerContents, CGRect rect)
 108void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::PlatformCALayerClient* layerContents, CGRect rect)
121109{
122  if (layerContents && layerContents->client() && layerContents->drawsContent()) {
 110 if (layerContents && layerContents->platformCALayerDrawsContent()) {
123111 struct objc_super layerSuper = { layer, class_getSuperclass(object_getClass(layer)) };
124112#if defined(BUILDING_ON_LEOPARD)
125113 rect = CGRectApplyAffineTransform(rect, [layer contentsTransform]);
126114#else
127  if (layerContents->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
 115 if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
128116 rect.origin.y = [layer bounds].size.height - rect.origin.y - rect.size.height;
129117#endif
130118 objc_msgSendSuper(&layerSuper, @selector(setNeedsDisplayInRect:), rect);
131119
132120#ifndef NDEBUG
133  if (layerContents->showRepaintCounter()) {
 121 if (layerContents->platformCALayerShowRepaintCounter()) {
134122 CGRect bounds = [layer bounds];
135123 CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 46, 25);
136124#if defined(BUILDING_ON_LEOPARD)
137125 indicatorRect = CGRectApplyAffineTransform(indicatorRect, [layer contentsTransform]);
138126#else
139  if (layerContents->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
 127 if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
140128 indicatorRect.origin.y = [layer bounds].size.height - indicatorRect.origin.y - indicatorRect.size.height;
141129#endif
142130 objc_msgSendSuper(&layerSuper, @selector(setNeedsDisplayInRect:), indicatorRect);

155143- (void)setNeedsDisplay
156144{
157145 PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
158  if (layer && layer->owner() && layer->owner()->client() && layer->owner()->drawsContent())
 146 if (layer && layer->owner() && layer->owner()->platformCALayerDrawsContent())
159147 [super setNeedsDisplay];
160148}
161149

171159 [super display];
172160 PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
173161 if (layer && layer->owner())
174  layer->owner()->didDisplay(self);
 162 layer->owner()->platformCALayerLayerDidDisplay(self);
175163}
176164
177165- (void)drawInContext:(CGContextRef)context
75227

WebCore/platform/graphics/mac/WebLayer.h

3232
3333namespace WebCore {
3434 class GraphicsLayer;
 35 class PlatformCALayerClient;
3536}
3637
3738#if defined(BUILDING_ON_LEOPARD)

4748@end
4849
4950// Functions allows us to share implementation across WebTiledLayer and WebLayer
50 void drawLayerContents(CGContextRef, CALayer *, WebCore::GraphicsLayer*);
51 void setLayerNeedsDisplayInRect(CALayer *, WebCore::GraphicsLayer*, CGRect);
 51void drawLayerContents(CGContextRef, CALayer *, WebCore::PlatformCALayerClient*);
 52void setLayerNeedsDisplayInRect(CALayer *, WebCore::PlatformCALayerClient*, CGRect);
5253
5354#endif // USE(ACCELERATED_COMPOSITING)
5455
75227

WebCore/platform/graphics/mac/WebTiledLayer.mm

6060- (void)setNeedsDisplay
6161{
6262 PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
63  if (layer && layer->owner() && layer->owner()->client() && layer->owner()->drawsContent())
 63 if (layer && layer->owner() && layer->owner()->platformCALayerDrawsContent())
6464 [super setNeedsDisplay];
6565}
6666

7676 [super display];
7777 PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
7878 if (layer && layer->owner())
79  layer->owner()->didDisplay(self);
 79 layer->owner()->platformCALayerLayerDidDisplay(self);
8080}
8181
8282- (void)drawInContext:(CGContextRef)context
75227

WebCore/platform/graphics/mac/WebGLLayer.mm

144144{
145145 [super display];
146146 if (m_layerOwner)
147  m_layerOwner->didDisplay(self);
 147 m_layerOwner->layerDidDisplay(self);
148148}
149149
150150@end
75227

WebCore/platform/graphics/GraphicsLayer.h

5353typedef void* PlatformLayer;
5454#endif
5555#elif PLATFORM(WIN)
56 namespace WebCore {
57 class WKCACFLayer;
58 typedef WKCACFLayer PlatformLayer;
59 }
 56typedef struct _CACFLayer PlatformLayer;
6057#elif PLATFORM(QT)
6158#if USE(TEXTURE_MAPPER)
6259namespace WebCore {

314311 // Callback from the underlying graphics system to draw layer contents.
315312 void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip);
316313 // Callback from the underlying graphics system when the layer has been displayed
317  virtual void didDisplay(PlatformLayer*) { }
 314 virtual void layerDidDisplay(PlatformLayer*) { }
318315
319316 // For hosting this GraphicsLayer in a native layer hierarchy.
320317 virtual PlatformLayer* platformLayer() const { return 0; }

330327 virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
331328 CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; }
332329
333  bool showDebugBorders() { return m_client ? m_client->showDebugBorders() : false; }
334  bool showRepaintCounter() { return m_client ? m_client->showRepaintCounter() : false; }
 330 bool showDebugBorders() const { return m_client ? m_client->showDebugBorders() : false; }
 331 bool showRepaintCounter() const { return m_client ? m_client->showRepaintCounter() : false; }
335332
336333 void updateDebugIndicators();
337334
75227

WebCore/rendering/RenderLayerCompositor.h

5454//
5555// There is one RenderLayerCompositor per RenderView.
5656
57 class RenderLayerCompositor {
 57class RenderLayerCompositor : public GraphicsLayerClient {
5858public:
5959 RenderLayerCompositor(RenderView*);
6060 ~RenderLayerCompositor();
61 
 61
6262 // Return true if this RenderView is in "compositing mode" (i.e. has one or more
6363 // composited RenderLayers)
6464 bool inCompositingMode() const { return m_compositing; }

7171
7272 bool canRender3DTransforms() const;
7373
74  bool showDebugBorders() const { return m_showDebugBorders; }
75  bool showRepaintCounter() const { return m_showRepaintCounter; }
76 
7774 // Copy the accelerated compositing related flags from Settings
7875 void cacheAcceleratedCompositingFlags();
7976

172169
173170 String layerTreeAsText();
174171
 172 // These are named to avoid conflicts with the functions in GraphicsLayerClient
 173 // These return the actual internal variables.
 174 bool compositorShowDebugBorders() const { return m_showDebugBorders; }
 175 bool compositorShowRepaintCounter() const { return m_showRepaintCounter; }
 176
175177private:
 178 // GraphicsLayerClient Implementation
 179 virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
 180 virtual void notifySyncRequired(const GraphicsLayer*) { scheduleSync(); }
 181 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) { }
 182
 183 // These calls return false always. They are saying that the layers associated with this client
 184 // (the clipLayer and scrollLayer) should never show debugging info.
 185 virtual bool showDebugBorders() const { return false; }
 186 virtual bool showRepaintCounter() const { return false; }
 187
176188 // Whether the given RL needs a compositing layer.
177189 bool needsToBeComposited(const RenderLayer*) const;
178190 // Whether the layer has an intrinsic need for compositing layer.
75227

WebCore/rendering/RenderLayerCompositor.cpp

13511351 if (!m_clipLayer) {
13521352 ASSERT(!m_scrollLayer);
13531353 // Create a clipping layer if this is an iframe
1354  m_clipLayer = GraphicsLayer::create(0);
 1354 m_clipLayer = GraphicsLayer::create(this);
13551355#ifndef NDEBUG
13561356 m_clipLayer->setName("iframe Clipping");
13571357#endif
13581358 m_clipLayer->setMasksToBounds(true);
13591359
1360  m_scrollLayer = GraphicsLayer::create(0);
 1360 m_scrollLayer = GraphicsLayer::create(this);
13611361#ifndef NDEBUG
13621362 m_scrollLayer->setName("iframe scrolling");
13631363#endif
75227

WebCore/rendering/RenderLayerBacking.cpp

11011101
11021102bool RenderLayerBacking::showDebugBorders() const
11031103{
1104  return compositor() ? compositor()->showDebugBorders() : false;
 1104 return compositor() ? compositor()->compositorShowDebugBorders() : false;
11051105}
11061106
11071107bool RenderLayerBacking::showRepaintCounter() const
11081108{
1109  return compositor() ? compositor()->showRepaintCounter() : false;
 1109 return compositor() ? compositor()->compositorShowRepaintCounter() : false;
11101110}
11111111
11121112bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes)
75227

WebCore/WebCore.xcodeproj/project.pbxproj

10071007 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
10081008 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
10091009 492863991253B8FC00F792D6 /* ResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1010 493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 493E5E0812D6420500020081 /* PlatformCALayerClient.h */; };
10101011 49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */; };
10111012 49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 49484FB4102CF23C00187DD3 /* CanvasGradient.h */; };
10121013 49484FC4102CF23C00187DD3 /* CanvasPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FB6102CF23C00187DD3 /* CanvasPattern.cpp */; };

73337334 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
73347335 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
73357336 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadInfo.h; sourceTree = "<group>"; };
 7337 493E5E0812D6420500020081 /* PlatformCALayerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformCALayerClient.h; path = ca/PlatformCALayerClient.h; sourceTree = "<group>"; };
73367338 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasGradient.cpp; path = canvas/CanvasGradient.cpp; sourceTree = "<group>"; };
73377339 49484FB4102CF23C00187DD3 /* CanvasGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasGradient.h; path = canvas/CanvasGradient.h; sourceTree = "<group>"; };
73387340 49484FB5102CF23C00187DD3 /* CanvasGradient.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CanvasGradient.idl; path = canvas/CanvasGradient.idl; sourceTree = "<group>"; };

1324113243 499B3ED5128CD31400E726C2 /* GraphicsLayerCA.h */,
1324213244 499B3EDC128DB50100E726C2 /* PlatformCAAnimation.h */,
1324313245 499B3EC3128CCC4700E726C2 /* PlatformCALayer.h */,
 13246 493E5E0812D6420500020081 /* PlatformCALayerClient.h */,
1324413247 494BC40C12AEDD9E00743BD2 /* TransformationMatrixCA.cpp */,
1324513248 );
1324613249 name = ca;

2227222275 7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */,
2227322276 7EE6846F12D26E3800E79415 /* ResourceRequestCFNet.h in Headers */,
2227422277 7EE6847012D26E3800E79415 /* ResourceResponse.h in Headers */,
 22278 493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */,
2227522279 );
2227622280 runOnlyForDeploymentPostprocessing = 0;
2227722281 };
75227

LayoutTests/ChangeLog

 12011-01-07 Chris Marrin <cmarrin@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations
 6 https://bugs.webkit.org/show_bug.cgi?id=49388
 7
 8 Use a double nested zero length timer like other tests here do
 9 to give the renderer time to do the render and switch into tiled
 10 layers.
 11
 12 * compositing/tiling/huge-layer-with-layer-children.html:
 13 * compositing/tiling/huge-layer.html:
 14
1152011-01-07 Alejandro G. Castro <alex@igalia.com>
216
317 Reviewed by Martin Robinson.
75256

LayoutTests/compositing/tiling/huge-layer.html

3838
3939 function testOnLoad()
4040 {
 41 // Wait for a layer update and the tiled layer to fill in.
4142 window.setTimeout(function() {
42  if (window.layoutTestController) {
43  document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
44  layoutTestController.notifyDone();
45  }
 43 window.setTimeout(function() {
 44 if (window.layoutTestController) {
 45 document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
 46 layoutTestController.notifyDone();
 47 }
 48 }, 0);
4649 }, 0);
4750 }
4851
75227

LayoutTests/compositing/tiling/huge-layer-with-layer-children.html

3939
4040 function testOnLoad()
4141 {
 42 // Wait for a layer update and the tiled layer to fill in.
4243 window.setTimeout(function() {
43  if (window.layoutTestController) {
44  document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
45  layoutTestController.notifyDone();
46  }
 44 window.setTimeout(function() {
 45 if (window.layoutTestController) {
 46 document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
 47 layoutTestController.notifyDone();
 48 }
 49 }, 0);
4750 }, 0);
4851 }
4952
75227