Chromium Code Reviews| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 { | 599 { |
| 591 if (!needsContentsScale() || m_contentsScale == contentsScale) | 600 if (!needsContentsScale() || m_contentsScale == contentsScale) |
| 592 return; | 601 return; |
| 593 m_contentsScale = contentsScale; | 602 m_contentsScale = contentsScale; |
| 594 | 603 |
| 595 setNeedsDisplay(); | 604 setNeedsDisplay(); |
| 596 } | 605 } |
| 597 | 606 |
| 598 void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) | 607 void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) |
| 599 { | 608 { |
| 609 for (size_t i = 0; i < m_children.size(); ++i) | |
|
enne (OOO)
2012/09/19 17:08:25
Can you add a comment to the header documenting th
flackr
2012/09/24 17:19:21
Done.
| |
| 610 m_children[i]->setBoundsContainPageScale(boundsContainPageScale); | |
| 611 | |
| 600 if (boundsContainPageScale == m_boundsContainPageScale) | 612 if (boundsContainPageScale == m_boundsContainPageScale) |
| 601 return; | 613 return; |
| 602 | 614 |
| 603 m_boundsContainPageScale = boundsContainPageScale; | 615 m_boundsContainPageScale = boundsContainPageScale; |
| 604 setNeedsDisplay(); | 616 setNeedsDisplay(); |
| 605 } | 617 } |
| 606 | 618 |
| 607 void LayerChromium::createRenderSurface() | 619 void LayerChromium::createRenderSurface() |
| 608 { | 620 { |
| 609 ASSERT(!m_renderSurface); | 621 ASSERT(!m_renderSurface); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 return Region(); | 733 return Region(); |
| 722 } | 734 } |
| 723 | 735 |
| 724 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr omium> >::iterator, void*) | 736 void sortLayers(Vector<RefPtr<LayerChromium> >::iterator, Vector<RefPtr<LayerChr omium> >::iterator, void*) |
| 725 { | 737 { |
| 726 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort LayerChromiums. | 738 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort LayerChromiums. |
| 727 } | 739 } |
| 728 | 740 |
| 729 } | 741 } |
| 730 #endif // USE(ACCELERATED_COMPOSITING) | 742 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |