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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "core/html/HTMLInputElement.h" | 64 #include "core/html/HTMLInputElement.h" |
65 #include "core/html/HTMLMediaElement.h" | 65 #include "core/html/HTMLMediaElement.h" |
66 #include "core/html/HTMLPlugInElement.h" | 66 #include "core/html/HTMLPlugInElement.h" |
67 #include "core/html/HTMLTextAreaElement.h" | 67 #include "core/html/HTMLTextAreaElement.h" |
68 #include "core/input/EventHandler.h" | 68 #include "core/input/EventHandler.h" |
69 #include "core/input/TouchActionUtil.h" | 69 #include "core/input/TouchActionUtil.h" |
70 #include "core/layout/LayoutPart.h" | 70 #include "core/layout/LayoutPart.h" |
71 #include "core/layout/TextAutosizer.h" | 71 #include "core/layout/TextAutosizer.h" |
72 #include "core/layout/api/LayoutViewItem.h" | 72 #include "core/layout/api/LayoutViewItem.h" |
73 #include "core/layout/compositing/PaintLayerCompositor.h" | 73 #include "core/layout/compositing/PaintLayerCompositor.h" |
74 #include "core/loader/DocumentLoader.h" | |
75 #include "core/loader/FrameLoadRequest.h" | 74 #include "core/loader/FrameLoadRequest.h" |
76 #include "core/loader/FrameLoader.h" | 75 #include "core/loader/FrameLoader.h" |
77 #include "core/loader/FrameLoaderClient.h" | 76 #include "core/loader/FrameLoaderClient.h" |
78 #include "core/loader/FrameLoaderStateMachine.h" | 77 #include "core/loader/FrameLoaderStateMachine.h" |
79 #include "core/page/ContextMenuController.h" | 78 #include "core/page/ContextMenuController.h" |
80 #include "core/page/ContextMenuProvider.h" | 79 #include "core/page/ContextMenuProvider.h" |
81 #include "core/page/DragController.h" | 80 #include "core/page/DragController.h" |
82 #include "core/page/DragData.h" | 81 #include "core/page/DragData.h" |
83 #include "core/page/DragSession.h" | 82 #include "core/page/DragSession.h" |
84 #include "core/page/FocusController.h" | 83 #include "core/page/FocusController.h" |
(...skipping 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 m_linkHighlightsTimeline = CompositorAnimationTimeline::create(); | 4330 m_linkHighlightsTimeline = CompositorAnimationTimeline::create(); |
4332 attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); | 4331 attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); |
4333 } | 4332 } |
4334 | 4333 |
4335 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 4334 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
4336 attachPaintArtifactCompositor(); | 4335 attachPaintArtifactCompositor(); |
4337 } | 4336 } |
4338 | 4337 |
4339 void WebViewImpl::applyViewportDeltas( | 4338 void WebViewImpl::applyViewportDeltas( |
4340 const WebFloatSize& visualViewportDelta, | 4339 const WebFloatSize& visualViewportDelta, |
4341 const WebFloatSize& layoutViewportDelta, | 4340 // TODO(bokan): This parameter is to be removed but requires adjusting many |
| 4341 // callsites. |
| 4342 const WebFloatSize&, |
4342 const WebFloatSize& elasticOverscrollDelta, | 4343 const WebFloatSize& elasticOverscrollDelta, |
4343 float pageScaleDelta, | 4344 float pageScaleDelta, |
4344 float topControlsShownRatioDelta) | 4345 float topControlsShownRatioDelta) |
4345 { | 4346 { |
4346 if (!mainFrameImpl()) | |
4347 return; | |
4348 FrameView* frameView = mainFrameImpl()->frameView(); | |
4349 if (!frameView) | |
4350 return; | |
4351 | |
4352 ScrollableArea* layoutViewport = frameView->layoutViewportScrollableArea(); | |
4353 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 4347 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
4354 | 4348 |
4355 // Store the desired offsets for visual and layout viewports before setting | 4349 // Store the desired offsets the visual viewport before setting the top |
4356 // the top controls ratio since doing so will change the bounds and move the | 4350 // controls ratio since doing so will change the bounds and move the |
4357 // viewports to keep the offsets valid. The compositor may have already done | 4351 // viewports to keep the offsets valid. The compositor may have already |
4358 // that so we don't want to double apply the deltas here. | 4352 // done that so we don't want to double apply the deltas here. |
4359 FloatPoint visualViewportOffset = visualViewport.visibleRect().location(); | 4353 FloatPoint visualViewportOffset = visualViewport.visibleRect().location(); |
4360 visualViewportOffset.move( | 4354 visualViewportOffset.move( |
4361 visualViewportDelta.width, | 4355 visualViewportDelta.width, |
4362 visualViewportDelta.height); | 4356 visualViewportDelta.height); |
4363 DoublePoint layoutViewportPosition = layoutViewport->scrollPositionDouble() | |
4364 + DoubleSize(layoutViewportDelta.width, layoutViewportDelta.height); | |
4365 | 4357 |
4366 topControls().setShownRatio(topControls().shownRatio() + topControlsShownRat
ioDelta); | 4358 topControls().setShownRatio( |
| 4359 topControls().shownRatio() + topControlsShownRatioDelta); |
4367 | 4360 |
4368 setPageScaleFactorAndLocation(pageScaleFactor() * pageScaleDelta, visualView
portOffset); | 4361 setPageScaleFactorAndLocation( |
| 4362 pageScaleFactor() * pageScaleDelta, |
| 4363 visualViewportOffset); |
4369 | 4364 |
4370 if (pageScaleDelta != 1) { | 4365 if (pageScaleDelta != 1) { |
4371 m_doubleTapZoomPending = false; | 4366 m_doubleTapZoomPending = false; |
4372 visualViewport.userDidChangeScale(); | 4367 visualViewport.userDidChangeScale(); |
4373 } | 4368 } |
4374 | 4369 |
4375 m_elasticOverscroll += elasticOverscrollDelta; | 4370 m_elasticOverscroll += elasticOverscrollDelta; |
4376 frameView->didUpdateElasticOverscroll(); | |
4377 | 4371 |
4378 if (layoutViewport->scrollPositionDouble() != layoutViewportPosition) { | 4372 if (mainFrameImpl() && mainFrameImpl()->frameView()) |
4379 layoutViewport->setScrollPosition(layoutViewportPosition, CompositorScro
ll); | 4373 mainFrameImpl()->frameView()->didUpdateElasticOverscroll(); |
4380 if (DocumentLoader* documentLoader = mainFrameImpl()->frame()->loader().
documentLoader()) | |
4381 documentLoader->initialScrollState().wasScrolledByUser = true; | |
4382 } | |
4383 } | 4374 } |
4384 | 4375 |
4385 void WebViewImpl::updateLayerTreeViewport() | 4376 void WebViewImpl::updateLayerTreeViewport() |
4386 { | 4377 { |
4387 if (!page() || !m_layerTreeView) | 4378 if (!page() || !m_layerTreeView) |
4388 return; | 4379 return; |
4389 | 4380 |
4390 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); | 4381 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); |
4391 } | 4382 } |
4392 | 4383 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4573 { | 4564 { |
4574 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4565 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4575 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4566 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4576 if (!page()) | 4567 if (!page()) |
4577 return 1; | 4568 return 1; |
4578 | 4569 |
4579 return page()->deviceScaleFactor(); | 4570 return page()->deviceScaleFactor(); |
4580 } | 4571 } |
4581 | 4572 |
4582 } // namespace blink | 4573 } // namespace blink |
OLD | NEW |