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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller_container_view.mm

Issue 1531593002: Adding CRWWebViewContentView as a subview when it is set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years 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 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/web_state/ui/crw_web_controller_container_view.h" 5 #import "ios/web/web_state/ui/crw_web_controller_container_view.h"
6 6
7 #include "base/ios/weak_nsobject.h" 7 #include "base/ios/weak_nsobject.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #import "ios/web/public/web_state/ui/crw_content_view.h" 10 #import "ios/web/public/web_state/ui/crw_content_view.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 #pragma mark Accessors 153 #pragma mark Accessors
154 154
155 - (CRWWebViewContentView*)webViewContentView { 155 - (CRWWebViewContentView*)webViewContentView {
156 return _webViewContentView.get(); 156 return _webViewContentView.get();
157 } 157 }
158 158
159 - (void)setWebViewContentView:(CRWWebViewContentView*)webViewContentView { 159 - (void)setWebViewContentView:(CRWWebViewContentView*)webViewContentView {
160 if (![_webViewContentView isEqual:webViewContentView]) { 160 if (![_webViewContentView isEqual:webViewContentView]) {
161 [_webViewContentView removeFromSuperview]; 161 [_webViewContentView removeFromSuperview];
162 _webViewContentView.reset([webViewContentView retain]); 162 _webViewContentView.reset([webViewContentView retain]);
163 if (_webViewContentView) {
164 DCHECK(![_webViewContentView superview]);
165 [self addSubview:_webViewContentView];
166 }
163 } 167 }
164 } 168 }
165 169
166 - (id<CRWNativeContent>)nativeController { 170 - (id<CRWNativeContent>)nativeController {
167 return _nativeController.get(); 171 return _nativeController.get();
168 } 172 }
169 173
170 - (void)setNativeController:(id<CRWNativeContent>)nativeController { 174 - (void)setNativeController:(id<CRWNativeContent>)nativeController {
171 if (![_nativeController isEqual:nativeController]) { 175 if (![_nativeController isEqual:nativeController]) {
172 base::WeakNSProtocol<id> oldController(_nativeController); 176 base::WeakNSProtocol<id> oldController(_nativeController);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 - (CGRect)visibleFrame { 211 - (CGRect)visibleFrame {
208 CGFloat headerHeight = [_delegate headerHeightForContainerView:self]; 212 CGFloat headerHeight = [_delegate headerHeightForContainerView:self];
209 return UIEdgeInsetsInsetRect(self.bounds, 213 return UIEdgeInsetsInsetRect(self.bounds,
210 UIEdgeInsetsMake(headerHeight, 0, 0, 0)); 214 UIEdgeInsetsMake(headerHeight, 0, 0, 0));
211 } 215 }
212 216
213 #pragma mark Layout 217 #pragma mark Layout
214 218
215 - (void)layoutSubviews { 219 - (void)layoutSubviews {
216 [super layoutSubviews]; 220 [super layoutSubviews];
221
222 [_webViewContentView setFrame:self.bounds];
kkhorimoto 2015/12/16 18:54:17 Can you use property notation for consistency? Th
shreyasv1 2015/12/16 23:02:05 Done.
217 223
218 // webViewcontentView layout. 224 // TODO(crbug.com/570114): Move adding of the following subviews to another
219 if (self.webViewContentView) { 225 // place.
220 if (!self.webViewContentView.superview)
221 [self addSubview:self.webViewContentView];
222 self.webViewContentView.frame = self.bounds;
223 }
224 226
225 // nativeController layout. 227 // nativeController layout.
226 if (self.nativeController) { 228 if (self.nativeController) {
227 UIView* nativeView = [self.nativeController view]; 229 UIView* nativeView = [self.nativeController view];
228 if (!nativeView.superview) { 230 if (!nativeView.superview) {
229 [self addSubview:nativeView]; 231 [self addSubview:nativeView];
230 [nativeView setNeedsUpdateConstraints]; 232 [nativeView setNeedsUpdateConstraints];
231 } 233 }
232 nativeView.frame = self.visibleFrame; 234 nativeView.frame = self.visibleFrame;
233 } 235 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 else 329 else
328 self.toolbarContainerView = nil; 330 self.toolbarContainerView = nil;
329 } 331 }
330 332
331 - (void)removeAllToolbars { 333 - (void)removeAllToolbars {
332 // Resetting the property will remove the toolbars from the hierarchy. 334 // Resetting the property will remove the toolbars from the hierarchy.
333 self.toolbarContainerView = nil; 335 self.toolbarContainerView = nil;
334 } 336 }
335 337
336 @end 338 @end
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