Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 1158673006: Replace various ScrollableArea scroll methods with setScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Build fix Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/RotationViewportAnchor.cpp ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 { 897 {
898 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 898 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
899 WebPoint clampedPoint = targetPosition; 899 WebPoint clampedPoint = targetPosition;
900 if (!useAnchor) { 900 if (!useAnchor) {
901 clampedPoint = pinchViewport.clampDocumentOffsetAtScale(targetPosition, newScale); 901 clampedPoint = pinchViewport.clampDocumentOffsetAtScale(targetPosition, newScale);
902 if (!durationInSeconds) { 902 if (!durationInSeconds) {
903 setPageScaleFactor(newScale); 903 setPageScaleFactor(newScale);
904 904
905 FrameView* view = mainFrameImpl()->frameView(); 905 FrameView* view = mainFrameImpl()->frameView();
906 if (view && view->scrollableArea()) 906 if (view && view->scrollableArea())
907 view->scrollableArea()->setScrollPosition(DoublePoint(clampedPoi nt.x, clampedPoint.y)); 907 view->scrollableArea()->setScrollPosition(DoublePoint(clampedPoi nt.x, clampedPoint.y), ProgrammaticScroll);
908 908
909 return false; 909 return false;
910 } 910 }
911 } 911 }
912 if (useAnchor && newScale == pageScaleFactor()) 912 if (useAnchor && newScale == pageScaleFactor())
913 return false; 913 return false;
914 914
915 if (m_enableFakePageScaleAnimationForTesting) { 915 if (m_enableFakePageScaleAnimationForTesting) {
916 m_fakePageScaleAnimationTargetPosition = targetPosition; 916 m_fakePageScaleAnimationTargetPosition = targetPosition;
917 m_fakePageScaleAnimationUseAnchor = useAnchor; 917 m_fakePageScaleAnimationUseAnchor = useAnchor;
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 if (!mainFrameImpl()) 3065 if (!mainFrameImpl())
3066 return; 3066 return;
3067 3067
3068 FrameView * view = mainFrameImpl()->frameView(); 3068 FrameView * view = mainFrameImpl()->frameView();
3069 if (!view) 3069 if (!view)
3070 return; 3070 return;
3071 3071
3072 // Order is important: pinch viewport location is clamped based on 3072 // Order is important: pinch viewport location is clamped based on
3073 // main frame scroll position and pinch viewport scale. 3073 // main frame scroll position and pinch viewport scale.
3074 3074
3075 view->setScrollOffset(mainFrameOrigin); 3075 view->setScrollPosition(mainFrameOrigin, ProgrammaticScroll);
3076 3076
3077 setPageScaleFactor(scaleFactor); 3077 setPageScaleFactor(scaleFactor);
3078 3078
3079 page()->frameHost().pinchViewport().setLocation(pinchViewportOrigin); 3079 page()->frameHost().pinchViewport().setLocation(pinchViewportOrigin);
3080 } 3080 }
3081 3081
3082 void WebViewImpl::setPageScaleFactorAndLocation(float scaleFactor, const FloatPo int& location) 3082 void WebViewImpl::setPageScaleFactorAndLocation(float scaleFactor, const FloatPo int& location)
3083 { 3083 {
3084 ASSERT(page()); 3084 ASSERT(page());
3085 3085
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 { 4411 {
4412 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4412 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4413 } 4413 }
4414 4414
4415 void WebViewImpl::forceNextDrawingBufferCreationToFail() 4415 void WebViewImpl::forceNextDrawingBufferCreationToFail()
4416 { 4416 {
4417 DrawingBuffer::forceNextDrawingBufferCreationToFail(); 4417 DrawingBuffer::forceNextDrawingBufferCreationToFail();
4418 } 4418 }
4419 4419
4420 } // namespace blink 4420 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/RotationViewportAnchor.cpp ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698