Title: [268126] trunk/Source/WebKit
- Revision
- 268126
- Author
- akeer...@apple.com
- Date
- 2020-10-07 08:52:59 -0700 (Wed, 07 Oct 2020)
Log Message
zappos.com: Dropdown - 'Quantity' option size different
https://bugs.webkit.org/show_bug.cgi?id=217395
<rdar://problem/60261396>
Reviewed by Tim Horton.
The select element used in this instance uses a custom font (Open Sans)
with a 16px font size. When presenting the select dropdown a call to
WebPopupMenuProxyMac::showPopupMenu is made with those attributes.
However, since Open Sans is not a system font, the call to
[NSFont fontWithDescriptor:size:] returns nil. This results in the
presented view falling back to the default font size, which is smaller
than the expected 16px size, leading to smaller options.
While other browsers do not honor custom fonts in their select dropdowns,
they do honor the font size. Consequently, this dropdown appears
different in Safari. To fix, ensure that the font size is always honored
if the corresponding attribute is present.
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (268125 => 268126)
--- trunk/Source/WebKit/ChangeLog 2020-10-07 15:48:37 UTC (rev 268125)
+++ trunk/Source/WebKit/ChangeLog 2020-10-07 15:52:59 UTC (rev 268126)
@@ -1,3 +1,27 @@
+2020-10-07 Aditya Keerthi <akeer...@apple.com>
+
+ zappos.com: Dropdown - 'Quantity' option size different
+ https://bugs.webkit.org/show_bug.cgi?id=217395
+ <rdar://problem/60261396>
+
+ Reviewed by Tim Horton.
+
+ The select element used in this instance uses a custom font (Open Sans)
+ with a 16px font size. When presenting the select dropdown a call to
+ WebPopupMenuProxyMac::showPopupMenu is made with those attributes.
+ However, since Open Sans is not a system font, the call to
+ [NSFont fontWithDescriptor:size:] returns nil. This results in the
+ presented view falling back to the default font size, which is smaller
+ than the expected 16px size, leading to smaller options.
+
+ While other browsers do not honor custom fonts in their select dropdowns,
+ they do honor the font size. Consequently, this dropdown appears
+ different in Safari. To fix, ensure that the font size is always honored
+ if the corresponding attribute is present.
+
+ * UIProcess/mac/WebPopupMenuProxyMac.mm:
+ (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+
2020-10-07 Youenn Fablet <you...@apple.com>
Make sure to fire the correct set of events in case MediaRecorder stream has track changes
Modified: trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm (268125 => 268126)
--- trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm 2020-10-07 15:48:37 UTC (rev 268125)
+++ trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm 2020-10-07 15:52:59 UTC (rev 268126)
@@ -106,9 +106,15 @@
BEGIN_BLOCK_OBJC_EXCEPTIONS
- if (NSDictionary *fontAttributes = static_cast<NSDictionary *>(data.fontInfo.fontAttributeDictionary.get()))
- font = fontWithAttributes(fontAttributes, ((pageScaleFactor != 1) ? [fontAttributes[NSFontSizeAttribute] floatValue] * pageScaleFactor : 0));
- else
+ if (NSDictionary *fontAttributes = static_cast<NSDictionary *>(data.fontInfo.fontAttributeDictionary.get())) {
+ auto scaledFontSize = [fontAttributes[NSFontSizeAttribute] floatValue] * pageScaleFactor;
+
+ font = fontWithAttributes(fontAttributes, ((pageScaleFactor != 1) ? scaledFontSize : 0));
+ // font will be nil when using a custom font. However, we should still
+ // honor the font size, matching other browsers.
+ if (!font)
+ font = [NSFont menuFontOfSize:scaledFontSize];
+ } else
font = [NSFont menuFontOfSize:0];
END_BLOCK_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes