From e3cc7bce01caf52aad5eb6d83787eae8499231b6 Mon Sep 17 00:00:00 2001 From: eugenebut Date: Fri, 25 Mar 2016 14:42:24 -0700 Subject: [ios] Removed PageZoomState::IsLegacyFormat as unneeded. BUG=579697 Review URL: https://codereview.chromium.org/1791443003 Cr-Commit-Position: refs/heads/master@{#383372} --- ios/web/public/web_state/page_display_state.h | 6 ------ ios/web/public/web_state/page_display_state.mm | 8 +------- ios/web/web_state/ui/crw_web_controller.mm | 2 +- ios/web/web_state/ui/crw_wk_web_view_web_controller.mm | 3 --- 4 files changed, 2 insertions(+), 17 deletions(-) (limited to 'ios') diff --git a/ios/web/public/web_state/page_display_state.h b/ios/web/public/web_state/page_display_state.h index 7098e2f..a9e8802 100644 --- a/ios/web/public/web_state/page_display_state.h +++ b/ios/web/public/web_state/page_display_state.h @@ -53,12 +53,6 @@ class PageZoomState { // are NAN and the zoom scale is greater than zero. bool IsValid() const; - // PageScrollStates restored from the legacy serialization format make - // assumptions about the web view's implementation of zooming, and contain a - // non-NAN zoom scale and a NAN minimum and maximum scale. Legacy zoom scales - // can only be applied to CRWUIWebViewWebControllers. - bool IsLegacyFormat() const; - // Returns the allowed zoom scale range for this scroll state. double GetMinMaxZoomDifference() const { return maximum_zoom_scale_ - minimum_zoom_scale_; diff --git a/ios/web/public/web_state/page_display_state.mm b/ios/web/public/web_state/page_display_state.mm index 6837ecb..0c8a9ce 100644 --- a/ios/web/public/web_state/page_display_state.mm +++ b/ios/web/public/web_state/page_display_state.mm @@ -56,18 +56,12 @@ PageZoomState::~PageZoomState() { } bool PageZoomState::IsValid() const { - return IsLegacyFormat() || - (!std::isnan(minimum_zoom_scale_) && + return (!std::isnan(minimum_zoom_scale_) && !std::isnan(maximum_zoom_scale_) && !std::isnan(zoom_scale_) && zoom_scale_ >= minimum_zoom_scale_ && zoom_scale_ <= maximum_zoom_scale_); } -bool PageZoomState::IsLegacyFormat() const { - return std::isnan(minimum_zoom_scale_) && std::isnan(maximum_zoom_scale_) && - zoom_scale_ > 0.0; -} - bool PageZoomState::operator==(const PageZoomState& other) const { return StateValuesAreEqual(minimum_zoom_scale_, other.minimum_zoom_scale_) && StateValuesAreEqual(maximum_zoom_scale_, other.maximum_zoom_scale_) && diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 8739d22..d47b34a 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm @@ -3250,7 +3250,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; _applyingPageState = YES; web::PageZoomState zoomState = currentItem->GetPageDisplayState().zoom_state(); - if (!zoomState.IsValid() || zoomState.IsLegacyFormat()) + if (!zoomState.IsValid()) zoomState = web::PageZoomState(1.0, 1.0, 1.0); [self applyWebViewScrollZoomScaleFromZoomState:zoomState]; _applyingPageState = NO; diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm index e4c28c9..b451ff1 100644 --- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm +++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm @@ -699,9 +699,6 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { // meta tags of a page may have changed since the state was recorded, so clamp // the zoom scale to the current range if necessary. DCHECK(zoomState.IsValid()); - // Legacy-format scroll states cannot be applied to WKWebViews. - if (zoomState.IsLegacyFormat()) - return; CGFloat zoomScale = zoomState.zoom_scale(); if (zoomScale < self.webScrollView.minimumZoomScale) zoomScale = self.webScrollView.minimumZoomScale; -- cgit v1.1