| 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_impl.h" | 7 #include "cc/layer_tree_host_impl.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 { | 98 { |
| 99 gfx::SizeF scaledViewportSize = m_layoutViewportSize; | 99 gfx::SizeF scaledViewportSize = m_layoutViewportSize; |
| 100 scaledViewportSize = scaledViewportSize.Scale(1 / totalPageScaleFactor()); | 100 scaledViewportSize = scaledViewportSize.Scale(1 / totalPageScaleFactor()); |
| 101 | 101 |
| 102 gfx::RectF bounds(gfx::PointF(), scaledViewportSize); | 102 gfx::RectF bounds(gfx::PointF(), scaledViewportSize); |
| 103 bounds.set_origin(m_pinchViewportScrollDelta); | 103 bounds.set_origin(m_pinchViewportScrollDelta); |
| 104 | 104 |
| 105 return bounds; | 105 return bounds; |
| 106 } | 106 } |
| 107 | 107 |
| 108 FloatSize PinchZoomViewport::applyScroll(FloatSize& delta) | 108 FloatSize PinchZoomViewport::applyScroll(const gfx::Vector2dF& delta) |
| 109 { | 109 { |
| 110 FloatSize overflow; | 110 gfx::Vector2dF overflow; |
| 111 FloatRect pinchedBounds = cc::FloatRect(bounds()); | 111 gfx::RectF pinchedBounds = bounds(); |
| 112 | 112 |
| 113 pinchedBounds.move(delta); | 113 pinchedBounds.Offset(delta); |
| 114 if (pinchedBounds.x() < 0) { | 114 if (pinchedBounds.x() < 0) { |
| 115 overflow.setWidth(pinchedBounds.x()); | 115 overflow.set_x(pinchedBounds.x()); |
| 116 pinchedBounds.setX(0); | 116 pinchedBounds.set_x(0); |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (pinchedBounds.y() < 0) { | 119 if (pinchedBounds.y() < 0) { |
| 120 overflow.setHeight(pinchedBounds.y()); | 120 overflow.set_y(pinchedBounds.y()); |
| 121 pinchedBounds.setY(0); | 121 pinchedBounds.set_y(0); |
| 122 } | 122 } |
| 123 | 123 |
| 124 if (pinchedBounds.maxX() > m_layoutViewportSize.width()) { | 124 if (pinchedBounds.right() > m_layoutViewportSize.width()) { |
| 125 overflow.setWidth( | 125 overflow.set_x(pinchedBounds.right() - m_layoutViewportSize.width()); |
| 126 pinchedBounds.maxX() - m_layoutViewportSize.width()); | 126 pinchedBounds.Offset(m_layoutViewportSize.width() - pinchedBounds.right(
), 0); |
| 127 pinchedBounds.move( | |
| 128 m_layoutViewportSize.width() - pinchedBounds.maxX(), 0); | |
| 129 } | 127 } |
| 130 | 128 |
| 131 if (pinchedBounds.maxY() > m_layoutViewportSize.height()) { | 129 if (pinchedBounds.bottom() > m_layoutViewportSize.height()) { |
| 132 overflow.setHeight( | 130 overflow.set_y(pinchedBounds.bottom() - m_layoutViewportSize.height()); |
| 133 pinchedBounds.maxY() - m_layoutViewportSize.height()); | 131 pinchedBounds.Offset(0, m_layoutViewportSize.height() - pinchedBounds.bo
ttom()); |
| 134 pinchedBounds.move( | |
| 135 0, m_layoutViewportSize.height() - pinchedBounds.maxY()); | |
| 136 } | 132 } |
| 137 m_pinchViewportScrollDelta = pinchedBounds.location(); | 133 m_pinchViewportScrollDelta = cc::FloatPoint(pinchedBounds.origin()); |
| 138 | 134 |
| 139 return overflow; | 135 return cc::FloatSize(overflow); |
| 140 } | 136 } |
| 141 | 137 |
| 142 WebTransformationMatrix PinchZoomViewport::implTransform() const | 138 WebTransformationMatrix PinchZoomViewport::implTransform() const |
| 143 { | 139 { |
| 144 WebTransformationMatrix transform; | 140 WebTransformationMatrix transform; |
| 145 transform.scale(m_pageScaleDelta); | 141 transform.scale(m_pageScaleDelta); |
| 146 | 142 |
| 147 // If the pinch state is applied in the impl, then push it to the | 143 // If the pinch state is applied in the impl, then push it to the |
| 148 // impl transform, otherwise the scale is handled by WebCore. | 144 // impl transform, otherwise the scale is handled by WebCore. |
| 149 if (Settings::pageScalePinchZoomEnabled()) { | 145 if (Settings::pageScalePinchZoomEnabled()) { |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 // Because the contents of the HUD depend on everything else in the frame, t
he contents | 691 // Because the contents of the HUD depend on everything else in the frame, t
he contents |
| 696 // of its texture are updated as the last thing before the frame is drawn. | 692 // of its texture are updated as the last thing before the frame is drawn. |
| 697 if (m_hudLayerImpl) | 693 if (m_hudLayerImpl) |
| 698 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); | 694 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); |
| 699 | 695 |
| 700 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); | 696 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); |
| 701 | 697 |
| 702 // Once a RenderPass has been drawn, its damage should be cleared in | 698 // Once a RenderPass has been drawn, its damage should be cleared in |
| 703 // case the RenderPass will be reused next frame. | 699 // case the RenderPass will be reused next frame. |
| 704 for (unsigned int i = 0; i < frame.renderPasses.size(); i++) | 700 for (unsigned int i = 0; i < frame.renderPasses.size(); i++) |
| 705 frame.renderPasses[i]->setDamageRect(FloatRect()); | 701 frame.renderPasses[i]->setDamageRect(gfx::RectF()); |
| 706 | 702 |
| 707 // The next frame should start by assuming nothing has changed, and changes
are noted as they occur. | 703 // The next frame should start by assuming nothing has changed, and changes
are noted as they occur. |
| 708 for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++) | 704 for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++) |
| 709 (*frame.renderSurfaceLayerList)[i]->renderSurface()->damageTracker()->di
dDrawDamagedArea(); | 705 (*frame.renderSurfaceLayerList)[i]->renderSurface()->damageTracker()->di
dDrawDamagedArea(); |
| 710 m_rootLayerImpl->resetAllChangeTrackingForSubtree(); | 706 m_rootLayerImpl->resetAllChangeTrackingForSubtree(); |
| 711 } | 707 } |
| 712 | 708 |
| 713 void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) | 709 void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) |
| 714 { | 710 { |
| 715 for (size_t i = 0; i < frame.willDrawLayers.size(); ++i) | 711 for (size_t i = 0; i < frame.willDrawLayers.size(); ++i) |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1487 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
| 1492 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1488 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
| 1493 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1489 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
| 1494 m_client->setNeedsRedrawOnImplThread(); | 1490 m_client->setNeedsRedrawOnImplThread(); |
| 1495 | 1491 |
| 1496 for (size_t i = 0; i < layer->children().size(); ++i) | 1492 for (size_t i = 0; i < layer->children().size(); ++i) |
| 1497 animateScrollbarsRecursive(layer->children()[i], time); | 1493 animateScrollbarsRecursive(layer->children()[i], time); |
| 1498 } | 1494 } |
| 1499 | 1495 |
| 1500 } // namespace cc | 1496 } // namespace cc |
| OLD | NEW |