OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/layer.h" | 7 #include "cc/layer.h" |
8 | 8 |
9 #include "cc/active_animation.h" | 9 #include "cc/active_animation.h" |
10 #include "cc/animation_events.h" | 10 #include "cc/animation_events.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 return; | 401 return; |
402 m_transform = transform; | 402 m_transform = transform; |
403 setNeedsCommit(); | 403 setNeedsCommit(); |
404 } | 404 } |
405 | 405 |
406 bool Layer::transformIsAnimating() const | 406 bool Layer::transformIsAnimating() const |
407 { | 407 { |
408 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); | 408 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); |
409 } | 409 } |
410 | 410 |
411 void Layer::setScrollPosition(const IntPoint& scrollPosition) | 411 void Layer::setScrollOffset(gfx::Vector2d scrollOffset) |
412 { | 412 { |
413 if (m_scrollPosition == scrollPosition) | 413 if (m_scrollOffset == scrollOffset) |
414 return; | 414 return; |
415 m_scrollPosition = scrollPosition; | 415 m_scrollOffset = scrollOffset; |
416 if (m_layerScrollClient) | 416 if (m_layerScrollClient) |
417 m_layerScrollClient->didScroll(); | 417 m_layerScrollClient->didScroll(); |
418 setNeedsCommit(); | 418 setNeedsCommit(); |
419 } | 419 } |
420 | 420 |
421 void Layer::setMaxScrollPosition(const IntSize& maxScrollPosition) | 421 void Layer::setMaxScrollOffset(gfx::Vector2d maxScrollOffset) |
422 { | 422 { |
423 if (m_maxScrollPosition == maxScrollPosition) | 423 if (m_maxScrollOffset == maxScrollOffset) |
424 return; | 424 return; |
425 m_maxScrollPosition = maxScrollPosition; | 425 m_maxScrollOffset = maxScrollOffset; |
426 setNeedsCommit(); | 426 setNeedsCommit(); |
427 } | 427 } |
428 | 428 |
429 void Layer::setScrollable(bool scrollable) | 429 void Layer::setScrollable(bool scrollable) |
430 { | 430 { |
431 if (m_scrollable == scrollable) | 431 if (m_scrollable == scrollable) |
432 return; | 432 return; |
433 m_scrollable = scrollable; | 433 m_scrollable = scrollable; |
434 setNeedsCommit(); | 434 setNeedsCommit(); |
435 } | 435 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 m_nonFastScrollableRegionChanged = false; | 580 m_nonFastScrollableRegionChanged = false; |
581 } | 581 } |
582 layer->setContentsOpaque(m_contentsOpaque); | 582 layer->setContentsOpaque(m_contentsOpaque); |
583 if (!opacityIsAnimating()) | 583 if (!opacityIsAnimating()) |
584 layer->setOpacity(m_opacity); | 584 layer->setOpacity(m_opacity); |
585 layer->setPosition(m_position); | 585 layer->setPosition(m_position); |
586 layer->setIsContainerForFixedPositionLayers(m_isContainerForFixedPositionLay
ers); | 586 layer->setIsContainerForFixedPositionLayers(m_isContainerForFixedPositionLay
ers); |
587 layer->setFixedToContainerLayer(m_fixedToContainerLayer); | 587 layer->setFixedToContainerLayer(m_fixedToContainerLayer); |
588 layer->setPreserves3D(preserves3D()); | 588 layer->setPreserves3D(preserves3D()); |
589 layer->setUseParentBackfaceVisibility(m_useParentBackfaceVisibility); | 589 layer->setUseParentBackfaceVisibility(m_useParentBackfaceVisibility); |
590 layer->setScrollPosition(m_scrollPosition); | 590 layer->setScrollOffset(m_scrollOffset); |
591 layer->setMaxScrollPosition(m_maxScrollPosition); | 591 layer->setMaxScrollOffset(m_maxScrollOffset); |
592 layer->setSublayerTransform(m_sublayerTransform); | 592 layer->setSublayerTransform(m_sublayerTransform); |
593 if (!transformIsAnimating()) | 593 if (!transformIsAnimating()) |
594 layer->setTransform(m_transform); | 594 layer->setTransform(m_transform); |
595 | 595 |
596 // If the main thread commits multiple times before the impl thread actually
draws, then damage tracking | 596 // If the main thread commits multiple times before the impl thread actually
draws, then damage tracking |
597 // will become incorrect if we simply clobber the updateRect here. The Layer
Impl's updateRect needs to | 597 // will become incorrect if we simply clobber the updateRect here. The Layer
Impl's updateRect needs to |
598 // accumulate (i.e. union) any update changes that have occurred on the main
thread. | 598 // accumulate (i.e. union) any update changes that have occurred on the main
thread. |
599 m_updateRect.Union(layer->updateRect()); | 599 m_updateRect.Union(layer->updateRect()); |
600 layer->setUpdateRect(m_updateRect); | 600 layer->setUpdateRect(m_updateRect); |
601 | 601 |
602 layer->setScrollDelta(layer->scrollDelta() - layer->sentScrollDelta()); | 602 layer->setScrollDelta(layer->scrollDelta() - layer->sentScrollDelta()); |
603 layer->setSentScrollDelta(IntSize()); | 603 layer->setSentScrollDelta(gfx::Vector2d()); |
604 | 604 |
605 layer->setStackingOrderChanged(m_stackingOrderChanged); | 605 layer->setStackingOrderChanged(m_stackingOrderChanged); |
606 | 606 |
607 if (maskLayer()) | 607 if (maskLayer()) |
608 maskLayer()->pushPropertiesTo(layer->maskLayer()); | 608 maskLayer()->pushPropertiesTo(layer->maskLayer()); |
609 if (replicaLayer()) | 609 if (replicaLayer()) |
610 replicaLayer()->pushPropertiesTo(layer->replicaLayer()); | 610 replicaLayer()->pushPropertiesTo(layer->replicaLayer()); |
611 | 611 |
612 m_layerAnimationController->pushAnimationUpdatesTo(layer->layerAnimationCont
roller()); | 612 m_layerAnimationController->pushAnimationUpdatesTo(layer->layerAnimationCont
roller()); |
613 | 613 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 { | 838 { |
839 return 0; | 839 return 0; |
840 } | 840 } |
841 | 841 |
842 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 842 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
843 { | 843 { |
844 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 844 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
845 } | 845 } |
846 | 846 |
847 } | 847 } |
OLD | NEW |