Changeset 248018 in webkit
- Timestamp:
- Jul 30, 2019, 2:48:27 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/Platform.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/css/CSSFontSelector.cpp (modified) (6 diffs)
-
WebCore/page/Quirks.cpp (modified) (1 diff)
-
WebCore/page/Quirks.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r248008 r248018 1 2019-07-30 Myles C. Maxfield <mmaxfield@apple.com> 2 3 REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold 4 https://bugs.webkit.org/show_bug.cgi?id=200065 5 <rdar://problem/50912757> 6 7 Reviewed by Simon Fraser. 8 9 * wtf/Platform.h: 10 1 11 2019-07-30 Michael Catanzaro <mcatanzaro@igalia.com> 2 12 -
trunk/Source/WTF/wtf/Platform.h
r247754 r248018 1617 1617 #define HAVE_DESIGN_SYSTEM_UI_FONTS 1 1618 1618 #endif 1619 1620 #if (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 60000) || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 130000) 1621 #define USE_HIRAGINO_SANS_WORKAROUND 1 1622 #endif -
trunk/Source/WebCore/ChangeLog
r248013 r248018 1 2019-07-30 Myles C. Maxfield <mmaxfield@apple.com> 2 3 REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold 4 https://bugs.webkit.org/show_bug.cgi?id=200065 5 <rdar://problem/50912757> 6 7 Reviewed by Simon Fraser. 8 9 Before r241288, we were mapping Japanese sans-serif to Hiragino Kaku Gothic ProN, which 10 has a 300 weight and a 600 weight. However, we can't use that font because it's user-installed, 11 so in r241288 we switched to using Hiragino Sans, which has a 300 weight, a 600 weight, and an 12 800 weight. According to the CSS font selection algorithm, sites that request a weight of 700 13 would get the 800 weight instead of the 600 weight, which caused the text to look too heavy. 14 Therefore, the apparent visual change is from a weight change from 600 to 800. 15 16 In general, this is working as intended. However, text on Yahoo Japan looks too heavy in weight 17 800. Instead, this patch adds a quirk specific to Yahoo Japan that overwrites any font requests 18 to give them a weight of 600 instead of 700. This way, the lighter font will be used. 19 20 No new tests because quirks cannot be tested. 21 22 * css/CSSFontSelector.cpp: 23 (WebCore::resolveGenericFamily): 24 (WebCore::CSSFontSelector::fontRangesForFamily): 25 * page/Quirks.cpp: 26 (WebCore::Quirks::shouldLightenJapaneseBoldSansSerif const): 27 * page/Quirks.h: 28 1 29 2019-07-30 Michael Catanzaro <mcatanzaro@igalia.com> 2 30 -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r246490 r248018 47 47 #include "FrameLoader.h" 48 48 #include "Logging.h" 49 #include "Quirks.h" 49 50 #include "ResourceLoadObserver.h" 50 51 #include "RuntimeEnabledFeatures.h" … … 275 276 } 276 277 277 static AtomStringresolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomString& familyName)278 static Optional<AtomString> resolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomString& familyName) 278 279 { 279 280 auto platformResult = FontDescription::platformResolveGenericFamily(fontDescription.script(), fontDescription.locale(), familyName); … … 282 283 283 284 if (!document) 284 return familyName;285 return WTF::nullopt; 285 286 286 287 const Settings& settings = document->settings(); … … 302 303 return settings.standardFontFamily(script); 303 304 304 return familyName;305 return WTF::nullopt; 305 306 } 306 307 … … 313 314 bool resolveGenericFamilyFirst = familyName == standardFamily; 314 315 315 AtomString familyForLookup = resolveGenericFamilyFirst ? resolveGenericFamily(m_document.get(), fontDescription, familyName) : familyName; 316 auto* face = m_cssFontFaceSet->fontFace(fontDescription.fontSelectionRequest(), familyForLookup); 316 AtomString familyForLookup = familyName; 317 Optional<FontDescription> overrideFontDescription; 318 const FontDescription* fontDescriptionForLookup = &fontDescription; 319 auto resolveGenericFamily = [&]() { 320 if (auto genericFamilyOptional = WebCore::resolveGenericFamily(m_document.get(), fontDescription, familyName)) { 321 if (m_document && m_document->quirks().shouldLightenJapaneseBoldSansSerif() && familyForLookup == sansSerifFamily && fontDescription.weight() == boldWeightValue() && fontDescription.script() == USCRIPT_KATAKANA_OR_HIRAGANA) { 322 overrideFontDescription = fontDescription; 323 overrideFontDescription->setWeight(FontSelectionValue(600)); 324 fontDescriptionForLookup = &*overrideFontDescription; 325 } 326 familyForLookup = *genericFamilyOptional; 327 } 328 }; 329 330 if (resolveGenericFamilyFirst) 331 resolveGenericFamily(); 332 auto* face = m_cssFontFaceSet->fontFace(fontDescriptionForLookup->fontSelectionRequest(), familyForLookup); 317 333 if (face) { 318 334 if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled()) { … … 320 336 ResourceLoadObserver::shared().logFontLoad(*m_document, familyForLookup.string(), true); 321 337 } 322 return face->fontRanges(fontDescription); 323 } 338 return face->fontRanges(*fontDescriptionForLookup); 339 } 340 324 341 if (!resolveGenericFamilyFirst) 325 familyForLookup = resolveGenericFamily(m_document.get(), fontDescription, familyName);326 auto font = FontCache::singleton().fontForFamily( fontDescription, familyForLookup);342 resolveGenericFamily(); 343 auto font = FontCache::singleton().fontForFamily(*fontDescriptionForLookup, familyForLookup); 327 344 if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled()) { 328 345 if (m_document) -
trunk/Source/WebCore/page/Quirks.cpp
r247879 r248018 386 386 } 387 387 388 bool Quirks::shouldLightenJapaneseBoldSansSerif() const 389 { 390 #if USE(HIRAGINO_SANS_WORKAROUND) 391 if (!needsQuirks()) 392 return false; 393 394 // lang="ja" style="font: bold sans-serif;" content would naturally get HiraginoSans-W8 here, but that's visually 395 // too bold. Instead, we should pick HiraginoSans-W6 instead. 396 // FIXME: webkit.org/b/200047 Remove this quirk. 397 auto host = m_document->topDocument().url().host(); 398 return equalLettersIgnoringASCIICase(host, "m.yahoo.co.jp"); 399 #else 400 return false; 401 #endif 402 } 403 388 404 // FIXME(<rdar://problem/50394969>): Remove after desmos.com adopts inputmode="none". 389 405 bool Quirks::needsInputModeNoneImplicitly(const HTMLElement& element) const -
trunk/Source/WebCore/page/Quirks.h
r247873 r248018 58 58 bool needsInputModeNoneImplicitly(const HTMLElement&) const; 59 59 bool needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommand() const; 60 bool shouldLightenJapaneseBoldSansSerif() const; 60 61 61 62 WEBCORE_EXPORT bool shouldDispatchSyntheticMouseEventsWhenModifyingSelection() const;
Note:
See TracChangeset
for help on using the changeset viewer.