Diff
Modified: trunk/LayoutTests/ChangeLog (286253 => 286254)
--- trunk/LayoutTests/ChangeLog 2021-11-29 20:18:44 UTC (rev 286253)
+++ trunk/LayoutTests/ChangeLog 2021-11-29 20:24:55 UTC (rev 286254)
@@ -1,3 +1,14 @@
+2021-11-29 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] REGRESSION(r281291): Text Style fonts don't have the correct weight set
+ https://bugs.webkit.org/show_bug.cgi?id=233070
+
+ Reviewed by Cameron McCormack.
+
+ * platform/ios-14/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt:
+ * platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt:
+ * platform/ios/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt:
+
2021-11-29 Arcady Goldmints-Orlov <agoldmi...@igalia.com>
[GLIB] Update test expectations and baselines. Unreviewed test gardening.
Modified: trunk/LayoutTests/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt (286253 => 286254)
--- trunk/LayoutTests/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt 2021-11-29 20:18:44 UTC (rev 286253)
+++ trunk/LayoutTests/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt 2021-11-29 20:24:55 UTC (rev 286254)
@@ -4,8 +4,8 @@
RenderBlock {HTML} at (0,0) size 800x844
RenderBody {BODY} at (8,8) size 784x820
RenderBlock {H2} at (0,0) size 784x24
- RenderText {#text} at (0,1) size 119x22
- text run at (0,1) width 119: "Normal Weight"
+ RenderText {#text} at (0,1) size 118x22
+ text run at (0,1) width 118: "Normal Weight"
RenderBlock {P} at (0,40) size 784x20
RenderText {#text} at (0,0) size 670x20
text run at (0,0) width 670: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
@@ -40,8 +40,8 @@
RenderText {#text} at (0,0) size 685x20
text run at (0,0) width 685: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,456) size 784x24
- RenderText {#text} at (0,1) size 97x22
- text run at (0,1) width 97: "Bold Weight"
+ RenderText {#text} at (0,1) size 96x22
+ text run at (0,1) width 96: "Bold Weight"
RenderBlock {P} at (0,496) size 784x20
RenderText {#text} at (0,0) size 716x20
text run at (0,0) width 716: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
Modified: trunk/LayoutTests/platform/ios/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt (286253 => 286254)
--- trunk/LayoutTests/platform/ios/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt 2021-11-29 20:18:44 UTC (rev 286253)
+++ trunk/LayoutTests/platform/ios/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt 2021-11-29 20:24:55 UTC (rev 286254)
@@ -4,8 +4,8 @@
RenderBlock {HTML} at (0,0) size 800x844
RenderBody {BODY} at (8,8) size 784x820
RenderBlock {H2} at (0,0) size 784x24
- RenderText {#text} at (0,1) size 119x22
- text run at (0,1) width 119: "Normal Weight"
+ RenderText {#text} at (0,1) size 118x22
+ text run at (0,1) width 118: "Normal Weight"
RenderBlock {P} at (0,40) size 784x20
RenderText {#text} at (0,0) size 670x20
text run at (0,0) width 670: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
@@ -40,8 +40,8 @@
RenderText {#text} at (0,0) size 685x20
text run at (0,0) width 685: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,456) size 784x24
- RenderText {#text} at (0,1) size 97x22
- text run at (0,1) width 97: "Bold Weight"
+ RenderText {#text} at (0,1) size 96x22
+ text run at (0,1) width 96: "Bold Weight"
RenderBlock {P} at (0,496) size 784x20
RenderText {#text} at (0,0) size 716x20
text run at (0,0) width 716: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
Modified: trunk/LayoutTests/platform/ios-14/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt (286253 => 286254)
--- trunk/LayoutTests/platform/ios-14/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt 2021-11-29 20:18:44 UTC (rev 286253)
+++ trunk/LayoutTests/platform/ios-14/platform/ios/ios/fast/text/opticalFontWithWeight-expected.txt 2021-11-29 20:24:55 UTC (rev 286254)
@@ -13,20 +13,20 @@
RenderText {#text} at (0,1) size 90x22
text run at (0,1) width 90: "100 Weight"
RenderBlock {P} at (0,116) size 784x20
- RenderText {#text} at (0,0) size 642x20
- text run at (0,0) width 642: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 647x20
+ text run at (0,0) width 647: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,152) size 784x24
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "200 Weight"
RenderBlock {P} at (0,192) size 784x20
- RenderText {#text} at (0,0) size 648x20
- text run at (0,0) width 648: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 655x20
+ text run at (0,0) width 655: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,228) size 784x24
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "300 Weight"
RenderBlock {P} at (0,268) size 784x20
- RenderText {#text} at (0,0) size 660x20
- text run at (0,0) width 660: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 662x20
+ text run at (0,0) width 662: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,304) size 784x24
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "400 Weight"
@@ -37,8 +37,8 @@
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "500 Weight"
RenderBlock {P} at (0,420) size 784x20
- RenderText {#text} at (0,0) size 687x20
- text run at (0,0) width 687: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 685x20
+ text run at (0,0) width 685: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,456) size 784x24
RenderText {#text} at (0,1) size 96x22
text run at (0,1) width 96: "Bold Weight"
@@ -49,8 +49,8 @@
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "600 Weight"
RenderBlock {P} at (0,572) size 784x20
- RenderText {#text} at (0,0) size 699x20
- text run at (0,0) width 699: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 701x20
+ text run at (0,0) width 701: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,608) size 784x24
RenderText {#text} at (0,1) size 92x22
text run at (0,1) width 92: "700 Weight"
@@ -61,11 +61,11 @@
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "800 Weight"
RenderBlock {P} at (0,724) size 784x20
- RenderText {#text} at (0,0) size 741x20
- text run at (0,0) width 741: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 732x20
+ text run at (0,0) width 732: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
RenderBlock {H2} at (0,760) size 784x24
RenderText {#text} at (0,1) size 93x22
text run at (0,1) width 93: "900 Weight"
RenderBlock {P} at (0,800) size 784x20
- RenderText {#text} at (0,0) size 763x20
- text run at (0,0) width 763: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
+ RenderText {#text} at (0,0) size 747x20
+ text run at (0,0) width 747: "Body Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare ornare mi"
Modified: trunk/Source/WebCore/ChangeLog (286253 => 286254)
--- trunk/Source/WebCore/ChangeLog 2021-11-29 20:18:44 UTC (rev 286253)
+++ trunk/Source/WebCore/ChangeLog 2021-11-29 20:24:55 UTC (rev 286254)
@@ -1,3 +1,20 @@
+2021-11-29 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] REGRESSION(r281291): Text Style fonts don't have the correct weight set
+ https://bugs.webkit.org/show_bug.cgi?id=233070
+
+ Reviewed by Cameron McCormack.
+
+ Text style fonts (like font: -apple-system-body) weren't having their weights detected correctly. When the
+ bold-fonts accessibility setting is enabled, our detection logic was indicating that the fonts weren't
+ bold when they actually were. This patch fixes the detection logic to use kCTFontCSSWeightAttribute
+ instead.
+
+ Test: platform/ios/ios/fast/text/opticalFontWithWeight.html
+
+ * rendering/RenderThemeCocoa.mm:
+ (WebCore::cssWeightOfSystemFont):
+
2021-11-24 Antoine Quint <grao...@webkit.org>
[Model] clean up compile-time flags and condition IDL methods behind them
Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.mm (286253 => 286254)
--- trunk/Source/WebCore/rendering/RenderThemeCocoa.mm 2021-11-29 20:18:44 UTC (rev 286253)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.mm 2021-11-29 20:24:55 UTC (rev 286254)
@@ -284,10 +284,14 @@
static inline FontSelectionValue cssWeightOfSystemFont(CTFontRef font)
{
+ auto resultRef = adoptCF(static_cast<CFNumberRef>(CTFontCopyAttribute(font, kCTFontCSSWeightAttribute)));
+ float result = 0;
+ if (resultRef && CFNumberGetValue(resultRef.get(), kCFNumberFloatType, &result))
+ return FontSelectionValue(result);
+
auto traits = adoptCF(CTFontCopyTraits(font));
- CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontWeightTrait);
- float result = 0;
- CFNumberGetValue(resultRef, kCFNumberFloatType, &result);
+ resultRef = static_cast<CFNumberRef>(CFDictionaryGetValue(traits.get(), kCTFontWeightTrait));
+ CFNumberGetValue(resultRef.get(), kCFNumberFloatType, &result);
// These numbers were experimentally gathered from weights of the system font.
static constexpr float weightThresholds[] = { -0.6, -0.365, -0.115, 0.130, 0.235, 0.350, 0.5, 0.7 };
for (unsigned i = 0; i < WTF_ARRAY_LENGTH(weightThresholds); ++i) {