haikuwebkit/LayoutTests/fast/text/font-style-download-expecte...

7 lines
398 B
Plaintext
Raw Permalink Normal View History

font-weight in @font-face can cause a font to be downloaded even when it's not used https://bugs.webkit.org/show_bug.cgi?id=168114 <rdar://problem/30301317> Reviewed by Darin Adler. Source/WebCore: There were two problems with our font loading code. When we are in the middle of a download, we will use a special interstitial font, and this special font has a flag set which will cause it to be invisible when it is drawn. However, when we start using this font during the load, we give it a unicode-range of U+0-0 which means that it will never be used, and fallback will happen to other weights immediately. The second problem with the font loading code is that this interstital font is just Times. Times doesn't support every character, which means that if we are trying to render some exotic character, we fall back to other weights. The solution here is to use LastResort as the interstitial font, because it supports all characters. Because its metrics are reasonable and we don't ever actually paint this interstitial font, this choice is no worse than Times. Tests: fast/text/font-style-download.html fast/text/font-weight-download-2.html fast/text/font-weight-download.html fast/text/font-weight-fallback.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::font): * css/CSSSegmentedFontFace.cpp: (WebCore::appendFont): (WebCore::CSSSegmentedFontFace::fontRanges): (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Deleted. * platform/graphics/Font.h: (WebCore::Font::widthForGlyph): * platform/graphics/FontCache.h: * platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): * platform/graphics/mac/FontCacheMac.mm: (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): * platform/graphics/win/FontCacheWin.cpp: (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Tools: LastResort needs to be usable in tests. * DumpRenderTree/mac/DumpRenderTree.mm: (allowedFontFamilySet): * WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm: (WTR::allowedFontFamilySet): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::allowedFontFamilySet): LayoutTests: * fast/text/font-style-download-expected.txt: Added. * fast/text/font-style-download.html: Added. * fast/text/font-weight-download-2-expected.txt: Added. * fast/text/font-weight-download-2.html: Added. * fast/text/font-weight-download-expected.txt: Added. * fast/text/font-weight-download.html: Added. * fast/text/font-weight-fallback-expected.html: Added. * fast/text/font-weight-fallback.html: Added. * http/tests/webfont/fallback-font-while-loading-expected.txt: We don't want to use the fallback font while an earlier font is loading because the fallback font might require an extra download. This represents a policy change. * http/tests/webfont/fallback-font-while-loading.html: Ditto. * resources/Ahem_CJK.ttf: Added. * svg/W3C-SVG-1.1-SE/struct-dom-11-f.svg: The metrics of LastResort are different from the metrics of the previous interstitial font, which means the new font causes elements to intersect when they previously didn't. However, the web font isn't actually necessary here, so we can just stop using it, thereby sidestepping the entire problem. Canonical link: https://commits.webkit.org/185506@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 01:28:00 +00:00
font-style-download.html - didFinishLoading
Ahem.ttf - willSendRequest <NSURLRequest URL Ahem.ttf, main document URL font-style-download.html, http method GET> redirectResponse (null)
Ahem.ttf - didReceiveResponse <NSURLResponse Ahem.ttf, http status code 0>
Ahem.ttf - didFinishLoading
This test makes sure that unnecessary fonts aren't downloaded. The test fails if Ahem.otf is downloaded.
Hello