haikuwebkit/PerformanceTests/Layout/system-ui-rebuild-emoji.html

57 lines
1.2 KiB
HTML
Raw Permalink Normal View History

[Cocoa] FontPlatformData objects aren't cached at all when using font-family:system-ui https://bugs.webkit.org/show_bug.cgi?id=196846 <rdar://problem/49499971> Reviewed by Simon Fraser and Darin Adler. PerformanceTests: * Layout/system-ui-rebuild-emoji.html: Added. Source/WebCore: When adding the special codepath for system-ui to behave as an entire list of fonts rather than a single item, I never added a cache for the FontPlatformData objects that codepath creates. The non-system-ui codepath already has a cache in fontPlatformDataCache() in FontCache.cpp. This patch causes a 16.8x performance improvement on the attached benchmark. Test: PerformanceTests/Layout/system-ui-rebuild-emoji.html * page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::invalidateFontCache): * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: (WebCore::FontFamilySpecificationKey::FontFamilySpecificationKey): (WebCore::FontFamilySpecificationKey::operator== const): (WebCore::FontFamilySpecificationKey::operator!= const): (WebCore::FontFamilySpecificationKey::isHashTableDeletedValue const): (WebCore::FontFamilySpecificationKey::computeHash const): (WebCore::FontFamilySpecificationKeyHash::hash): (WebCore::FontFamilySpecificationKeyHash::equal): (WebCore::fontMap): (WebCore::clearFontFamilySpecificationCoreTextCache): (WebCore::FontFamilySpecificationCoreText::fontRanges const): * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): (WebCore::safeCFEqual): Deleted. Source/WTF: * wtf/RetainPtr.h: (WTF::safeCFEqual): (WTF::safeCFHash): Canonical link: https://commits.webkit.org/211214@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-16 00:51:04 +00:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../resources/runner.js"></script>
<style>
#target {
display: none;
}
</style>
<style id="a" media="print">
#target {
display: block;
width: 280px;
}
</style>
<style id="b" media="print">
#target {
display: block;
width: 300px;
}
</style>
<style id="c" media="print">
#target {
display: block;
width: 290px;
}
</style>
</head>
<body>
<pre id="log"></pre>
<div id="target" style="font-family: system-ui;">
<p>😎</p>
</div>
<script>
var target = document.getElementById("target");
var a = document.getElementById("a");
var b = document.getElementById("b");
var c = document.getElementById("c");
function test() {
a.media = "screen";
target.offsetLeft;
b.media = "screen";
target.offsetLeft;
c.media = "screen";
target.offsetLeft;
a.media = "print";
b.media = "print";
c.media = "print";
}
PerfTestRunner.measureRunsPerSecond({ run: test });
</script>
</body>
</html>