| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 !visualViewport.shouldDisableDesktopWorkarounds() && | 875 !visualViewport.shouldDisableDesktopWorkarounds() && |
| 876 !screencastEnabled) { | 876 !screencastEnabled) { |
| 877 IntRect boundingBox(visualViewport.viewportToRootFrame( | 877 IntRect boundingBox(visualViewport.viewportToRootFrame( |
| 878 IntRect(event.x - event.data.tap.width / 2, | 878 IntRect(event.x - event.data.tap.width / 2, |
| 879 event.y - event.data.tap.height / 2, event.data.tap.width, | 879 event.y - event.data.tap.height / 2, event.data.tap.width, |
| 880 event.data.tap.height))); | 880 event.data.tap.height))); |
| 881 | 881 |
| 882 // TODO(bokan): We shouldn't pass details of the VisualViewport offset | 882 // TODO(bokan): We shouldn't pass details of the VisualViewport offset |
| 883 // to render_view_impl. crbug.com/459591 | 883 // to render_view_impl. crbug.com/459591 |
| 884 WebSize visualViewportOffset = | 884 WebSize visualViewportOffset = |
| 885 flooredIntSize(visualViewport.location()); | 885 flooredIntSize(visualViewport.scrollOffset()); |
| 886 | 886 |
| 887 if (m_webSettings->multiTargetTapNotificationEnabled()) { | 887 if (m_webSettings->multiTargetTapNotificationEnabled()) { |
| 888 Vector<IntRect> goodTargets; | 888 Vector<IntRect> goodTargets; |
| 889 HeapVector<Member<Node>> highlightNodes; | 889 HeapVector<Member<Node>> highlightNodes; |
| 890 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), | 890 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), |
| 891 goodTargets, highlightNodes); | 891 goodTargets, highlightNodes); |
| 892 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? | 892 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? |
| 893 // Single candidate case is currently handled by: | 893 // Single candidate case is currently handled by: |
| 894 // https://bugs.webkit.org/show_bug.cgi?id=85101 | 894 // https://bugs.webkit.org/show_bug.cgi?id=85101 |
| 895 if (goodTargets.size() >= 2 && m_client && | 895 if (goodTargets.size() >= 2 && m_client && |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 double durationInSeconds) { | 1022 double durationInSeconds) { |
| 1023 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 1023 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 1024 WebPoint clampedPoint = targetPosition; | 1024 WebPoint clampedPoint = targetPosition; |
| 1025 if (!useAnchor) { | 1025 if (!useAnchor) { |
| 1026 clampedPoint = | 1026 clampedPoint = |
| 1027 visualViewport.clampDocumentOffsetAtScale(targetPosition, newScale); | 1027 visualViewport.clampDocumentOffsetAtScale(targetPosition, newScale); |
| 1028 if (!durationInSeconds) { | 1028 if (!durationInSeconds) { |
| 1029 setPageScaleFactor(newScale); | 1029 setPageScaleFactor(newScale); |
| 1030 | 1030 |
| 1031 FrameView* view = mainFrameImpl()->frameView(); | 1031 FrameView* view = mainFrameImpl()->frameView(); |
| 1032 if (view && view->getScrollableArea()) | 1032 if (view && view->getScrollableArea()) { |
| 1033 view->getScrollableArea()->setScrollPosition( | 1033 view->getScrollableArea()->setScrollOffset( |
| 1034 DoublePoint(clampedPoint.x, clampedPoint.y), ProgrammaticScroll); | 1034 ScrollOffset(clampedPoint.x, clampedPoint.y), ProgrammaticScroll); |
| 1035 } |
| 1035 | 1036 |
| 1036 return false; | 1037 return false; |
| 1037 } | 1038 } |
| 1038 } | 1039 } |
| 1039 if (useAnchor && newScale == pageScaleFactor()) | 1040 if (useAnchor && newScale == pageScaleFactor()) |
| 1040 return false; | 1041 return false; |
| 1041 | 1042 |
| 1042 if (m_enableFakePageScaleAnimationForTesting) { | 1043 if (m_enableFakePageScaleAnimationForTesting) { |
| 1043 m_fakePageScaleAnimationTargetPosition = targetPosition; | 1044 m_fakePageScaleAnimationTargetPosition = targetPosition; |
| 1044 m_fakePageScaleAnimationUseAnchor = useAnchor; | 1045 m_fakePageScaleAnimationUseAnchor = useAnchor; |
| (...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3384 if (!mainFrameImpl()) | 3385 if (!mainFrameImpl()) |
| 3385 return; | 3386 return; |
| 3386 | 3387 |
| 3387 FrameView* view = mainFrameImpl()->frameView(); | 3388 FrameView* view = mainFrameImpl()->frameView(); |
| 3388 if (!view) | 3389 if (!view) |
| 3389 return; | 3390 return; |
| 3390 | 3391 |
| 3391 // Order is important: visual viewport location is clamped based on | 3392 // Order is important: visual viewport location is clamped based on |
| 3392 // main frame scroll position and visual viewport scale. | 3393 // main frame scroll position and visual viewport scale. |
| 3393 | 3394 |
| 3394 view->setScrollPosition(mainFrameOrigin, ProgrammaticScroll); | 3395 view->setScrollOffset(toScrollOffset(mainFrameOrigin), ProgrammaticScroll); |
| 3395 | 3396 |
| 3396 setPageScaleFactor(scaleFactor); | 3397 setPageScaleFactor(scaleFactor); |
| 3397 | 3398 |
| 3398 page()->frameHost().visualViewport().setLocation(visualViewportOrigin); | 3399 page()->frameHost().visualViewport().setLocation(visualViewportOrigin); |
| 3399 } | 3400 } |
| 3400 | 3401 |
| 3401 void WebViewImpl::setPageScaleFactorAndLocation(float scaleFactor, | 3402 void WebViewImpl::setPageScaleFactorAndLocation(float scaleFactor, |
| 3402 const FloatPoint& location) { | 3403 const FloatPoint& location) { |
| 3403 DCHECK(page()); | 3404 DCHECK(page()); |
| 3404 | 3405 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3696 | 3697 |
| 3697 void WebViewImpl::resetScrollAndScaleState() { | 3698 void WebViewImpl::resetScrollAndScaleState() { |
| 3698 page()->frameHost().visualViewport().reset(); | 3699 page()->frameHost().visualViewport().reset(); |
| 3699 | 3700 |
| 3700 if (!page()->mainFrame()->isLocalFrame()) | 3701 if (!page()->mainFrame()->isLocalFrame()) |
| 3701 return; | 3702 return; |
| 3702 | 3703 |
| 3703 if (FrameView* frameView = toLocalFrame(page()->mainFrame())->view()) { | 3704 if (FrameView* frameView = toLocalFrame(page()->mainFrame())->view()) { |
| 3704 ScrollableArea* scrollableArea = frameView->layoutViewportScrollableArea(); | 3705 ScrollableArea* scrollableArea = frameView->layoutViewportScrollableArea(); |
| 3705 | 3706 |
| 3706 if (scrollableArea->scrollPositionDouble() != DoublePoint::zero()) | 3707 if (!scrollableArea->scrollOffset().isZero()) |
| 3707 scrollableArea->setScrollPosition(DoublePoint::zero(), | 3708 scrollableArea->setScrollOffset(ScrollOffset(), ProgrammaticScroll); |
| 3708 ProgrammaticScroll); | |
| 3709 } | 3709 } |
| 3710 | 3710 |
| 3711 pageScaleConstraintsSet().setNeedsReset(true); | 3711 pageScaleConstraintsSet().setNeedsReset(true); |
| 3712 } | 3712 } |
| 3713 | 3713 |
| 3714 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, | 3714 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, |
| 3715 const WebPoint& location) { | 3715 const WebPoint& location) { |
| 3716 HitTestResult result = hitTestResultForViewportPos(location); | 3716 HitTestResult result = hitTestResultForViewportPos(location); |
| 3717 Node* node = result.innerNode(); | 3717 Node* node = result.innerNode(); |
| 3718 if (!isHTMLVideoElement(*node) && !isHTMLAudioElement(*node)) | 3718 if (!isHTMLVideoElement(*node) && !isHTMLAudioElement(*node)) |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4748 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4748 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4749 return nullptr; | 4749 return nullptr; |
| 4750 return focusedFrame; | 4750 return focusedFrame; |
| 4751 } | 4751 } |
| 4752 | 4752 |
| 4753 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4753 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4754 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4754 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4755 } | 4755 } |
| 4756 | 4756 |
| 4757 } // namespace blink | 4757 } // namespace blink |
| OLD | NEW |