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 "cc/layer.h" | 5 #include "cc/layer.h" |
6 | 6 |
7 #include "cc/animation.h" | 7 #include "cc/animation.h" |
8 #include "cc/animation_events.h" | 8 #include "cc/animation_events.h" |
9 #include "cc/layer_animation_controller.h" | 9 #include "cc/layer_animation_controller.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 Layer::Layer() | 28 Layer::Layer() |
29 : m_needsDisplay(false) | 29 : m_needsDisplay(false) |
30 , m_stackingOrderChanged(false) | 30 , m_stackingOrderChanged(false) |
31 , m_layerId(s_nextLayerId++) | 31 , m_layerId(s_nextLayerId++) |
32 , m_ignoreSetNeedsCommit(false) | 32 , m_ignoreSetNeedsCommit(false) |
33 , m_parent(0) | 33 , m_parent(0) |
34 , m_layerTreeHost(0) | 34 , m_layerTreeHost(0) |
35 , m_scrollable(false) | 35 , m_scrollable(false) |
36 , m_shouldScrollOnMainThread(false) | 36 , m_shouldScrollOnMainThread(false) |
37 , m_haveWheelEventHandlers(false) | 37 , m_haveWheelEventHandlers(false) |
38 , m_nonFastScrollableRegionChanged(false) | |
39 , m_touchEventHandlerRegionChanged(false) | |
40 , m_anchorPoint(0.5, 0.5) | 38 , m_anchorPoint(0.5, 0.5) |
41 , m_backgroundColor(0) | 39 , m_backgroundColor(0) |
42 , m_opacity(1.0) | 40 , m_opacity(1.0) |
43 , m_anchorPointZ(0) | 41 , m_anchorPointZ(0) |
44 , m_isContainerForFixedPositionLayers(false) | 42 , m_isContainerForFixedPositionLayers(false) |
45 , m_fixedToContainerLayer(false) | 43 , m_fixedToContainerLayer(false) |
46 , m_isDrawable(false) | 44 , m_isDrawable(false) |
47 , m_masksToBounds(false) | 45 , m_masksToBounds(false) |
48 , m_contentsOpaque(false) | 46 , m_contentsOpaque(false) |
49 , m_doubleSided(true) | 47 , m_doubleSided(true) |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 return; | 469 return; |
472 m_haveWheelEventHandlers = haveWheelEventHandlers; | 470 m_haveWheelEventHandlers = haveWheelEventHandlers; |
473 setNeedsCommit(); | 471 setNeedsCommit(); |
474 } | 472 } |
475 | 473 |
476 void Layer::setNonFastScrollableRegion(const Region& region) | 474 void Layer::setNonFastScrollableRegion(const Region& region) |
477 { | 475 { |
478 if (m_nonFastScrollableRegion == region) | 476 if (m_nonFastScrollableRegion == region) |
479 return; | 477 return; |
480 m_nonFastScrollableRegion = region; | 478 m_nonFastScrollableRegion = region; |
481 m_nonFastScrollableRegionChanged = true; | |
482 setNeedsCommit(); | 479 setNeedsCommit(); |
483 } | 480 } |
484 | 481 |
485 void Layer::setTouchEventHandlerRegion(const Region& region) | 482 void Layer::setTouchEventHandlerRegion(const Region& region) |
486 { | 483 { |
487 if (m_touchEventHandlerRegion == region) | 484 if (m_touchEventHandlerRegion == region) |
488 return; | 485 return; |
489 m_touchEventHandlerRegion = region; | 486 m_touchEventHandlerRegion = region; |
490 m_touchEventHandlerRegionChanged = true; | |
491 } | 487 } |
492 | 488 |
493 void Layer::setDrawCheckerboardForMissingTiles(bool checkerboard) | 489 void Layer::setDrawCheckerboardForMissingTiles(bool checkerboard) |
494 { | 490 { |
495 if (m_drawCheckerboardForMissingTiles == checkerboard) | 491 if (m_drawCheckerboardForMissingTiles == checkerboard) |
496 return; | 492 return; |
497 m_drawCheckerboardForMissingTiles = checkerboard; | 493 m_drawCheckerboardForMissingTiles = checkerboard; |
498 setNeedsCommit(); | 494 setNeedsCommit(); |
499 } | 495 } |
500 | 496 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; | 585 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; |
590 layer->setForceRenderSurface(m_forceRenderSurface); | 586 layer->setForceRenderSurface(m_forceRenderSurface); |
591 layer->setDrawsContent(drawsContent()); | 587 layer->setDrawsContent(drawsContent()); |
592 layer->setFilters(filters()); | 588 layer->setFilters(filters()); |
593 layer->setFilter(filter()); | 589 layer->setFilter(filter()); |
594 layer->setBackgroundFilters(backgroundFilters()); | 590 layer->setBackgroundFilters(backgroundFilters()); |
595 layer->setMasksToBounds(m_masksToBounds); | 591 layer->setMasksToBounds(m_masksToBounds); |
596 layer->setScrollable(m_scrollable); | 592 layer->setScrollable(m_scrollable); |
597 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); | 593 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); |
598 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); | 594 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); |
599 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be | 595 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); |
600 // arbitrarily large depending on page content, so we only push the property
if it's changed. | 596 layer->setTouchEventHandlerRegion(m_touchEventHandlerRegion); |
601 if (m_nonFastScrollableRegionChanged) { | |
602 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); | |
603 m_nonFastScrollableRegionChanged = false; | |
604 } | |
605 if (m_touchEventHandlerRegionChanged) { | |
606 layer->setTouchEventHandlerRegion(m_touchEventHandlerRegion); | |
607 m_touchEventHandlerRegionChanged = false; | |
608 } | |
609 layer->setContentsOpaque(m_contentsOpaque); | 597 layer->setContentsOpaque(m_contentsOpaque); |
610 if (!opacityIsAnimating()) | 598 if (!opacityIsAnimating()) |
611 layer->setOpacity(m_opacity); | 599 layer->setOpacity(m_opacity); |
612 layer->setPosition(m_position); | 600 layer->setPosition(m_position); |
613 layer->setIsContainerForFixedPositionLayers(m_isContainerForFixedPositionLay
ers); | 601 layer->setIsContainerForFixedPositionLayers(m_isContainerForFixedPositionLay
ers); |
614 layer->setFixedToContainerLayer(m_fixedToContainerLayer); | 602 layer->setFixedToContainerLayer(m_fixedToContainerLayer); |
615 layer->setPreserves3D(preserves3D()); | 603 layer->setPreserves3D(preserves3D()); |
616 layer->setUseParentBackfaceVisibility(m_useParentBackfaceVisibility); | 604 layer->setUseParentBackfaceVisibility(m_useParentBackfaceVisibility); |
617 layer->setScrollOffset(m_scrollOffset); | 605 layer->setScrollOffset(m_scrollOffset); |
618 layer->setMaxScrollOffset(m_maxScrollOffset); | 606 layer->setMaxScrollOffset(m_maxScrollOffset); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 { | 849 { |
862 return 0; | 850 return 0; |
863 } | 851 } |
864 | 852 |
865 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 853 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
866 { | 854 { |
867 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 855 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
868 } | 856 } |
869 | 857 |
870 } // namespace cc | 858 } // namespace cc |
OLD | NEW |