Chromium Code Reviews| Index: ios/web/web_state/ui/crw_web_view_content_view.mm |
| diff --git a/ios/web/web_state/ui/crw_web_view_content_view.mm b/ios/web/web_state/ui/crw_web_view_content_view.mm |
| index 36ff49cbc3c78ce80e4d4072c27ab8bff02b4642..b94fbbc7cf0bd9fd397b1b07e07ea79c03d9cacb 100644 |
| --- a/ios/web/web_state/ui/crw_web_view_content_view.mm |
| +++ b/ios/web/web_state/ui/crw_web_view_content_view.mm |
| @@ -79,17 +79,6 @@ const CGFloat kBackgroundRGBComponents[] = {0.75f, 0.74f, 0.76f}; |
| green:kBackgroundRGBComponents[1] |
| blue:kBackgroundRGBComponents[2] |
| alpha:1.0]; |
| - // The frame needs to be set immediately after the web view is added |
| - // as a subview. The change in the frame triggers drawing operations and |
| - // if not done after it's added as a subview, the web view exhibits |
| - // strange behavior where clicks from certain web sites are not triggered. |
| - // The actual value of the frame doesn't matter as long as it's not |
| - // CGRectZero. The CRWWebViewContentView's frame will be reset to a correct |
| - // value in a subsequent layout pass. |
| - // TODO(crbug.com/577793): This is an undocumented and not-well-understood |
| - // workaround for this issue. |
| - const CGRect kDummyRect = CGRectMake(10, 20, 30, 50); |
| - self.frame = kDummyRect; |
| } |
| } |
| @@ -97,6 +86,20 @@ const CGFloat kBackgroundRGBComponents[] = {0.75f, 0.74f, 0.76f}; |
| return [_webView becomeFirstResponder]; |
| } |
| +- (void)setFrame:(CGRect)frame { |
| + CGSize oldSize = self.frame.size; |
| + [super setFrame:frame]; |
| + if (!CGSizeEqualToSize(oldSize, self.frame.size)) |
|
shreyasv1
2016/02/09 22:58:18
NIT: How about early returning in the method by co
kkhorimoto
2016/02/10 00:08:36
Done.
|
| + [self updateWebViewFrame]; |
| +} |
| + |
| +- (void)setBounds:(CGRect)bounds { |
| + CGSize oldSize = self.bounds.size; |
| + [super setBounds:bounds]; |
| + if (!CGSizeEqualToSize(oldSize, self.bounds.size)) |
| + [self updateWebViewFrame]; |
| +} |
| + |
| #pragma mark Accessors |
| - (UIScrollView*)scrollView { |