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