| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 , m_editorClientImpl(this) | 360 , m_editorClientImpl(this) |
| 361 , m_inspectorClientImpl(this) | 361 , m_inspectorClientImpl(this) |
| 362 , m_backForwardClientImpl(this) | 362 , m_backForwardClientImpl(this) |
| 363 , m_spellCheckerClientImpl(this) | 363 , m_spellCheckerClientImpl(this) |
| 364 , m_storageClientImpl(this) | 364 , m_storageClientImpl(this) |
| 365 , m_fixedLayoutSizeLock(false) | 365 , m_fixedLayoutSizeLock(false) |
| 366 , m_shouldAutoResize(false) | 366 , m_shouldAutoResize(false) |
| 367 , m_zoomLevel(0) | 367 , m_zoomLevel(0) |
| 368 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 368 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |
| 369 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 369 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
| 370 , m_savedPageScaleFactor(0) | |
| 371 , m_doubleTapZoomPageScaleFactor(0) | 370 , m_doubleTapZoomPageScaleFactor(0) |
| 372 , m_doubleTapZoomPending(false) | 371 , m_doubleTapZoomPending(false) |
| 373 , m_enableFakePageScaleAnimationForTesting(false) | 372 , m_enableFakePageScaleAnimationForTesting(false) |
| 374 , m_fakePageScaleAnimationPageScaleFactor(0) | 373 , m_fakePageScaleAnimationPageScaleFactor(0) |
| 375 , m_fakePageScaleAnimationUseAnchor(false) | 374 , m_fakePageScaleAnimationUseAnchor(false) |
| 376 , m_contextMenuAllowed(false) | 375 , m_contextMenuAllowed(false) |
| 377 , m_doingDragAndDrop(false) | 376 , m_doingDragAndDrop(false) |
| 378 , m_ignoreInputEvents(false) | 377 , m_ignoreInputEvents(false) |
| 379 , m_compositorDeviceScaleFactorOverride(0) | 378 , m_compositorDeviceScaleFactorOverride(0) |
| 380 , m_rootLayerScale(1) | 379 , m_rootLayerScale(1) |
| (...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3034 float WebViewImpl::minimumPageScaleFactor() const | 3033 float WebViewImpl::minimumPageScaleFactor() const |
| 3035 { | 3034 { |
| 3036 return m_pageScaleConstraintsSet.finalConstraints().minimumScale; | 3035 return m_pageScaleConstraintsSet.finalConstraints().minimumScale; |
| 3037 } | 3036 } |
| 3038 | 3037 |
| 3039 float WebViewImpl::maximumPageScaleFactor() const | 3038 float WebViewImpl::maximumPageScaleFactor() const |
| 3040 { | 3039 { |
| 3041 return m_pageScaleConstraintsSet.finalConstraints().maximumScale; | 3040 return m_pageScaleConstraintsSet.finalConstraints().maximumScale; |
| 3042 } | 3041 } |
| 3043 | 3042 |
| 3044 void WebViewImpl::saveScrollAndScaleState() | |
| 3045 { | |
| 3046 m_savedPageScaleFactor = pageScaleFactor(); | |
| 3047 m_savedScrollOffset = mainFrame()->scrollOffset(); | |
| 3048 } | |
| 3049 | |
| 3050 void WebViewImpl::restoreScrollAndScaleState() | |
| 3051 { | |
| 3052 if (!m_savedPageScaleFactor) | |
| 3053 return; | |
| 3054 | |
| 3055 startPageScaleAnimation(IntPoint(m_savedScrollOffset), false, m_savedPageSca
leFactor, scrollAndScaleAnimationDurationInSeconds); | |
| 3056 resetSavedScrollAndScaleState(); | |
| 3057 } | |
| 3058 | |
| 3059 void WebViewImpl::resetSavedScrollAndScaleState() | |
| 3060 { | |
| 3061 m_savedPageScaleFactor = 0; | |
| 3062 m_savedScrollOffset = IntSize(); | |
| 3063 } | |
| 3064 | |
| 3065 void WebViewImpl::resetScrollAndScaleState() | 3043 void WebViewImpl::resetScrollAndScaleState() |
| 3066 { | 3044 { |
| 3067 setPageScaleFactor(1, IntPoint()); | 3045 // TODO: This is done by the pinchViewport().reset() call below and can be r
emoved when |
| 3046 // the new pinch path is the only one. |
| 3047 setPageScaleFactor(1); |
| 3048 updateMainFrameScrollPosition(IntPoint(), true); |
| 3049 page()->frameHost().pinchViewport().reset(); |
| 3068 | 3050 |
| 3069 // Clear out the values for the current history item. This will prevent the
history item from clobbering the | 3051 // Clear out the values for the current history item. This will prevent the
history item from clobbering the |
| 3070 // value determined during page scale initialization, which may be less than
1. | 3052 // value determined during page scale initialization, which may be less than
1. |
| 3071 page()->mainFrame()->loader().clearScrollPositionAndViewState(); | 3053 page()->mainFrame()->loader().clearScrollPositionAndViewState(); |
| 3072 m_pageScaleConstraintsSet.setNeedsReset(true); | 3054 m_pageScaleConstraintsSet.setNeedsReset(true); |
| 3073 | 3055 |
| 3074 // Clobber saved scales and scroll offsets. | 3056 // Clobber saved scales and scroll offsets. |
| 3075 if (FrameView* view = page()->mainFrame()->document()->view()) | 3057 if (FrameView* view = page()->mainFrame()->document()->view()) |
| 3076 view->cacheCurrentScrollPosition(); | 3058 view->cacheCurrentScrollPosition(); |
| 3077 resetSavedScrollAndScaleState(); | |
| 3078 } | 3059 } |
| 3079 | 3060 |
| 3080 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) | 3061 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
| 3081 { | 3062 { |
| 3082 if (!page()) | 3063 if (!page()) |
| 3083 return; | 3064 return; |
| 3084 | 3065 |
| 3085 LocalFrame* frame = page()->mainFrame(); | 3066 LocalFrame* frame = page()->mainFrame(); |
| 3086 if (!frame) | 3067 if (!frame) |
| 3087 return; | 3068 return; |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3582 } | 3563 } |
| 3583 | 3564 |
| 3584 void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag
e) | 3565 void WebViewImpl::didCommitLoad(bool isNewNavigation, bool isNavigationWithinPag
e) |
| 3585 { | 3566 { |
| 3586 if (isNewNavigation && !isNavigationWithinPage) | 3567 if (isNewNavigation && !isNavigationWithinPage) |
| 3587 m_pageScaleConstraintsSet.setNeedsReset(true); | 3568 m_pageScaleConstraintsSet.setNeedsReset(true); |
| 3588 | 3569 |
| 3589 // Make sure link highlight from previous page is cleared. | 3570 // Make sure link highlight from previous page is cleared. |
| 3590 m_linkHighlights.clear(); | 3571 m_linkHighlights.clear(); |
| 3591 endActiveFlingAnimation(); | 3572 endActiveFlingAnimation(); |
| 3592 resetSavedScrollAndScaleState(); | |
| 3593 m_userGestureObserved = false; | 3573 m_userGestureObserved = false; |
| 3594 } | 3574 } |
| 3595 | 3575 |
| 3596 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe) | 3576 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe) |
| 3597 { | 3577 { |
| 3598 if (webframe != mainFrameImpl()) | 3578 if (webframe != mainFrameImpl()) |
| 3599 return; | 3579 return; |
| 3600 | 3580 |
| 3601 // If we get to the <body> tag and we have no pending stylesheet and import
load, we | 3581 // If we get to the <body> tag and we have no pending stylesheet and import
load, we |
| 3602 // can be fairly confident we'll have something sensible to paint soon and | 3582 // can be fairly confident we'll have something sensible to paint soon and |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4124 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4104 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4125 | 4105 |
| 4126 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4106 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4127 return false; | 4107 return false; |
| 4128 | 4108 |
| 4129 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4109 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4130 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4110 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4131 } | 4111 } |
| 4132 | 4112 |
| 4133 } // namespace blink | 4113 } // namespace blink |
| OLD | NEW |