| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 | 8 |
| 9 #include "Region.h" | 9 #include "Region.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 444 } |
| 445 | 445 |
| 446 void LayerTreeHost::setVisible(bool visible) | 446 void LayerTreeHost::setVisible(bool visible) |
| 447 { | 447 { |
| 448 if (m_visible == visible) | 448 if (m_visible == visible) |
| 449 return; | 449 return; |
| 450 m_visible = visible; | 450 m_visible = visible; |
| 451 m_proxy->setVisible(visible); | 451 m_proxy->setVisible(visible); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void LayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool
useAnchor, float scale, base::TimeDelta duration) | 454 void LayerTreeHost::startPageScaleAnimation(gfx::Vector2d targetOffset, bool use
Anchor, float scale, base::TimeDelta duration) |
| 455 { | 455 { |
| 456 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, duration)
; | 456 m_proxy->startPageScaleAnimation(targetOffset, useAnchor, scale, duration); |
| 457 } | 457 } |
| 458 | 458 |
| 459 void LayerTreeHost::loseContext(int numTimes) | 459 void LayerTreeHost::loseContext(int numTimes) |
| 460 { | 460 { |
| 461 TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTi
mes); | 461 TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTi
mes); |
| 462 m_numTimesRecreateShouldFail = numTimes - 1; | 462 m_numTimesRecreateShouldFail = numTimes - 1; |
| 463 m_proxy->loseContext(); | 463 m_proxy->loseContext(); |
| 464 } | 464 } |
| 465 | 465 |
| 466 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const | 466 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 687 |
| 688 return needMoreUpdates; | 688 return needMoreUpdates; |
| 689 } | 689 } |
| 690 | 690 |
| 691 void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info) | 691 void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info) |
| 692 { | 692 { |
| 693 if (!m_rootLayer) | 693 if (!m_rootLayer) |
| 694 return; | 694 return; |
| 695 | 695 |
| 696 Layer* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); | 696 Layer* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); |
| 697 IntSize rootScrollDelta; | 697 gfx::Vector2d rootScrollDelta; |
| 698 | 698 |
| 699 for (size_t i = 0; i < info.scrolls.size(); ++i) { | 699 for (size_t i = 0; i < info.scrolls.size(); ++i) { |
| 700 Layer* layer = LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get()
, info.scrolls[i].layerId); | 700 Layer* layer = LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get()
, info.scrolls[i].layerId); |
| 701 if (!layer) | 701 if (!layer) |
| 702 continue; | 702 continue; |
| 703 if (layer == rootScrollLayer) | 703 if (layer == rootScrollLayer) |
| 704 rootScrollDelta += info.scrolls[i].scrollDelta; | 704 rootScrollDelta += info.scrolls[i].scrollDelta; |
| 705 else | 705 else |
| 706 layer->setScrollPosition(layer->scrollPosition() + info.scrolls[i].s
crollDelta); | 706 layer->setScrollOffset(layer->scrollOffset() + info.scrolls[i].scrol
lDelta); |
| 707 } | 707 } |
| 708 if (!rootScrollDelta.isZero() || info.pageScaleDelta != 1) | 708 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) |
| 709 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); | 709 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); |
| 710 } | 710 } |
| 711 | 711 |
| 712 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& point
) | 712 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& point
) |
| 713 const | 713 const |
| 714 { | 714 { |
| 715 WebKit::WebTransformationMatrix inverseImplTransform = m_implTransform; | 715 WebKit::WebTransformationMatrix inverseImplTransform = m_implTransform; |
| 716 // TODO(wjmaclean) Need to determine why the next two lines are | 716 // TODO(wjmaclean) Need to determine why the next two lines are |
| 717 // necessary for this to work ... it seems like just inverting | 717 // necessary for this to work ... it seems like just inverting |
| 718 // m_implTransform should be sufficient. | 718 // m_implTransform should be sufficient. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 else | 833 else |
| 834 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 834 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 835 } | 835 } |
| 836 } | 836 } |
| 837 | 837 |
| 838 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 838 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 839 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 839 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 840 } | 840 } |
| 841 | 841 |
| 842 } // namespace cc | 842 } // namespace cc |
| OLD | NEW |