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

Side by Side Diff: ios/web/web_state/page_viewport_state.mm

Issue 2396553002: [ARC] Converts part of ios/web/ui to ARC.
Patch Set: co Created 4 years, 2 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/web_state/page_viewport_state.h" 5 #import "ios/web/web_state/page_viewport_state.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support."
11 #endif
12
9 namespace { 13 namespace {
10 // Parses a double from |viewport_content|. |viewport_content| is expected to 14 // Parses a double from |viewport_content|. |viewport_content| is expected to
11 // have no leading whitespace. 15 // have no leading whitespace.
12 double ParseDouble(NSString* viewport_content) { 16 double ParseDouble(NSString* viewport_content) {
13 double value = [viewport_content doubleValue]; 17 double value = [viewport_content doubleValue];
14 // |-doubleValue| returns zero when parsing a non-numerical string, so check 18 // |-doubleValue| returns zero when parsing a non-numerical string, so check
15 // that the string actually contains zero to verify that the value was 19 // that the string actually contains zero to verify that the value was
16 // represented in the string. 20 // represented in the string.
17 if (!value && ![viewport_content hasPrefix:@"0"]) 21 if (!value && ![viewport_content hasPrefix:@"0"])
18 value = NAN; 22 value = NAN;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 minimum_zoom_scale_ = ParseDouble(value); 79 minimum_zoom_scale_ = ParseDouble(value);
76 } else if (![name caseInsensitiveCompare:@"maximum-scale"]) { 80 } else if (![name caseInsensitiveCompare:@"maximum-scale"]) {
77 maximum_zoom_scale_ = ParseDouble(value); 81 maximum_zoom_scale_ = ParseDouble(value);
78 } else if (![name caseInsensitiveCompare:@"initial-scale"]) { 82 } else if (![name caseInsensitiveCompare:@"initial-scale"]) {
79 initial_zoom_scale_ = ParseDouble(value); 83 initial_zoom_scale_ = ParseDouble(value);
80 } 84 }
81 } 85 }
82 } 86 }
83 } 87 }
84 88
85 } // namespace web 89 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/js/page_script_util.mm ('k') | ios/web/web_state/ui/crw_generic_content_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698