| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/public/web_state/ui/crw_web_view_content_view.h" | 5 #import "ios/web/public/web_state/ui/crw_web_view_content_view.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 12 namespace { | 16 namespace { |
| 13 | 17 |
| 14 // Background color RGB values for the content view which is displayed when the | 18 // Background color RGB values for the content view which is displayed when the |
| 15 // |_webView| is offset from the screen due to user interaction. Displaying this | 19 // |_webView| is offset from the screen due to user interaction. Displaying this |
| 16 // background color is handled by UIWebView but not WKWebView, so it needs to be | 20 // background color is handled by UIWebView but not WKWebView, so it needs to be |
| 17 // set in CRWWebViewContentView to support both. The color value matches that | 21 // set in CRWWebViewContentView to support both. The color value matches that |
| 18 // used by UIWebView. | 22 // used by UIWebView. |
| 19 const CGFloat kBackgroundRGBComponents[] = {0.75f, 0.74f, 0.76f}; | 23 const CGFloat kBackgroundRGBComponents[] = {0.75f, 0.74f, 0.76f}; |
| 20 | 24 |
| 21 } // namespace | 25 } // namespace |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 | 43 |
| 40 @synthesize shouldUseInsetForTopPadding = _shouldUseInsetForTopPadding; | 44 @synthesize shouldUseInsetForTopPadding = _shouldUseInsetForTopPadding; |
| 41 | 45 |
| 42 - (instancetype)initWithWebView:(UIView*)webView | 46 - (instancetype)initWithWebView:(UIView*)webView |
| 43 scrollView:(UIScrollView*)scrollView { | 47 scrollView:(UIScrollView*)scrollView { |
| 44 self = [super initWithFrame:CGRectZero]; | 48 self = [super initWithFrame:CGRectZero]; |
| 45 if (self) { | 49 if (self) { |
| 46 DCHECK(webView); | 50 DCHECK(webView); |
| 47 DCHECK(scrollView); | 51 DCHECK(scrollView); |
| 48 DCHECK([scrollView isDescendantOfView:webView]); | 52 DCHECK([scrollView isDescendantOfView:webView]); |
| 49 _webView.reset([webView retain]); | 53 _webView.reset(webView); |
| 50 _scrollView.reset([scrollView retain]); | 54 _scrollView.reset(scrollView); |
| 51 } | 55 } |
| 52 return self; | 56 return self; |
| 53 } | 57 } |
| 54 | 58 |
| 55 - (instancetype)initForTesting { | 59 - (instancetype)initForTesting { |
| 56 return [super initWithFrame:CGRectZero]; | 60 return [super initWithFrame:CGRectZero]; |
| 57 } | 61 } |
| 58 | 62 |
| 59 - (instancetype)initWithCoder:(NSCoder*)decoder { | 63 - (instancetype)initWithCoder:(NSCoder*)decoder { |
| 60 NOTREACHED(); | 64 NOTREACHED(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 169 |
| 166 - (void)updateWebViewFrame { | 170 - (void)updateWebViewFrame { |
| 167 CGRect webViewFrame = self.bounds; | 171 CGRect webViewFrame = self.bounds; |
| 168 webViewFrame.size.height -= _topContentPadding; | 172 webViewFrame.size.height -= _topContentPadding; |
| 169 webViewFrame.origin.y += _topContentPadding; | 173 webViewFrame.origin.y += _topContentPadding; |
| 170 | 174 |
| 171 self.webView.frame = webViewFrame; | 175 self.webView.frame = webViewFrame; |
| 172 } | 176 } |
| 173 | 177 |
| 174 @end | 178 @end |
| OLD | NEW |