| 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 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 #include "LayerChromium.h" | 8 #include "LayerChromium.h" |
| 9 | 9 |
| 10 #include "CCActiveAnimation.h" | 10 #include "CCActiveAnimation.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (host && m_layerAnimationController->hasActiveAnimation()) | 109 if (host && m_layerAnimationController->hasActiveAnimation()) |
| 110 host->didAddAnimation(); | 110 host->didAddAnimation(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void LayerChromium::setNeedsCommit() | 113 void LayerChromium::setNeedsCommit() |
| 114 { | 114 { |
| 115 if (m_layerTreeHost) | 115 if (m_layerTreeHost) |
| 116 m_layerTreeHost->setNeedsCommit(); | 116 m_layerTreeHost->setNeedsCommit(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 IntRect LayerChromium::layerRectToContentRect(const WebKit::WebRect& layerRect) | |
| 120 { | |
| 121 float widthScale = static_cast<float>(contentBounds().width()) / bounds().wi
dth(); | |
| 122 float heightScale = static_cast<float>(contentBounds().height()) / bounds().
height(); | |
| 123 FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.h
eight); | |
| 124 contentRect.scale(widthScale, heightScale); | |
| 125 return enclosingIntRect(contentRect); | |
| 126 } | |
| 127 | |
| 128 void LayerChromium::setParent(LayerChromium* layer) | 119 void LayerChromium::setParent(LayerChromium* layer) |
| 129 { | 120 { |
| 130 ASSERT(!layer || !layer->hasAncestor(this)); | 121 ASSERT(!layer || !layer->hasAncestor(this)); |
| 131 m_parent = layer; | 122 m_parent = layer; |
| 132 setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0); | 123 setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0); |
| 133 } | 124 } |
| 134 | 125 |
| 135 bool LayerChromium::hasAncestor(LayerChromium* ancestor) const | 126 bool LayerChromium::hasAncestor(LayerChromium* ancestor) const |
| 136 { | 127 { |
| 137 for (LayerChromium* layer = parent(); layer; layer = layer->parent()) { | 128 for (LayerChromium* layer = parent(); layer; layer = layer->parent()) { |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 { | 615 { |
| 625 if (!needsContentsScale() || m_contentsScale == contentsScale) | 616 if (!needsContentsScale() || m_contentsScale == contentsScale) |
| 626 return; | 617 return; |
| 627 m_contentsScale = contentsScale; | 618 m_contentsScale = contentsScale; |
| 628 | 619 |
| 629 setNeedsDisplay(); | 620 setNeedsDisplay(); |
| 630 } | 621 } |
| 631 | 622 |
| 632 void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) | 623 void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) |
| 633 { | 624 { |
| 634 for (size_t i = 0; i < m_children.size(); ++i) | |
| 635 m_children[i]->setBoundsContainPageScale(boundsContainPageScale); | |
| 636 | |
| 637 if (boundsContainPageScale == m_boundsContainPageScale) | 625 if (boundsContainPageScale == m_boundsContainPageScale) |
| 638 return; | 626 return; |
| 639 | 627 |
| 640 m_boundsContainPageScale = boundsContainPageScale; | 628 m_boundsContainPageScale = boundsContainPageScale; |
| 641 setNeedsDisplay(); | 629 setNeedsDisplay(); |
| 642 } | 630 } |
| 643 | 631 |
| 644 void LayerChromium::createRenderSurface() | 632 void LayerChromium::createRenderSurface() |
| 645 { | 633 { |
| 646 ASSERT(!m_renderSurface); | 634 ASSERT(!m_renderSurface); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 return 0; | 766 return 0; |
| 779 } | 767 } |
| 780 | 768 |
| 781 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*) | 769 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*) |
| 782 { | 770 { |
| 783 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. | 771 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. |
| 784 } | 772 } |
| 785 | 773 |
| 786 } | 774 } |
| 787 #endif // USE(ACCELERATED_COMPOSITING) | 775 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |