Commit 87899a86 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Adjust pinnedYOffset value to neareset pixel

This CL makes sure that the value returned by -pinnedYOffset is adjusted
to the nearest pixel. This is because when the content size isn't the
default one, the value isn't adjusted on a pixel. When it is used to
compare to the scroll value of the collection view, this gap prevents
the collection view from being considered as completely scrolled.

Bug: 905276
Change-Id: Ia44de6063b039a022fcde95e015c3e7df4259308
Reviewed-on: https://chromium-review.googlesource.com/c/1337490
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608748}
parent ee1eb7d3
......@@ -113,7 +113,8 @@ CGFloat doodleTopMargin(BOOL toolbarPresent, CGFloat topInset) {
if (!IsCompactWidth() && !IsCompactHeight())
return kDoodleTopMarginRegularXRegular;
return topInset + kDoodleTopMarginOther +
kDoodleScaledTopMarginOther * SystemSuggestedFontSizeMultiplier();
AlignValueToPixel(kDoodleScaledTopMarginOther *
SystemSuggestedFontSizeMultiplier());
}
CGFloat searchFieldTopMargin() {
......
......@@ -26,6 +26,7 @@
#import "ios/chrome/browser/ui/toolbar/toolbar_utils.h"
#import "ios/chrome/browser/ui/url_loader.h"
#import "ios/chrome/browser/ui/util/named_guide.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
......@@ -197,7 +198,7 @@ using base::UserMetricsAction;
[self topInset];
}
return offsetY;
return AlignValueToPixel(offsetY);
}
- (CGFloat)headerHeight {
......
......@@ -12,14 +12,15 @@
CGFloat ToolbarClampedFontSizeMultiplier(UIContentSizeCategory category);
// Returns the height of the toolbar when it is collapsed, based on the current
// |category|.
// |category|, rounded to the nearest lower pixel.
CGFloat ToolbarCollapsedHeight(UIContentSizeCategory category);
// Returns the height of the toolbar when it is expanded, based on the current
// |category|.
// |category|, rounded to the nearest lower pixel.
CGFloat ToolbarExpandedHeight(UIContentSizeCategory category);
// Returns the height of the location bar, based on the |category|.
// Returns the height of the location bar, based on the |category|, rounded to
// the nearest lower pixel.
CGFloat LocationBarHeight(UIContentSizeCategory category);
#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_UTILS_H_
......@@ -62,5 +62,5 @@ CGFloat LocationBarHeight(UIContentSizeCategory category) {
(kLocationBarVerticalMarginDynamicType +
kAdaptiveLocationBarVerticalMargin);
verticalMargin = verticalMargin + dynamicTypeVerticalAdjustment;
return ToolbarExpandedHeight(category) - verticalMargin;
return AlignValueToPixel(ToolbarExpandedHeight(category) - verticalMargin);
}
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