Commit 90d29c2c authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Side loaded fonts should be case insensitive.

This is a source of webkit_layout_test flakiness on Windows.

Bug: 889608
Change-Id: Ib31cd068620d0c1917aaa85ce2ec7038ccd4236e
Reviewed-on: https://chromium-review.googlesource.com/1249385
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594827}
parent 96d488a1
...@@ -4,81 +4,81 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,81 +4,81 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Testing blend mode source-over Testing blend mode source-over
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
FAIL actualColor(4, 4)[1] should be within 5 of 129. Was 255. PASS actualColor(4, 4)[1] is within 5 of 129
PASS actualColor(4, 4)[2] is within 5 of 129 PASS actualColor(4, 4)[2] is within 5 of 129
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode multiply Testing blend mode multiply
PASS actualColor(4, 4)[0] is within 5 of 129 PASS actualColor(4, 4)[0] is within 5 of 129
FAIL actualColor(4, 4)[1] should be within 5 of 129. Was 255. PASS actualColor(4, 4)[1] is within 5 of 129
FAIL actualColor(4, 4)[2] should be within 5 of 65.25882352941176. Was 129. PASS actualColor(4, 4)[2] is within 5 of 65.25882352941176
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode screen Testing blend mode screen
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
FAIL actualColor(4, 4)[2] should be within 5 of 192.74117647058821. Was 129. PASS actualColor(4, 4)[2] is within 5 of 192.74117647058821
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode overlay Testing blend mode overlay
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
PASS actualColor(4, 4)[2] is within 5 of 130.48235294117646 PASS actualColor(4, 4)[2] is within 5 of 130.48235294117646
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode darken Testing blend mode darken
PASS actualColor(4, 4)[0] is within 5 of 129 PASS actualColor(4, 4)[0] is within 5 of 129
FAIL actualColor(4, 4)[1] should be within 5 of 129. Was 255. PASS actualColor(4, 4)[1] is within 5 of 129
PASS actualColor(4, 4)[2] is within 5 of 129 PASS actualColor(4, 4)[2] is within 5 of 129
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode lighten Testing blend mode lighten
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
PASS actualColor(4, 4)[2] is within 5 of 129 PASS actualColor(4, 4)[2] is within 5 of 129
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode color-dodge Testing blend mode color-dodge
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
FAIL actualColor(4, 4)[2] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[2] is within 5 of 255
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode color-burn Testing blend mode color-burn
PASS actualColor(4, 4)[0] is within 5 of 129 PASS actualColor(4, 4)[0] is within 5 of 129
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
FAIL actualColor(4, 4)[2] should be within 5 of 5.930232558139517. Was 129. PASS actualColor(4, 4)[2] is within 5 of 5.930232558139517
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode hard-light Testing blend mode hard-light
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
PASS actualColor(4, 4)[2] is within 5 of 130.48235294117646 PASS actualColor(4, 4)[2] is within 5 of 130.48235294117646
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode soft-light Testing blend mode soft-light
FAIL actualColor(4, 4)[0] should be within 5 of 181.3697880023021. Was 129. PASS actualColor(4, 4)[0] is within 5 of 181.3697880023021
PASS actualColor(4, 4)[1] is within 5 of 255 PASS actualColor(4, 4)[1] is within 5 of 255
PASS actualColor(4, 4)[2] is within 5 of 129.61611515296823 PASS actualColor(4, 4)[2] is within 5 of 129.61611515296823
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode difference Testing blend mode difference
PASS actualColor(4, 4)[0] is within 5 of 126 PASS actualColor(4, 4)[0] is within 5 of 126
FAIL actualColor(4, 4)[1] should be within 5 of 126. Was 255. PASS actualColor(4, 4)[1] is within 5 of 126
FAIL actualColor(4, 4)[2] should be within 5 of 0. Was 129. PASS actualColor(4, 4)[2] is within 5 of 0
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode exclusion Testing blend mode exclusion
PASS actualColor(4, 4)[0] is within 5 of 126 PASS actualColor(4, 4)[0] is within 5 of 126
FAIL actualColor(4, 4)[1] should be within 5 of 126. Was 255. PASS actualColor(4, 4)[1] is within 5 of 126
PASS actualColor(4, 4)[2] is within 5 of 127.48235294117649 PASS actualColor(4, 4)[2] is within 5 of 127.48235294117649
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode hue Testing blend mode hue
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
FAIL actualColor(4, 4)[1] should be within 5 of 181. Was 255. PASS actualColor(4, 4)[1] is within 5 of 181
FAIL actualColor(4, 4)[2] should be within 5 of 181. Was 129. PASS actualColor(4, 4)[2] is within 5 of 181
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode saturation Testing blend mode saturation
...@@ -88,15 +88,15 @@ PASS actualColor(4, 4)[2] is within 5 of 129 ...@@ -88,15 +88,15 @@ PASS actualColor(4, 4)[2] is within 5 of 129
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode color Testing blend mode color
FAIL actualColor(4, 4)[0] should be within 5 of 255. Was 129. PASS actualColor(4, 4)[0] is within 5 of 255
FAIL actualColor(4, 4)[1] should be within 5 of 181. Was 255. PASS actualColor(4, 4)[1] is within 5 of 181
FAIL actualColor(4, 4)[2] should be within 5 of 181. Was 129. PASS actualColor(4, 4)[2] is within 5 of 181
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
Testing blend mode luminosity Testing blend mode luminosity
FAIL actualColor(4, 4)[0] should be within 5 of 92. Was 129. PASS actualColor(4, 4)[0] is within 5 of 92
FAIL actualColor(4, 4)[1] should be within 5 of 218. Was 255. PASS actualColor(4, 4)[1] is within 5 of 218
FAIL actualColor(4, 4)[2] should be within 5 of 92. Was 129. PASS actualColor(4, 4)[2] is within 5 of 92
PASS actualColor(4, 4)[3] is within 5 of 255 PASS actualColor(4, 4)[3] is within 5 of 255
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -312,7 +312,7 @@ class PLATFORM_EXPORT FontCache { ...@@ -312,7 +312,7 @@ class PLATFORM_EXPORT FontCache {
#if defined(OS_WIN) #if defined(OS_WIN)
static bool antialiased_text_enabled_; static bool antialiased_text_enabled_;
static bool lcd_text_enabled_; static bool lcd_text_enabled_;
static HashMap<String, sk_sp<SkTypeface>>* sideloaded_fonts_; static HashMap<String, sk_sp<SkTypeface>, CaseFoldingHash>* sideloaded_fonts_;
// The system font metrics cache. // The system font metrics cache.
static AtomicString* menu_font_family_name_; static AtomicString* menu_font_family_name_;
static int32_t menu_font_height_; static int32_t menu_font_height_;
......
...@@ -262,8 +262,8 @@ sk_sp<SkTypeface> FontCache::CreateTypeface( ...@@ -262,8 +262,8 @@ sk_sp<SkTypeface> FontCache::CreateTypeface(
#if defined(OS_WIN) #if defined(OS_WIN)
// TODO(vmpstr): Deal with paint typeface here. // TODO(vmpstr): Deal with paint typeface here.
if (sideloaded_fonts_) { if (sideloaded_fonts_) {
HashMap<String, sk_sp<SkTypeface>>::iterator sideloaded_font = HashMap<String, sk_sp<SkTypeface>, CaseFoldingHash>::iterator
sideloaded_fonts_->find(name.data()); sideloaded_font = sideloaded_fonts_->find(name.data());
if (sideloaded_font != sideloaded_fonts_->end()) if (sideloaded_font != sideloaded_fonts_->end())
return sideloaded_font->value; return sideloaded_font->value;
} }
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
namespace blink { namespace blink {
HashMap<String, sk_sp<SkTypeface>>* FontCache::sideloaded_fonts_ = nullptr; HashMap<String, sk_sp<SkTypeface>, CaseFoldingHash>*
FontCache::sideloaded_fonts_ = nullptr;
// Cached system font metrics. // Cached system font metrics.
AtomicString* FontCache::menu_font_family_name_ = nullptr; AtomicString* FontCache::menu_font_family_name_ = nullptr;
...@@ -71,10 +72,11 @@ int32_t EnsureMinimumFontHeightIfNeeded(int32_t font_height) { ...@@ -71,10 +72,11 @@ int32_t EnsureMinimumFontHeightIfNeeded(int32_t font_height) {
// static // static
void FontCache::AddSideloadedFontForTesting(sk_sp<SkTypeface> typeface) { void FontCache::AddSideloadedFontForTesting(sk_sp<SkTypeface> typeface) {
if (!sideloaded_fonts_) if (!sideloaded_fonts_)
sideloaded_fonts_ = new HashMap<String, sk_sp<SkTypeface>>; sideloaded_fonts_ = new HashMap<String, sk_sp<SkTypeface>, CaseFoldingHash>;
SkString name; SkString name;
typeface->getFamilyName(&name); typeface->getFamilyName(&name);
sideloaded_fonts_->Set(name.c_str(), std::move(typeface)); String name_wtf(name.c_str());
sideloaded_fonts_->Set(name_wtf, std::move(typeface));
} }
// static // static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment