Commit d3bf809a authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Update view on DynamicType changes

This CL marks the WebState's view as dirty when the preferred content
size is changed. It causes the view to be laid out again.
It also changes the way the Overscroll controller is getting its
initialHeaderInset, by asking it to the delegate every time instead of
caching it, as the value become stale after changing the preferred
content size.

Bug: 892145
Change-Id: I2fe0b54a107e0cfed438ea5c57efdbb65fe4c5a3
Reviewed-on: https://chromium-review.googlesource.com/c/1307443
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605645}
parent 5289d592
...@@ -264,7 +264,6 @@ NSString* const kOverscrollActionsDidEnd = @"OverscrollActionsDidStop"; ...@@ -264,7 +264,6 @@ NSString* const kOverscrollActionsDidEnd = @"OverscrollActionsDidStop";
@implementation OverscrollActionsController @implementation OverscrollActionsController
@synthesize overscrollActionView = _overscrollActionView; @synthesize overscrollActionView = _overscrollActionView;
@synthesize initialHeaderInset = _initialHeaderInset;
@synthesize initialHeaderHeight = _initialHeaderHeight; @synthesize initialHeaderHeight = _initialHeaderHeight;
@synthesize overscrollState = _overscrollState; @synthesize overscrollState = _overscrollState;
@synthesize delegate = _delegate; @synthesize delegate = _delegate;
...@@ -876,11 +875,7 @@ NSString* const kOverscrollActionsDidEnd = @"OverscrollActionsDidStop"; ...@@ -876,11 +875,7 @@ NSString* const kOverscrollActionsDidEnd = @"OverscrollActionsDidStop";
} }
- (CGFloat)initialHeaderInset { - (CGFloat)initialHeaderInset {
if (_initialHeaderInset == 0) { return [self.delegate overscrollActionsControllerHeaderInset:self];
_initialHeaderInset =
[[self delegate] overscrollActionsControllerHeaderInset:self];
}
return _initialHeaderInset;
} }
#pragma mark - Bounce dynamic #pragma mark - Bounce dynamic
......
...@@ -111,6 +111,15 @@ ...@@ -111,6 +111,15 @@
#pragma mark Layout #pragma mark Layout
- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if (previousTraitCollection.preferredContentSizeCategory !=
self.traitCollection.preferredContentSizeCategory) {
// In case the preferred content size changes, the layout is dirty.
[self setNeedsLayout];
}
}
- (void)layoutSubviews { - (void)layoutSubviews {
[super layoutSubviews]; [super layoutSubviews];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment