Title: [276392] trunk/Source/WebKit
- Revision
- 276392
- Author
- [email protected]
- Date
- 2021-04-21 15:00:53 -0700 (Wed, 21 Apr 2021)
Log Message
[iOS][FCR] Update font for group headers in the <select multiple> picker
https://bugs.webkit.org/show_bug.cgi?id=224823
<rdar://problem/76785841>
Reviewed by Wenson Hsieh.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPickerTableViewController tableView:heightForHeaderInSection:]):
The new font's size can varying depending on the user's Dynamic Type
setting. Consequently, the height of the header must now be computed
dynamically.
(-[WKSelectPickerTableViewController tableView:viewForHeaderInSection:]):
(-[WKSelectPickerTableViewController groupHeaderFont]):
Use a font with text style UIFontTextStyleTitle3 and a semibold weight,
matching other system grouped headers. The font is not saved as an
instance variable so that an up-to-date lineHeight can be obtained in
"tableView:heightForHeightInSection:".
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (276391 => 276392)
--- trunk/Source/WebKit/ChangeLog 2021-04-21 21:52:55 UTC (rev 276391)
+++ trunk/Source/WebKit/ChangeLog 2021-04-21 22:00:53 UTC (rev 276392)
@@ -1,3 +1,26 @@
+2021-04-21 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Update font for group headers in the <select multiple> picker
+ https://bugs.webkit.org/show_bug.cgi?id=224823
+ <rdar://problem/76785841>
+
+ Reviewed by Wenson Hsieh.
+
+ * UIProcess/ios/forms/WKFormSelectPicker.mm:
+ (-[WKSelectPickerTableViewController tableView:heightForHeaderInSection:]):
+
+ The new font's size can varying depending on the user's Dynamic Type
+ setting. Consequently, the height of the header must now be computed
+ dynamically.
+
+ (-[WKSelectPickerTableViewController tableView:viewForHeaderInSection:]):
+ (-[WKSelectPickerTableViewController groupHeaderFont]):
+
+ Use a font with text style UIFontTextStyleTitle3 and a semibold weight,
+ matching other system grouped headers. The font is not saved as an
+ instance variable so that an up-to-date lineHeight can be obtained in
+ "tableView:heightForHeightInSection:".
+
2021-04-21 Wenson Hsieh <[email protected]>
[iOS] Text selection in image overlays should not be limited to rectilinear quads
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm (276391 => 276392)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm 2021-04-21 21:52:55 UTC (rev 276391)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm 2021-04-21 22:00:53 UTC (rev 276392)
@@ -733,8 +733,6 @@
static const CGFloat nextPreviousSpacerWidth = 6.0f;
static const CGFloat sectionHeaderCollapseButtonSize = 14.0f;
static const CGFloat sectionHeaderCollapseButtonTransitionDuration = 0.2f;
-static const CGFloat sectionHeaderFontSize = 22.0f;
-static const CGFloat sectionHeaderHeight = 36.0f;
static const CGFloat sectionHeaderMargin = 16.0f;
static const CGFloat selectPopoverLength = 320.0f;
static NSString *optionCellReuseIdentifier = @"WKSelectPickerTableViewCell";
@@ -830,7 +828,7 @@
if (!section)
return tableView.layoutMargins.left;
- return sectionHeaderHeight;
+ return self.groupHeaderFont.lineHeight + sectionHeaderMargin;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
@@ -873,7 +871,8 @@
auto sectionLabel = adoptNS([[UILabel alloc] init]);
[sectionLabel setText:[self tableView:tableView titleForHeaderInSection:section]];
- [sectionLabel setFont:[UIFont boldSystemFontOfSize:sectionHeaderFontSize]];
+ [sectionLabel setFont:self.groupHeaderFont];
+ [sectionLabel setAdjustsFontForContentSizeCategory:YES];
[sectionLabel setAdjustsFontSizeToFitWidth:NO];
[sectionLabel setLineBreakMode:NSLineBreakByTruncatingTail];
[sectionView addSubview:sectionLabel.get()];
@@ -1019,6 +1018,18 @@
option->isSelected = !option->isSelected;
}
+- (UIFont *)groupHeaderFont
+{
+ UIFontDescriptor *descriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleTitle3];
+ descriptor = [descriptor fontDescriptorByAddingAttributes:@{
+ UIFontDescriptorTraitsAttribute: @{
+ UIFontWeightTrait: @(UIFontWeightSemibold)
+ }
+ }];
+
+ return [UIFont fontWithDescriptor:descriptor size:0];
+}
+
- (void)next:(id)sender
{
[self dismissViewControllerAnimated:YES completion:[weakContentView = WeakObjCPtr<WKContentView>(_contentView)] {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes