Commit 8a440a0d authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Change the Articles layout on Accessibility ContentSize

When the user is picking a preferred ContentSize from the
"accessibility" bucket, the layout of the article should be different.

Bug: 893525
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I8686c33ef80775d799e6fbb8752ee4c011798154
Reviewed-on: https://chromium-review.googlesource.com/c/1273147Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598805}
parent 0174bab4
......@@ -29,7 +29,7 @@
// Returns the height needed by a cell contained in |width| and containing the
// listed informations.
+ (CGFloat)heightForWidth:(CGFloat)width
withImage:(BOOL)hasImage
withImageAvailable:(BOOL)hasImage
title:(NSString*)title
publisherName:(NSString*)publisherName
publicationDate:(NSString*)publicationDate;
......
......@@ -93,7 +93,7 @@
- (CGFloat)cellHeightForWidth:(CGFloat)width {
return [self.cellClass heightForWidth:width
withImage:self.hasImage
withImageAvailable:self.hasImage
title:self.title
publisherName:self.publisher
publicationDate:[self relativeDate]];
......
......@@ -248,4 +248,8 @@ UIEdgeInsets SafeAreaInsetsForView(UIView* view);
// more than 99 tabs open.
NSString* TextForTabCount(long count);
// Helper check if |category| is an accessibility category. For iOS 11+ it is a
// wrapper around UIContentSizeCategoryIsAccessibilityCategory.
BOOL ContentSizeCategoryIsAccessibilityCategory(UIContentSizeCategory category);
#endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_
......@@ -679,3 +679,16 @@ NSString* TextForTabCount(long count) {
return @":)";
return [NSString stringWithFormat:@"%ld", count];
}
BOOL ContentSizeCategoryIsAccessibilityCategory(
UIContentSizeCategory category) {
if (@available(iOS 11.0, *)) {
return UIContentSizeCategoryIsAccessibilityCategory(category);
} else {
return category == UIContentSizeCategoryAccessibilityExtraExtraExtraLarge ||
category == UIContentSizeCategoryAccessibilityExtraExtraLarge ||
category == UIContentSizeCategoryAccessibilityExtraLarge ||
category == UIContentSizeCategoryAccessibilityLarge ||
category == UIContentSizeCategoryAccessibilityMedium;
}
}
......@@ -50,7 +50,7 @@
- (CGFloat)cellHeightForWidth:(CGFloat)width {
return [self.cellClass heightForWidth:width
withImage:self.hasImage
withImageAvailable:self.hasImage
title:self.title
publisherName:self.publisher
publicationDate:self.publicationDate];
......
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