| 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 |
| 119 void LayerChromium::setParent(LayerChromium* layer) | 128 void LayerChromium::setParent(LayerChromium* layer) |
| 120 { | 129 { |
| 121 ASSERT(!layer || !layer->hasAncestor(this)); | 130 ASSERT(!layer || !layer->hasAncestor(this)); |
| 122 m_parent = layer; | 131 m_parent = layer; |
| 123 setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0); | 132 setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0); |
| 124 } | 133 } |
| 125 | 134 |
| 126 bool LayerChromium::hasAncestor(LayerChromium* ancestor) const | 135 bool LayerChromium::hasAncestor(LayerChromium* ancestor) const |
| 127 { | 136 { |
| 128 for (LayerChromium* layer = parent(); layer; layer = layer->parent()) { | 137 for (LayerChromium* layer = parent(); layer; layer = layer->parent()) { |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 { | 624 { |
| 616 if (!needsContentsScale() || m_contentsScale == contentsScale) | 625 if (!needsContentsScale() || m_contentsScale == contentsScale) |
| 617 return; | 626 return; |
| 618 m_contentsScale = contentsScale; | 627 m_contentsScale = contentsScale; |
| 619 | 628 |
| 620 setNeedsDisplay(); | 629 setNeedsDisplay(); |
| 621 } | 630 } |
| 622 | 631 |
| 623 void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) | 632 void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) |
| 624 { | 633 { |
| 634 for (size_t i = 0; i < m_children.size(); ++i) |
| 635 m_children[i]->setBoundsContainPageScale(boundsContainPageScale); |
| 636 |
| 625 if (boundsContainPageScale == m_boundsContainPageScale) | 637 if (boundsContainPageScale == m_boundsContainPageScale) |
| 626 return; | 638 return; |
| 627 | 639 |
| 628 m_boundsContainPageScale = boundsContainPageScale; | 640 m_boundsContainPageScale = boundsContainPageScale; |
| 629 setNeedsDisplay(); | 641 setNeedsDisplay(); |
| 630 } | 642 } |
| 631 | 643 |
| 632 void LayerChromium::createRenderSurface() | 644 void LayerChromium::createRenderSurface() |
| 633 { | 645 { |
| 634 ASSERT(!m_renderSurface); | 646 ASSERT(!m_renderSurface); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 return 0; | 778 return 0; |
| 767 } | 779 } |
| 768 | 780 |
| 769 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*) | 781 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr
omium> >::iterator, void*) |
| 770 { | 782 { |
| 771 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. | 783 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort LayerChromiums. |
| 772 } | 784 } |
| 773 | 785 |
| 774 } | 786 } |
| 775 #endif // USE(ACCELERATED_COMPOSITING) | 787 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |