Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: ui/cc/LayerChromium.cpp

Issue 10701016: Initial import attempt, just to play with. Many things disabled/removed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/cc/LayerChromium.h ('k') | ui/cc/LayerPainterChromium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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/CCLayerAnimationDelegate.h"
41 #include "cc/CCLayerImpl.h"
42 #include "cc/CCLayerTreeHost.h"
43 #include "cc/CCSettings.h"
44
45 using namespace std;
46 using WebKit::WebTransformationMatrix;
47
48 namespace WebCore {
49
50 static int s_nextLayerId = 1;
51
52 PassRefPtr<LayerChromium> LayerChromium::create()
53 {
54 return adoptRef(new LayerChromium());
55 }
56
57 LayerChromium::LayerChromium()
58 : m_needsDisplay(false)
59 , m_stackingOrderChanged(false)
60 , m_layerId(s_nextLayerId++)
61 , m_parent(0)
62 , m_layerTreeHost(0)
63 , m_layerAnimationController(CCLayerAnimationController::create(this))
64 , m_scrollable(false)
65 , m_shouldScrollOnMainThread(false)
66 , m_haveWheelEventHandlers(false)
67 , m_nonFastScrollableRegionChanged(false)
68 , m_anchorPoint(0.5, 0.5)
69 , m_backgroundColor(0)
70 , m_debugBorderColor(0)
71 , m_debugBorderWidth(0)
72 , m_opacity(1.0)
73 , m_anchorPointZ(0)
74 , m_isContainerForFixedPositionLayers(false)
75 , m_fixedToContainerLayer(false)
76 , m_isDrawable(false)
77 , m_masksToBounds(false)
78 , m_opaque(false)
79 , m_doubleSided(true)
80 , m_usesLayerClipping(false)
81 , m_isNonCompositedContent(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_targetRenderSurface(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::setIsNonCompositedContent(bool isNonCompositedContent)
114 {
115 m_isNonCompositedContent = isNonCompositedContent;
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 notifie d.
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<LayerChrom ium> 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& back groundFilters)
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::Op acity);
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& sublayer Transform)
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::Tr ansform);
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]->descendantI sFixedToContainerLayer())
504 return true;
505 }
506 return false;
507 }
508
509 void LayerChromium::setIsContainerForFixedPositionLayers(bool isContainerForFixe dPositionLayers)
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->setContentsScale(contentsScale());
539 layer->setDebugBorderColor(m_debugBorderColor);
540 layer->setDebugBorderWidth(m_debugBorderWidth);
541 layer->setDebugName(m_debugName.isolatedCopy()); // We have to use isolatedC opy() here to safely pass ownership to another thread.
542 layer->setDoubleSided(m_doubleSided);
543 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles) ;
544 layer->setForceRenderSurface(m_forceRenderSurface);
545 layer->setDrawsContent(drawsContent());
546 layer->setFilters(filters());
547 layer->setBackgroundFilters(backgroundFilters());
548 layer->setIsNonCompositedContent(m_isNonCompositedContent);
549 layer->setMasksToBounds(m_masksToBounds);
550 layer->setScrollable(m_scrollable);
551 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread);
552 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers);
553 // Copying a Region is more expensive than most layer properties, since it i nvolves copying two Vectors that may be
554 // arbitrarily large depending on page content, so we only push the property if it's changed.
555 if (m_nonFastScrollableRegionChanged) {
556 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion);
557 m_nonFastScrollableRegionChanged = false;
558 }
559 layer->setOpaque(m_opaque);
560 if (!opacityIsAnimating())
561 layer->setOpacity(m_opacity);
562 layer->setPosition(m_position);
563 layer->setIsContainerForFixedPositionLayers(m_isContainerForFixedPositionLay ers);
564 layer->setFixedToContainerLayer(m_fixedToContainerLayer);
565 layer->setPreserves3D(preserves3D());
566 layer->setUseParentBackfaceVisibility(m_useParentBackfaceVisibility);
567 layer->setScrollPosition(m_scrollPosition);
568 layer->setMaxScrollPosition(m_maxScrollPosition);
569 layer->setSublayerTransform(m_sublayerTransform);
570 if (!transformIsAnimating())
571 layer->setTransform(m_transform);
572
573 // If the main thread commits multiple times before the impl thread actually draws, then damage tracking
574 // will become incorrect if we simply clobber the updateRect here. The CCLay erImpl's updateRect needs to
575 // accumulate (i.e. union) any update changes that have occurred on the main thread.
576 m_updateRect.uniteIfNonZero(layer->updateRect());
577 layer->setUpdateRect(m_updateRect);
578
579 layer->setScrollDelta(layer->scrollDelta() - layer->sentScrollDelta());
580 layer->setSentScrollDelta(IntSize());
581
582 layer->setStackingOrderChanged(m_stackingOrderChanged);
583
584 if (maskLayer())
585 maskLayer()->pushPropertiesTo(layer->maskLayer());
586 if (replicaLayer())
587 replicaLayer()->pushPropertiesTo(layer->replicaLayer());
588
589 m_layerAnimationController->pushAnimationUpdatesTo(layer->layerAnimationCont roller());
590
591 // Reset any state that should be cleared for the next update.
592 m_stackingOrderChanged = false;
593 m_updateRect = FloatRect();
594 }
595
596 PassOwnPtr<CCLayerImpl> LayerChromium::createCCLayerImpl()
597 {
598 return CCLayerImpl::create(m_layerId);
599 }
600
601 void LayerChromium::setDebugBorderColor(SkColor color)
602 {
603 m_debugBorderColor = color;
604 setNeedsCommit();
605 }
606
607 void LayerChromium::setDebugBorderWidth(float width)
608 {
609 m_debugBorderWidth = width;
610 setNeedsCommit();
611 }
612
613 void LayerChromium::setDebugName(const String& debugName)
614 {
615 m_debugName = debugName;
616 setNeedsCommit();
617 }
618
619
620 void LayerChromium::setContentsScale(float contentsScale)
621 {
622 if (!needsContentsScale() || m_contentsScale == contentsScale)
623 return;
624 m_contentsScale = contentsScale;
625 setNeedsDisplay();
626 }
627
628 void LayerChromium::createRenderSurface()
629 {
630 ASSERT(!m_renderSurface);
631 m_renderSurface = adoptPtr(new RenderSurfaceChromium(this));
632 setTargetRenderSurface(m_renderSurface.get());
633 }
634
635 bool LayerChromium::descendantDrawsContent()
636 {
637 for (size_t i = 0; i < m_children.size(); ++i) {
638 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte nt())
639 return true;
640 }
641 return false;
642 }
643
644 void LayerChromium::setOpacityFromAnimation(float opacity)
645 {
646 // This is called due to an ongoing accelerated animation. Since this animat ion is
647 // also being run on the impl thread, there is no need to request a commit t o push
648 // this value over, so set the value directly rather than calling setOpacity .
649 m_opacity = opacity;
650 }
651
652 void LayerChromium::setTransformFromAnimation(const WebTransformationMatrix& tra nsform)
653 {
654 // This is called due to an ongoing accelerated animation. Since this animat ion is
655 // also being run on the impl thread, there is no need to request a commit t o push
656 // this value over, so set this value directly rather than calling setTransf orm.
657 m_transform = transform;
658 }
659
660 bool LayerChromium::addAnimation(PassOwnPtr<CCActiveAnimation> animation)
661 {
662 if (!CCSettings::acceleratedAnimationEnabled())
663 return false;
664
665 m_layerAnimationController->addAnimation(animation);
666 if (m_layerTreeHost) {
667 m_layerTreeHost->didAddAnimation();
668 setNeedsCommit();
669 }
670 return true;
671 }
672
673 void LayerChromium::pauseAnimation(int animationId, double timeOffset)
674 {
675 m_layerAnimationController->pauseAnimation(animationId, timeOffset);
676 setNeedsCommit();
677 }
678
679 void LayerChromium::removeAnimation(int animationId)
680 {
681 m_layerAnimationController->removeAnimation(animationId);
682 setNeedsCommit();
683 }
684
685 void LayerChromium::suspendAnimations(double monotonicTime)
686 {
687 m_layerAnimationController->suspendAnimations(monotonicTime);
688 setNeedsCommit();
689 }
690
691 void LayerChromium::resumeAnimations(double monotonicTime)
692 {
693 m_layerAnimationController->resumeAnimations(monotonicTime);
694 setNeedsCommit();
695 }
696
697 void LayerChromium::setLayerAnimationController(PassOwnPtr<CCLayerAnimationContr oller> layerAnimationController)
698 {
699 m_layerAnimationController = layerAnimationController;
700 if (m_layerAnimationController) {
701 m_layerAnimationController->setClient(this);
702 m_layerAnimationController->setForceSync();
703 }
704 setNeedsCommit();
705 }
706
707 PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationContr oller()
708 {
709 OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.rel ease();
710 m_layerAnimationController = CCLayerAnimationController::create(this);
711 return toReturn.release();
712 }
713
714 bool LayerChromium::hasActiveAnimation() const
715 {
716 return m_layerAnimationController->hasActiveAnimation();
717 }
718
719 void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double wallClockTime)
720 {
721 m_layerAnimationController->notifyAnimationStarted(event);
722 if (m_layerAnimationDelegate)
723 m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
724 }
725
726 void LayerChromium::notifyAnimationFinished(double wallClockTime)
727 {
728 if (m_layerAnimationDelegate)
729 m_layerAnimationDelegate->notifyAnimationFinished(wallClockTime);
730 }
731
732 Region LayerChromium::visibleContentOpaqueRegion() const
733 {
734 if (opaque())
735 return visibleLayerRect();
736 return Region();
737 }
738
739 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr omium> >::iterator, void*)
740 {
741 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort LayerChromiums.
742 }
743
744 }
745 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « ui/cc/LayerChromium.h ('k') | ui/cc/LayerPainterChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698