3b9c362698aa4c2c48fcd635d14d44430bd41de3
[WebKit-https.git] / Source / WebCore / platform / graphics / chromium / LayerChromium.cpp
1 /*
2  * Copyright (C) 2010 Google 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 are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include "config.h"
32
33 #if USE(ACCELERATED_COMPOSITING)
34 #include "LayerChromium.h"
35
36 #include "TextStream.h"
37 #include "cc/CCActiveAnimation.h"
38 #include "cc/CCAnimationEvents.h"
39 #include "cc/CCLayerAnimationController.h"
40 #include "cc/CCLayerImpl.h"
41 #include "cc/CCLayerTreeHost.h"
42 #include "cc/CCSettings.h"
43
44 #include <public/WebAnimationDelegate.h>
45
46 using namespace std;
47 using WebKit::WebTransformationMatrix;
48
49 namespace WebCore {
50
51 static int s_nextLayerId = 1;
52
53 PassRefPtr<LayerChromium> LayerChromium::create()
54 {
55     return adoptRef(new LayerChromium());
56 }
57
58 LayerChromium::LayerChromium()
59     : m_needsDisplay(false)
60     , m_stackingOrderChanged(false)
61     , m_layerId(s_nextLayerId++)
62     , m_parent(0)
63     , m_layerTreeHost(0)
64     , m_layerAnimationController(CCLayerAnimationController::create(this))
65     , m_scrollable(false)
66     , m_shouldScrollOnMainThread(false)
67     , m_haveWheelEventHandlers(false)
68     , m_nonFastScrollableRegionChanged(false)
69     , m_anchorPoint(0.5, 0.5)
70     , m_backgroundColor(0)
71     , m_debugBorderColor(0)
72     , m_debugBorderWidth(0)
73     , m_opacity(1.0)
74     , m_anchorPointZ(0)
75     , m_isContainerForFixedPositionLayers(false)
76     , m_fixedToContainerLayer(false)
77     , m_isDrawable(false)
78     , m_masksToBounds(false)
79     , m_opaque(false)
80     , m_doubleSided(true)
81     , m_useLCDText(false)
82     , m_preserves3D(false)
83     , m_useParentBackfaceVisibility(false)
84     , m_alwaysReserveTextures(false)
85     , m_drawCheckerboardForMissingTiles(false)
86     , m_forceRenderSurface(false)
87     , m_replicaLayer(0)
88     , m_drawOpacity(0)
89     , m_drawOpacityIsAnimating(false)
90     , m_renderTarget(0)
91     , m_drawTransformIsAnimating(false)
92     , m_screenSpaceTransformIsAnimating(false)
93     , m_contentsScale(1.0)
94     , m_layerAnimationDelegate(0)
95     , m_layerScrollDelegate(0)
96 {
97     if (m_layerId < 0) {
98         s_nextLayerId = 1;
99         m_layerId = s_nextLayerId++;
100     }
101 }
102
103 LayerChromium::~LayerChromium()
104 {
105     // Our parent should be holding a reference to us so there should be no
106     // way for us to be destroyed while we still have a parent.
107     ASSERT(!parent());
108
109     // Remove the parent reference from all children.
110     removeAllChildren();
111 }
112
113 void LayerChromium::setUseLCDText(bool useLCDText)
114 {
115     m_useLCDText = useLCDText;
116 }
117
118 void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
119 {
120     if (m_layerTreeHost == host)
121         return;
122
123     m_layerTreeHost = host;
124
125     for (size_t i = 0; i < m_children.size(); ++i)
126         m_children[i]->setLayerTreeHost(host);
127
128     if (m_maskLayer)
129         m_maskLayer->setLayerTreeHost(host);
130     if (m_replicaLayer)
131         m_replicaLayer->setLayerTreeHost(host);
132
133     // If this layer already has active animations, the host needs to be notified.
134     if (host && m_layerAnimationController->hasActiveAnimation())
135         host->didAddAnimation();
136 }
137
138 void LayerChromium::setNeedsCommit()
139 {
140     if (m_layerTreeHost)
141         m_layerTreeHost->setNeedsCommit();
142 }
143
144 void LayerChromium::setParent(LayerChromium* layer)
145 {
146     ASSERT(!layer || !layer->hasAncestor(this));
147     m_parent = layer;
148     setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0);
149 }
150
151 bool LayerChromium::hasAncestor(LayerChromium* ancestor) const
152 {
153     for (LayerChromium* layer = parent(); layer; layer = layer->parent()) {
154         if (layer == ancestor)
155             return true;
156     }
157     return false;
158 }
159
160 void LayerChromium::addChild(PassRefPtr<LayerChromium> child)
161 {
162     insertChild(child, numChildren());
163 }
164
165 void LayerChromium::insertChild(PassRefPtr<LayerChromium> child, size_t index)
166 {
167     index = min(index, m_children.size());
168     child->removeFromParent();
169     child->setParent(this);
170     child->m_stackingOrderChanged = true;
171     m_children.insert(index, child);
172     setNeedsCommit();
173 }
174
175 void LayerChromium::removeFromParent()
176 {
177     if (m_parent)
178         m_parent->removeChild(this);
179 }
180
181 void LayerChromium::removeChild(LayerChromium* child)
182 {
183     int foundIndex = indexOfChild(child);
184     if (foundIndex == -1)
185         return;
186
187     child->setParent(0);
188     m_children.remove(foundIndex);
189     setNeedsCommit();
190 }
191
192 void LayerChromium::replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer)
193 {
194     ASSERT_ARG(reference, reference);
195     ASSERT_ARG(reference, reference->parent() == this);
196
197     if (reference == newLayer)
198         return;
199
200     int referenceIndex = indexOfChild(reference);
201     if (referenceIndex == -1) {
202         ASSERT_NOT_REACHED();
203         return;
204     }
205
206     reference->removeFromParent();
207
208     if (newLayer) {
209         newLayer->removeFromParent();
210         insertChild(newLayer, referenceIndex);
211     }
212 }
213
214 int LayerChromium::indexOfChild(const LayerChromium* reference)
215 {
216     for (size_t i = 0; i < m_children.size(); i++) {
217         if (m_children[i] == reference)
218             return i;
219     }
220     return -1;
221 }
222
223 void LayerChromium::setBounds(const IntSize& size)
224 {
225     if (bounds() == size)
226         return;
227
228     bool firstResize = bounds().isEmpty() && !size.isEmpty();
229
230     m_bounds = size;
231
232     if (firstResize)
233         setNeedsDisplay();
234     else
235         setNeedsCommit();
236 }
237
238 const LayerChromium* LayerChromium::rootLayer() const
239 {
240     const LayerChromium* layer = this;
241     for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
242     return layer;
243 }
244
245 void LayerChromium::removeAllChildren()
246 {
247     while (m_children.size()) {
248         LayerChromium* layer = m_children[0].get();
249         ASSERT(layer->parent());
250         layer->removeFromParent();
251     }
252 }
253
254 void LayerChromium::setChildren(const Vector<RefPtr<LayerChromium> >& children)
255 {
256     if (children == m_children)
257         return;
258
259     removeAllChildren();
260     size_t listSize = children.size();
261     for (size_t i = 0; i < listSize; i++)
262         addChild(children[i]);
263 }
264
265 void LayerChromium::setAnchorPoint(const FloatPoint& anchorPoint)
266 {
267     if (m_anchorPoint == anchorPoint)
268         return;
269     m_anchorPoint = anchorPoint;
270     setNeedsCommit();
271 }
272
273 void LayerChromium::setAnchorPointZ(float anchorPointZ)
274 {
275     if (m_anchorPointZ == anchorPointZ)
276         return;
277     m_anchorPointZ = anchorPointZ;
278     setNeedsCommit();
279 }
280
281 void LayerChromium::setBackgroundColor(SkColor backgroundColor)
282 {
283     if (m_backgroundColor == backgroundColor)
284         return;
285     m_backgroundColor = backgroundColor;
286     setNeedsCommit();
287 }
288
289 void LayerChromium::setMasksToBounds(bool masksToBounds)
290 {
291     if (m_masksToBounds == masksToBounds)
292         return;
293     m_masksToBounds = masksToBounds;
294     setNeedsCommit();
295 }
296
297 void LayerChromium::setMaskLayer(LayerChromium* maskLayer)
298 {
299     if (m_maskLayer == maskLayer)
300         return;
301     if (m_maskLayer)
302         m_maskLayer->setLayerTreeHost(0);
303     m_maskLayer = maskLayer;
304     if (m_maskLayer) {
305         m_maskLayer->setLayerTreeHost(m_layerTreeHost);
306         m_maskLayer->setIsMask(true);
307     }
308     setNeedsCommit();
309 }
310
311 void LayerChromium::setReplicaLayer(LayerChromium* layer)
312 {
313     if (m_replicaLayer == layer)
314         return;
315     if (m_replicaLayer)
316         m_replicaLayer->setLayerTreeHost(0);
317     m_replicaLayer = layer;
318     if (m_replicaLayer)
319         m_replicaLayer->setLayerTreeHost(m_layerTreeHost);
320     setNeedsCommit();
321 }
322
323 void LayerChromium::setFilters(const WebKit::WebFilterOperations& filters)
324 {
325     if (m_filters == filters)
326         return;
327     m_filters = filters;
328     setNeedsCommit();
329     if (!filters.isEmpty())
330         CCLayerTreeHost::setNeedsFilterContext(true);
331 }
332
333 void LayerChromium::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFilters)
334 {
335     if (m_backgroundFilters == backgroundFilters)
336         return;
337     m_backgroundFilters = backgroundFilters;
338     setNeedsCommit();
339     if (!backgroundFilters.isEmpty())
340         CCLayerTreeHost::setNeedsFilterContext(true);
341 }
342
343 void LayerChromium::setOpacity(float opacity)
344 {
345     if (m_opacity == opacity)
346         return;
347     m_opacity = opacity;
348     setNeedsCommit();
349 }
350
351 bool LayerChromium::opacityIsAnimating() const
352 {
353     return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Opacity);
354 }
355
356 void LayerChromium::setOpaque(bool opaque)
357 {
358     if (m_opaque == opaque)
359         return;
360     m_opaque = opaque;
361     setNeedsDisplay();
362 }
363
364 void LayerChromium::setPosition(const FloatPoint& position)
365 {
366     if (m_position == position)
367         return;
368     m_position = position;
369     setNeedsCommit();
370 }
371
372 void LayerChromium::setSublayerTransform(const WebTransformationMatrix& sublayerTransform)
373 {
374     if (m_sublayerTransform == sublayerTransform)
375         return;
376     m_sublayerTransform = sublayerTransform;
377     setNeedsCommit();
378 }
379
380 void LayerChromium::setTransform(const WebTransformationMatrix& transform)
381 {
382     if (m_transform == transform)
383         return;
384     m_transform = transform;
385     setNeedsCommit();
386 }
387
388 bool LayerChromium::transformIsAnimating() const
389 {
390     return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Transform);
391 }
392
393 void LayerChromium::setScrollPosition(const IntPoint& scrollPosition)
394 {
395     if (m_scrollPosition == scrollPosition)
396         return;
397     m_scrollPosition = scrollPosition;
398     setNeedsCommit();
399 }
400
401 void LayerChromium::setMaxScrollPosition(const IntSize& maxScrollPosition)
402 {
403     if (m_maxScrollPosition == maxScrollPosition)
404         return;
405     m_maxScrollPosition = maxScrollPosition;
406     setNeedsCommit();
407 }
408
409 void LayerChromium::setScrollable(bool scrollable)
410 {
411     if (m_scrollable == scrollable)
412         return;
413     m_scrollable = scrollable;
414     setNeedsCommit();
415 }
416
417 void LayerChromium::setShouldScrollOnMainThread(bool shouldScrollOnMainThread)
418 {
419     if (m_shouldScrollOnMainThread == shouldScrollOnMainThread)
420         return;
421     m_shouldScrollOnMainThread = shouldScrollOnMainThread;
422     setNeedsCommit();
423 }
424
425 void LayerChromium::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
426 {
427     if (m_haveWheelEventHandlers == haveWheelEventHandlers)
428         return;
429     m_haveWheelEventHandlers = haveWheelEventHandlers;
430     setNeedsCommit();
431 }
432
433 void LayerChromium::setNonFastScrollableRegion(const Region& region)
434 {
435     if (m_nonFastScrollableRegion == region)
436         return;
437     m_nonFastScrollableRegion = region;
438     m_nonFastScrollableRegionChanged = true;
439     setNeedsCommit();
440 }
441
442 void LayerChromium::scrollBy(const IntSize& scrollDelta)
443 {
444     setScrollPosition(scrollPosition() + scrollDelta);
445     if (m_layerScrollDelegate)
446         m_layerScrollDelegate->didScroll(scrollDelta);
447 }
448
449 void LayerChromium::setDrawCheckerboardForMissingTiles(bool checkerboard)
450 {
451     if (m_drawCheckerboardForMissingTiles == checkerboard)
452         return;
453     m_drawCheckerboardForMissingTiles = checkerboard;
454     setNeedsCommit();
455 }
456
457 void LayerChromium::setForceRenderSurface(bool force)
458 {
459     if (m_forceRenderSurface == force)
460         return;
461     m_forceRenderSurface = force;
462     setNeedsCommit();
463 }
464
465 void LayerChromium::setDoubleSided(bool doubleSided)
466 {
467     if (m_doubleSided == doubleSided)
468         return;
469     m_doubleSided = doubleSided;
470     setNeedsCommit();
471 }
472
473 void LayerChromium::setIsDrawable(bool isDrawable)
474 {
475     if (m_isDrawable == isDrawable)
476         return;
477
478     m_isDrawable = isDrawable;
479     setNeedsCommit();
480 }
481
482 LayerChromium* LayerChromium::parent() const
483 {
484     return m_parent;
485 }
486
487 void LayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
488 {
489     m_updateRect.unite(dirtyRect);
490
491     // Simply mark the contents as dirty. For non-root layers, the call to
492     // setNeedsCommit will schedule a fresh compositing pass.
493     // For the root layer, setNeedsCommit has no effect.
494     if (!dirtyRect.isEmpty())
495         m_needsDisplay = true;
496
497     setNeedsCommit();
498 }
499
500 bool LayerChromium::descendantIsFixedToContainerLayer() const
501 {
502     for (size_t i = 0; i < m_children.size(); ++i) {
503         if (m_children[i]->fixedToContainerLayer() || m_children[i]->descendantIsFixedToContainerLayer())
504             return true;
505     }
506     return false;
507 }
508
509 void LayerChromium::setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers)
510 {
511     if (m_isContainerForFixedPositionLayers == isContainerForFixedPositionLayers)
512         return;
513     m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers;
514
515     if (m_layerTreeHost && m_layerTreeHost->commitRequested())
516         return;
517
518     // Only request a commit if we have a fixed positioned descendant.
519     if (descendantIsFixedToContainerLayer())
520         setNeedsCommit();
521 }
522
523 void LayerChromium::setFixedToContainerLayer(bool fixedToContainerLayer)
524 {
525     if (m_fixedToContainerLayer == fixedToContainerLayer)
526         return;
527     m_fixedToContainerLayer = fixedToContainerLayer;
528     setNeedsCommit();
529 }
530
531 void LayerChromium::pushPropertiesTo(CCLayerImpl* layer)
532 {
533     layer->setAnchorPoint(m_anchorPoint);
534     layer->setAnchorPointZ(m_anchorPointZ);
535     layer->setBackgroundColor(m_backgroundColor);
536     layer->setBounds(m_bounds);
537     layer->setContentBounds(contentBounds());
538     layer->setDebugBorderColor(m_debugBorderColor);
539     layer->setDebugBorderWidth(m_debugBorderWidth);
540     layer->setDebugName(m_debugName.isolatedCopy()); // We have to use isolatedCopy() here to safely pass ownership to another thread.
541     layer->setDoubleSided(m_doubleSided);
542     layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles);
543     layer->setForceRenderSurface(m_forceRenderSurface);
544     layer->setDrawsContent(drawsContent());
545     layer->setFilters(filters());
546     layer->setBackgroundFilters(backgroundFilters());
547     layer->setUseLCDText(m_useLCDText);
548     layer->setMasksToBounds(m_masksToBounds);
549     layer->setScrollable(m_scrollable);
550     layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread);
551     layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
552     // Copying a Region is more expensive than most layer properties, since it involves copying two Vectors that may be
553     // arbitrarily large depending on page content, so we only push the property if it's changed.
554     if (m_nonFastScrollableRegionChanged) {
555         layer->setNonFastScrollableRegion(m_nonFastScrollableRegion);
556         m_nonFastScrollableRegionChanged = false;
557     }
558     layer->setOpaque(m_opaque);
559     if (!opacityIsAnimating())
560         layer->setOpacity(m_opacity);
561     layer->setPosition(m_position);
562     layer->setIsContainerForFixedPositionLayers(m_isContainerForFixedPositionLayers);
563     layer->setFixedToContainerLayer(m_fixedToContainerLayer);
564     layer->setPreserves3D(preserves3D());
565     layer->setUseParentBackfaceVisibility(m_useParentBackfaceVisibility);
566     layer->setScrollPosition(m_scrollPosition);
567     layer->setMaxScrollPosition(m_maxScrollPosition);
568     layer->setSublayerTransform(m_sublayerTransform);
569     if (!transformIsAnimating())
570         layer->setTransform(m_transform);
571
572     // If the main thread commits multiple times before the impl thread actually draws, then damage tracking
573     // will become incorrect if we simply clobber the updateRect here. The CCLayerImpl's updateRect needs to
574     // accumulate (i.e. union) any update changes that have occurred on the main thread.
575     m_updateRect.uniteIfNonZero(layer->updateRect());
576     layer->setUpdateRect(m_updateRect);
577
578     layer->setScrollDelta(layer->scrollDelta() - layer->sentScrollDelta());
579     layer->setSentScrollDelta(IntSize());
580
581     layer->setStackingOrderChanged(m_stackingOrderChanged);
582
583     if (maskLayer())
584         maskLayer()->pushPropertiesTo(layer->maskLayer());
585     if (replicaLayer())
586         replicaLayer()->pushPropertiesTo(layer->replicaLayer());
587
588     m_layerAnimationController->pushAnimationUpdatesTo(layer->layerAnimationController());
589
590     // Reset any state that should be cleared for the next update.
591     m_stackingOrderChanged = false;
592     m_updateRect = FloatRect();
593 }
594
595 PassOwnPtr<CCLayerImpl> LayerChromium::createCCLayerImpl()
596 {
597     return CCLayerImpl::create(m_layerId);
598 }
599
600 void LayerChromium::setDebugBorderColor(SkColor color)
601 {
602     m_debugBorderColor = color;
603     setNeedsCommit();
604 }
605
606 void LayerChromium::setDebugBorderWidth(float width)
607 {
608     m_debugBorderWidth = width;
609     setNeedsCommit();
610 }
611
612 void LayerChromium::setDebugName(const String& debugName)
613 {
614     m_debugName = debugName;
615     setNeedsCommit();
616 }
617
618 void LayerChromium::setContentsScale(float contentsScale)
619 {
620     if (!needsContentsScale() || m_contentsScale == contentsScale)
621         return;
622     m_contentsScale = contentsScale;
623     setNeedsDisplay();
624 }
625
626 void LayerChromium::createRenderSurface()
627 {
628     ASSERT(!m_renderSurface);
629     m_renderSurface = adoptPtr(new RenderSurfaceChromium(this));
630     setRenderTarget(this);
631 }
632
633 bool LayerChromium::descendantDrawsContent()
634 {
635     for (size_t i = 0; i < m_children.size(); ++i) {
636         if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsContent())
637             return true;
638     }
639     return false;
640 }
641
642 void LayerChromium::setOpacityFromAnimation(float opacity)
643 {
644     // This is called due to an ongoing accelerated animation. Since this animation is
645     // also being run on the impl thread, there is no need to request a commit to push
646     // this value over, so set the value directly rather than calling setOpacity.
647     m_opacity = opacity;
648 }
649
650 void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& transform)
651 {
652     // This is called due to an ongoing accelerated animation. Since this animation is
653     // also being run on the impl thread, there is no need to request a commit to push
654     // this value over, so set this value directly rather than calling setTransform.
655     m_transform = transform;
656 }
657
658 bool LayerChromium::addAnimation(PassOwnPtr<CCActiveAnimation> animation)
659 {
660     if (!CCSettings::acceleratedAnimationEnabled())
661         return false;
662
663     m_layerAnimationController->addAnimation(animation);
664     if (m_layerTreeHost) {
665         m_layerTreeHost->didAddAnimation();
666         setNeedsCommit();
667     }
668     return true;
669 }
670
671 void LayerChromium::pauseAnimation(int animationId, double timeOffset)
672 {
673     m_layerAnimationController->pauseAnimation(animationId, timeOffset);
674     setNeedsCommit();
675 }
676
677 void LayerChromium::removeAnimation(int animationId)
678 {
679     m_layerAnimationController->removeAnimation(animationId);
680     setNeedsCommit();
681 }
682
683 void LayerChromium::suspendAnimations(double monotonicTime)
684 {
685     m_layerAnimationController->suspendAnimations(monotonicTime);
686     setNeedsCommit();
687 }
688
689 void LayerChromium::resumeAnimations(double monotonicTime)
690 {
691     m_layerAnimationController->resumeAnimations(monotonicTime);
692     setNeedsCommit();
693 }
694
695 void LayerChromium::setLayerAnimationController(PassOwnPtr<CCLayerAnimationController> layerAnimationController)
696 {
697     m_layerAnimationController = layerAnimationController;
698     if (m_layerAnimationController) {
699         m_layerAnimationController->setClient(this);
700         m_layerAnimationController->setForceSync();
701     }
702     setNeedsCommit();
703 }
704
705 PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationController()
706 {
707     OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.release();
708     m_layerAnimationController = CCLayerAnimationController::create(this);
709     return toReturn.release();
710 }
711
712 bool LayerChromium::hasActiveAnimation() const
713 {
714     return m_layerAnimationController->hasActiveAnimation();
715 }
716
717 void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double wallClockTime)
718 {
719     m_layerAnimationController->notifyAnimationStarted(event);
720     if (m_layerAnimationDelegate)
721         m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
722 }
723
724 void LayerChromium::notifyAnimationFinished(double wallClockTime)
725 {
726     if (m_layerAnimationDelegate)
727         m_layerAnimationDelegate->notifyAnimationFinished(wallClockTime);
728 }
729
730 Region LayerChromium::visibleContentOpaqueRegion() const
731 {
732     if (opaque())
733         return visibleContentRect();
734     return Region();
735 }
736
737 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChromium> >::iterator, void*)
738 {
739     // Currently we don't use z-order to decide what to paint, so there's no need to actually sort LayerChromiums.
740 }
741
742 }
743 #endif // USE(ACCELERATED_COMPOSITING)