OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u
seAnchor, float newScale, double durationInSeconds) | 957 bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u
seAnchor, float newScale, double durationInSeconds) |
958 { | 958 { |
959 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 959 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
960 WebPoint clampedPoint = targetPosition; | 960 WebPoint clampedPoint = targetPosition; |
961 if (!useAnchor) { | 961 if (!useAnchor) { |
962 clampedPoint = visualViewport.clampDocumentOffsetAtScale(targetPosition,
newScale); | 962 clampedPoint = visualViewport.clampDocumentOffsetAtScale(targetPosition,
newScale); |
963 if (!durationInSeconds) { | 963 if (!durationInSeconds) { |
964 setPageScaleFactor(newScale); | 964 setPageScaleFactor(newScale); |
965 | 965 |
966 FrameView* view = mainFrameImpl()->frameView(); | 966 FrameView* view = mainFrameImpl()->frameView(); |
967 if (view && view->scrollableArea()) | 967 if (view && view->getScrollableArea()) |
968 view->scrollableArea()->setScrollPosition(DoublePoint(clampedPoi
nt.x, clampedPoint.y), ProgrammaticScroll); | 968 view->getScrollableArea()->setScrollPosition(DoublePoint(clamped
Point.x, clampedPoint.y), ProgrammaticScroll); |
969 | 969 |
970 return false; | 970 return false; |
971 } | 971 } |
972 } | 972 } |
973 if (useAnchor && newScale == pageScaleFactor()) | 973 if (useAnchor && newScale == pageScaleFactor()) |
974 return false; | 974 return false; |
975 | 975 |
976 if (m_enableFakePageScaleAnimationForTesting) { | 976 if (m_enableFakePageScaleAnimationForTesting) { |
977 m_fakePageScaleAnimationTargetPosition = targetPosition; | 977 m_fakePageScaleAnimationTargetPosition = targetPosition; |
978 m_fakePageScaleAnimationUseAnchor = useAnchor; | 978 m_fakePageScaleAnimationUseAnchor = useAnchor; |
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4546 if (!m_layerTreeView) | 4546 if (!m_layerTreeView) |
4547 return; | 4547 return; |
4548 | 4548 |
4549 // Otherwise, PaintLayerCompositor is expected to supply a root | 4549 // Otherwise, PaintLayerCompositor is expected to supply a root |
4550 // GraphicsLayer via setRootGraphicsLayer. | 4550 // GraphicsLayer via setRootGraphicsLayer. |
4551 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 4551 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
4552 | 4552 |
4553 // TODO(jbroman): This should probably have hookups for overlays, visual | 4553 // TODO(jbroman): This should probably have hookups for overlays, visual |
4554 // viewport, etc. | 4554 // viewport, etc. |
4555 | 4555 |
4556 WebLayer* rootLayer = m_paintArtifactCompositor.webLayer(); | 4556 WebLayer* rootLayer = m_paintArtifactCompositor.getWebLayer(); |
4557 ASSERT(rootLayer); | 4557 ASSERT(rootLayer); |
4558 m_layerTreeView->setRootLayer(*rootLayer); | 4558 m_layerTreeView->setRootLayer(*rootLayer); |
4559 | 4559 |
4560 // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it | 4560 // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it |
4561 // necessary? | 4561 // necessary? |
4562 m_layerTreeView->setVisible(page()->isPageVisible()); | 4562 m_layerTreeView->setVisible(page()->isPageVisible()); |
4563 } | 4563 } |
4564 | 4564 |
4565 void WebViewImpl::detachPaintArtifactCompositor() | 4565 void WebViewImpl::detachPaintArtifactCompositor() |
4566 { | 4566 { |
4567 if (!m_layerTreeView) | 4567 if (!m_layerTreeView) |
4568 return; | 4568 return; |
4569 | 4569 |
4570 m_layerTreeView->setDeferCommits(true); | 4570 m_layerTreeView->setDeferCommits(true); |
4571 m_layerTreeView->clearRootLayer(); | 4571 m_layerTreeView->clearRootLayer(); |
4572 } | 4572 } |
4573 | 4573 |
4574 float WebViewImpl::deviceScaleFactor() const | 4574 float WebViewImpl::deviceScaleFactor() const |
4575 { | 4575 { |
4576 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4576 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4577 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4577 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4578 if (!page()) | 4578 if (!page()) |
4579 return 1; | 4579 return 1; |
4580 | 4580 |
4581 return page()->deviceScaleFactor(); | 4581 return page()->deviceScaleFactor(); |
4582 } | 4582 } |
4583 | 4583 |
4584 } // namespace blink | 4584 } // namespace blink |
OLD | NEW |