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

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

Issue 1386693002: Set deceleration rate for WKWebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert accidental change Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/web_view_internal_creation_util.h" 5 #import "ios/web/web_state/web_view_internal_creation_util.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 bool previous_allow_web_view_creation_value = gAllowWebViewCreation; 180 bool previous_allow_web_view_creation_value = gAllowWebViewCreation;
181 gAllowWebViewCreation = true; 181 gAllowWebViewCreation = true;
182 #endif 182 #endif
183 WKWebView* result = 183 WKWebView* result =
184 [[WKWebView alloc] initWithFrame:frame configuration:configuration]; 184 [[WKWebView alloc] initWithFrame:frame configuration:configuration];
185 #if !defined(NDEBUG) 185 #if !defined(NDEBUG)
186 gAllowWebViewCreation = previous_allow_web_view_creation_value; 186 gAllowWebViewCreation = previous_allow_web_view_creation_value;
187 #endif 187 #endif
188 PostWKWebViewCreation(result, browser_state); 188 PostWKWebViewCreation(result, browser_state);
189 189
190 // By default the web view uses a very sluggish scroll speed. Set it to a more
191 // reasonable value.
192 result.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
193
190 return result; 194 return result;
191 } 195 }
192 196
193 NSUInteger GetActiveWKWebViewsCount() { 197 NSUInteger GetActiveWKWebViewsCount() {
194 #if defined(NDEBUG) 198 #if defined(NDEBUG)
195 // This should not be used in release builds. 199 // This should not be used in release builds.
196 CHECK(0); 200 CHECK(0);
197 return 0; 201 return 0;
198 #else 202 #else
199 return GetActiveWKWebViewCounter().Size(); 203 return GetActiveWKWebViewCounter().Size();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if (!gAllowWebViewCreation) { 262 if (!gAllowWebViewCreation) {
259 gWebViewsNeedActiveStateManager = 263 gWebViewsNeedActiveStateManager =
260 GetWebClient()->WebViewsNeedActiveStateManager(); 264 GetWebClient()->WebViewsNeedActiveStateManager();
261 } 265 }
262 }); 266 });
263 return gAllowWebViewCreation; 267 return gAllowWebViewCreation;
264 } 268 }
265 #endif 269 #endif
266 270
267 } // namespace web 271 } // namespace web
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698