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

Update the toolbar alpha only on frame changes

When the frame of the toolbar changes, the alpha of the buttons is
updated. But the new alpha value is computed with only the y value
of the frame.

So instead of comparing the whole frame to see if it changed, this
CL only compares the y value of the origins.

Bug: 793011
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ie10d2f6d4639edb040999e71794d0b30347cf4be
Reviewed-on: https://chromium-review.googlesource.com/817285
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523112}
parent 17a3319b
...@@ -133,8 +133,8 @@ using ios::material::TimingFunction; ...@@ -133,8 +133,8 @@ using ios::material::TimingFunction;
// If set to |YES|, disables animations that tests would otherwise trigger. // If set to |YES|, disables animations that tests would otherwise trigger.
BOOL _unitTesting; BOOL _unitTesting;
// Keeps track of the last known toolbar frame. // Keeps track of the last known toolbar Y origin.
CGRect _lastKnownToolbarFrame; CGFloat _lastKnownToolbarYOrigin;
// Keeps track of last known trait collection used by the subviews. // Keeps track of last known trait collection used by the subviews.
UITraitCollection* _lastKnownTraitCollection; UITraitCollection* _lastKnownTraitCollection;
...@@ -999,10 +999,10 @@ using ios::material::TimingFunction; ...@@ -999,10 +999,10 @@ using ios::material::TimingFunction;
- (void)toolbarDidLayout { - (void)toolbarDidLayout {
CGRect frame = self.view.frame; CGRect frame = self.view.frame;
if (CGRectEqualToRect(_lastKnownToolbarFrame, frame)) if (frame.origin.y == _lastKnownToolbarYOrigin)
return; return;
[self updateToolbarAlphaForFrame:frame]; [self updateToolbarAlphaForFrame:frame];
_lastKnownToolbarFrame = frame; _lastKnownToolbarYOrigin = frame.origin.y;
} }
- (void)windowDidChange { - (void)windowDidChange {
......
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