Import Cobalt 21.lts.4.302899
diff --git a/src/base/third_party/xdg_mime/README.chromium b/src/base/third_party/xdg_mime/README.chromium
index 8212752..8b1b4ed 100644
--- a/src/base/third_party/xdg_mime/README.chromium
+++ b/src/base/third_party/xdg_mime/README.chromium
@@ -12,3 +12,6 @@
xdg_mime_get_mime_type_for_file() - use of pointer after being freed.
- function_casts.patch: fix bad function casts.
- Added a LICENSE file.
+
+Of the dual-licenses, it is licensed under the terms of the Academic Free
+License, version 2.0, in licenses_cobalt.txt.
diff --git a/src/cobalt/base/language.cc b/src/cobalt/base/language.cc
index 819e56a..ed98739 100644
--- a/src/cobalt/base/language.cc
+++ b/src/cobalt/base/language.cc
@@ -62,6 +62,11 @@
if (U_SUCCESS(icu_result) && buffer[0]) {
language += "-";
language += buffer;
+ } else {
+ uloc_addLikelySubtags(NULL, buffer, arraysize(buffer), &icu_result);
+ if (U_SUCCESS(icu_result) && buffer[0]) {
+ return buffer;
+ }
}
// We should end up with something like "en" or "en-Latn".
diff --git a/src/cobalt/browser/application.cc b/src/cobalt/browser/application.cc
index 7d6a781..0a6672e 100644
--- a/src/cobalt/browser/application.cc
+++ b/src/cobalt/browser/application.cc
@@ -563,7 +563,7 @@
version.push_back('\0');
CrashpadAnnotations crashpad_annotations;
- SbMemorySet(&crashpad_annotations, sizeof(CrashpadAnnotations), 0);
+ SbMemorySet(&crashpad_annotations, 0, sizeof(CrashpadAnnotations));
SbStringCopy(crashpad_annotations.user_agent_string, user_agent.c_str(),
USER_AGENT_STRING_MAX_SIZE);
SbStringCopy(crashpad_annotations.product, product.c_str(),
diff --git a/src/cobalt/browser/browser_module.cc b/src/cobalt/browser/browser_module.cc
index 189622c..5591b06 100644
--- a/src/cobalt/browser/browser_module.cc
+++ b/src/cobalt/browser/browser_module.cc
@@ -48,8 +48,10 @@
#include "cobalt/dom/keycode.h"
#include "cobalt/dom/mutation_observer_task_manager.h"
#include "cobalt/dom/window.h"
+#include "cobalt/extension/graphics.h"
#include "cobalt/h5vcc/h5vcc.h"
#include "cobalt/input/input_device_manager_fuzzer.h"
+#include "cobalt/math/matrix3_f.h"
#include "cobalt/overlay_info/overlay_info_registry.h"
#include "nb/memory_scope.h"
#include "starboard/atomic.h"
@@ -1749,6 +1751,22 @@
}
ViewportSize BrowserModule::GetViewportSize() {
+ // If a custom render root transform is used, report the size of the
+ // transformed viewport.
+ math::Matrix3F viewport_transform = math::Matrix3F::Identity();
+ static const CobaltExtensionGraphicsApi* s_graphics_extension =
+ static_cast<const CobaltExtensionGraphicsApi*>(
+ SbSystemGetExtension(kCobaltExtensionGraphicsName));
+ float m00, m01, m02, m10, m11, m12, m20, m21, m22;
+ if (s_graphics_extension &&
+ strcmp(s_graphics_extension->name, kCobaltExtensionGraphicsName) == 0 &&
+ s_graphics_extension->version >= 5 &&
+ s_graphics_extension->GetRenderRootTransform(&m00, &m01, &m02, &m10, &m11,
+ &m12, &m20, &m21, &m22)) {
+ viewport_transform =
+ math::Matrix3F::FromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22);
+ }
+
// We trust the renderer module for width and height the most, if it exists.
if (renderer_module_) {
math::Size target_size = renderer_module_->render_target_size();
@@ -1773,6 +1791,9 @@
options_.requested_viewport_size->device_pixel_ratio();
}
+ target_size =
+ math::RoundOut(viewport_transform.MapRect(math::RectF(target_size)))
+ .size();
ViewportSize v(target_size.width(), target_size.height(), diagonal_inches,
device_pixel_ratio);
return v;
@@ -1781,6 +1802,7 @@
// If the system window exists, that's almost just as good.
if (system_window_) {
math::Size size = system_window_->GetWindowSize();
+ size = math::RoundOut(viewport_transform.MapRect(math::RectF(size))).size();
ViewportSize v(size.width(), size.height(),
system_window_->GetDiagonalSizeInches(),
system_window_->GetDevicePixelRatio());
@@ -1789,7 +1811,14 @@
// Otherwise, we assume we'll get the viewport size that was requested.
if (options_.requested_viewport_size) {
- return *options_.requested_viewport_size;
+ math::Size requested_size =
+ math::RoundOut(viewport_transform.MapRect(math::RectF(
+ options_.requested_viewport_size->width(),
+ options_.requested_viewport_size->height())))
+ .size();
+ return ViewportSize(requested_size.width(), requested_size.height(),
+ options_.requested_viewport_size->diagonal_inches(),
+ options_.requested_viewport_size->device_pixel_ratio());
}
// TODO: Allow platforms to define the default window size and return that
@@ -1797,7 +1826,11 @@
// No window and no viewport size was requested, so we return a conservative
// default.
- ViewportSize view_size(1280, 720);
+ math::Size default_size(1280, 720);
+ default_size =
+ math::RoundOut(viewport_transform.MapRect(math::RectF(default_size)))
+ .size();
+ ViewportSize view_size(default_size.width(), default_size.height());
return view_size;
}
@@ -1896,7 +1929,11 @@
std::map<std::string, std::string> url_param_map;
// If this is the initial startup, use topic within deeplink, if specified.
if (main_web_module_generation_ == 1) {
- GetParamMap(GetInitialDeepLink(), url_param_map);
+ std::string deeplink = GetInitialDeepLink();
+ size_t query_pos = deeplink.find('?');
+ if (query_pos != std::string::npos) {
+ GetParamMap(deeplink.substr(query_pos + 1), url_param_map);
+ }
}
// If this is not the initial startup, there was no deeplink specified, or
// the deeplink did not have a topic, check the current url for a topic.
diff --git a/src/cobalt/browser/web_module.cc b/src/cobalt/browser/web_module.cc
index 5036fd6..7db38cb 100644
--- a/src/cobalt/browser/web_module.cc
+++ b/src/cobalt/browser/web_module.cc
@@ -660,10 +660,7 @@
web_module_stat_tracker_->dom_stat_tracker(), data.initial_url,
data.network_module->GetUserAgent(),
data.network_module->preferred_language(),
- data.options.font_language_script_override.empty()
- ? base::GetSystemLanguageScript()
- : data.options.font_language_script_override,
- data.options.navigation_callback,
+ base::GetSystemLanguageScript(), data.options.navigation_callback,
base::Bind(&WebModule::Impl::OnLoadComplete, base::Unretained(this)),
data.network_module->cookie_jar(), data.network_module->GetPostSender(),
data.options.require_csp, data.options.csp_enforcement_mode,
diff --git a/src/cobalt/browser/web_module.h b/src/cobalt/browser/web_module.h
index 0f340cd..78e0fe7 100644
--- a/src/cobalt/browser/web_module.h
+++ b/src/cobalt/browser/web_module.h
@@ -210,11 +210,6 @@
// the suspend state.
bool should_retain_remote_typeface_cache_on_suspend = false;
- // The language and script to use with fonts. If left empty, then the
- // language-script combination provided by base::GetSystemLanguageScript()
- // is used.
- std::string font_language_script_override;
-
// The splash screen cache object, owned by the BrowserModule.
SplashScreenCache* splash_screen_cache;
diff --git a/src/cobalt/build/build.id b/src/cobalt/build/build.id
index 22d7db0..87efaac 100644
--- a/src/cobalt/build/build.id
+++ b/src/cobalt/build/build.id
@@ -1 +1 @@
-302122
\ No newline at end of file
+302899
\ No newline at end of file
diff --git a/src/cobalt/content/fonts/config/common/fonts.xml b/src/cobalt/content/fonts/config/common/fonts.xml
index 8f84727..abba022 100644
--- a/src/cobalt/content/fonts/config/common/fonts.xml
+++ b/src/cobalt/content/fonts/config/common/fonts.xml
@@ -164,337 +164,337 @@
<!-- "Noto Naskh Arabic UI" is given a fallback priority so that, in spite
of having a name, it will still be included as a fallback font.
-->
- <family fallback_priority="0" name="Noto Naskh Arabic UI" pages="0,6-8,32,37,46,251-254">
+ <family lang="und-Arab" fallback_priority="0" name="Noto Naskh Arabic UI" pages="0,6-8,32,37,46,251-254">
<font weight="400" style="normal">NotoNaskhArabicUI-Regular.woff2</font>
<font weight="700" style="normal">NotoNaskhArabicUI-Bold.woff2</font>
</family>
- <family pages="0,18-19,45,171,254">
+ <family lang="und-Ethi" pages="0,18-19,45,171,254">
<font weight="400" style="normal">NotoSansEthiopic-Regular.woff2</font>
<font weight="700" style="normal">NotoSansEthiopic-Bold.woff2</font>
</family>
- <family pages="0,5,32,37,251,254">
+ <family lang="und-Hebr" pages="0,5,32,37,251,254">
<font weight="400" style="normal">NotoSansHebrew-Regular.woff2</font>
<font weight="700" style="normal">NotoSansHebrew-Bold.woff2</font>
</family>
- <family pages="0,2-3,14,32,37,254">
+ <family lang="und-Thai" pages="0,2-3,14,32,37,254">
<font weight="400" style="normal">NotoSansThaiUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansThaiUI-Bold.woff2</font>
</family>
- <family pages="0,5,32,251">
+ <family lang="und-Armn" pages="0,5,32,251">
<font weight="400" style="normal">NotoSansArmenian-Regular.woff2</font>
<font weight="700" style="normal">NotoSansArmenian-Bold.woff2</font>
</family>
- <family pages="0,5,16,45,254">
+ <family lang="und-Geor,und-Geok" pages="0,5,16,45,254">
<font weight="400" style="normal">NotoSansGeorgian-Regular.woff2</font>
<font weight="700" style="normal">NotoSansGeorgian-Bold.woff2</font>
</family>
- <family pages="0,2,9,28,32,34,37,168,254">
+ <family lang="und-Deva" pages="0,2,9,28,32,34,37,168,254">
<font weight="400" style="normal">NotoSansDevanagariUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansDevanagariUI-Bold.woff2</font>
</family>
<!-- Gujarati should come after Devanagari -->
- <family pages="0,9-10,32,34,37,168,254">
+ <family lang="und-Gujr" pages="0,9-10,32,34,37,168,254">
<font weight="400" style="normal">NotoSansGujaratiUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansGujaratiUI-Bold.woff2</font>
</family>
<!-- Gurmukhi should come after Devanagari -->
- <family pages="0,9-10,32,34,37-38,168,254">
+ <family lang="und-Guru" pages="0,9-10,32,34,37-38,168,254">
<font weight="400" style="normal">NotoSansGurmukhiUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansGurmukhiUI-Bold.woff2</font>
</family>
- <family pages="0,9,11,32,34,37,254">
+ <family lang="und-Taml" pages="0,9,11,32,34,37,254">
<font weight="400" style="normal">NotoSansTamilUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansTamilUI-Bold.woff2</font>
</family>
- <family pages="0,3,9,13,32,34,37,254">
+ <family lang="und-Mlym" pages="0,3,9,13,32,34,37,254">
<font weight="400" style="normal">NotoSansMalayalamUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansMalayalamUI-Bold.woff2</font>
</family>
- <family pages="0,9,32,34,37,254">
+ <family lang="und-Beng" pages="0,9,32,34,37,254">
<font weight="400" style="normal">NotoSansBengaliUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansBengaliUI-Bold.woff2</font>
</family>
- <family pages="0,9,12,32,34,37,254">
+ <family lang="und-Telu" pages="0,9,12,32,34,37,254">
<font weight="400" style="normal">NotoSansTeluguUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansTeluguUI-Bold.woff2</font>
</family>
- <family pages="0,9,12,32,34,37,254">
+ <family lang="und-Knda" pages="0,9,12,32,34,37,254">
<font weight="400" style="normal">NotoSansKannadaUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansKannadaUI-Bold.woff2</font>
</family>
- <family pages="0,9,11,32,34,37,254">
+ <family lang="und-Orya" pages="0,9,11,32,34,37,254">
<font weight="400" style="normal">NotoSansOriyaUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansOriyaUI-Bold.woff2</font>
</family>
- <family pages="0,9,13,32,34,37,254">
+ <family lang="und-Sinh" pages="0,9,13,32,34,37,254">
<font weight="400" style="normal">NotoSansSinhala-Regular.woff2</font>
<font weight="700" style="normal">NotoSansSinhala-Bold.woff2</font>
</family>
- <family pages="0,23,25,32,37">
+ <family lang="und-Khmr" pages="0,23,25,32,37">
<font weight="400" style="normal">NotoSansKhmerUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansKhmerUI-Bold.woff2</font>
</family>
- <family pages="0,3,14,32,37">
+ <family lang="und-Laoo" pages="0,3,14,32,37">
<font weight="400" style="normal">NotoSansLaoUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansLaoUI-Bold.woff2</font>
</family>
- <family pages="0,16,32,37,169-170,254">
+ <family lang="und-Mymr" pages="0,16,32,37,169-170,254">
<font weight="400" style="normal">NotoSansMyanmarUI-Regular.woff2</font>
<font weight="700" style="normal">NotoSansMyanmarUI-Bold.woff2</font>
</family>
- <family pages="0,6-7,32,37,253-254">
+ <family lang="und-Thaa" pages="0,6-7,32,37,253-254">
<font weight="400" style="normal">NotoSansThaana-Regular.woff2</font>
<font weight="700" style="normal">NotoSansThaana-Bold.woff2</font>
</family>
- <family pages="0,3,170">
+ <family lang="und-Cham" pages="0,3,170">
<font weight="400" style="normal">NotoSansCham-Regular.woff2</font>
<font weight="700" style="normal">NotoSansCham-Bold.woff2</font>
</family>
- <family pages="0,6,32,46,489">
+ <family lang="und-Adlm" pages="0,6,32,46,489">
<font weight="400" style="normal">NotoSansAdlam-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,32,46,254,267">
+ <family lang="und-Avst" pages="0,32,46,254,267">
<font weight="400" style="normal">NotoSansAvestan-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,27,32,37,254">
+ <family lang="und-Bali" pages="0,27,32,37,254">
<font weight="400" style="normal">NotoSansBalinese-Regular.woff2</font>
</family>
- <family pages="0,166,254,360-362">
+ <family lang="und-Bamu" pages="0,166,254,360-362">
<font weight="400" style="normal">NotoSansBamum-Regular.woff2</font>
</family>
- <family pages="0,27,254">
+ <family lang="und-Batk" pages="0,27,254">
<font weight="400" style="normal">NotoSansBatak-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,272">
+ <family lang="und-Brah" pages="0,254,272">
<font weight="400" style="normal">NotoSansBrahmi-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,26,32,37,169,254">
+ <family lang="und-Bugi" pages="0,26,32,37,169,254">
<font weight="400" style="normal">NotoSansBuginese-Regular.woff2</font>
</family>
- <family pages="0,23,254">
+ <family lang="und-Buhd" pages="0,23,254">
<font weight="400" style="normal">NotoSansBuhid-Regular.woff2</font>
</family>
- <family pages="0-3,20-22,24,254">
+ <family lang="und-Cans" pages="0-3,20-22,24,254">
<font weight="400" style="normal">NotoSansCanadianAboriginal-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,258">
+ <family lang="und-Cari" pages="0,254,258">
<font weight="400" style="normal">NotoSansCarian-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,3,19,171">
+ <family lang="und-Cher" pages="0,3,19,171">
<font weight="400" style="normal">NotoSansCherokee-Regular.woff2</font>
</family>
- <family pages="0,3,29,37,44,254">
+ <family lang="und-Copt" pages="0,3,29,37,44,254">
<font weight="400" style="normal">NotoSansCoptic-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,288-292">
+ <family lang="und-Xsux" pages="0,254,288-292">
<font weight="400" style="normal">NotoSansCuneiform-Regular.woff2</font>
</family>
- <family pages="0,254,264">
+ <family lang="und-Cprt" pages="0,254,264">
<font weight="400" style="normal">NotoSansCypriot-Regular.woff2</font>
</family>
- <family pages="0,254,260">
+ <family lang="und-Dsrt" pages="0,254,260">
<font weight="400" style="normal">NotoSansDeseret-Regular.woff2</font>
</family>
- <family pages="0,254,304-308">
+ <family lang="und-Egyp" pages="0,254,304-308">
<font weight="400" style="normal">NotoSansEgyptianHieroglyphs-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,44,254">
+ <family lang="und-Glag" pages="0,44,254">
<font weight="400" style="normal">NotoSansGlagolitic-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,3,254,259">
+ <family lang="und-Goth" pages="0,3,254,259">
<font weight="400" style="normal">NotoSansGothic-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,23,254">
+ <family lang="und-Hano" pages="0,23,254">
<font weight="400" style="normal">NotoSansHanunoo-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,264">
+ <family lang="und-Armi" pages="0,254,264">
<font weight="400" style="normal">NotoSansImperialAramaic-Regular.woff2</font>
</family>
- <family pages="0,254,267">
+ <family lang="und-Phli" pages="0,254,267">
<font weight="400" style="normal">NotoSansInscriptionalPahlavi-Regular.woff2</font>
</family>
- <family pages="0,254,267">
+ <family lang="und-Prti" pages="0,254,267">
<font weight="400" style="normal">NotoSansInscriptionalParthian-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,32,37,169,254">
+ <family lang="und-Java" pages="0,32,37,169,254">
<font weight="400" style="normal">NotoSansJavanese-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,9,168,254,272">
+ <family lang="und-Kthi" pages="0,9,168,254,272">
<font weight="400" style="normal">NotoSansKaithi-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,169,254">
+ <family lang="und-Kali" pages="0,169,254">
<font weight="400" style="normal">NotoSansKayahLi-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,266">
+ <family lang="und-Khar" pages="0,254,266">
<font weight="400" style="normal">NotoSansKharoshthi-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,28,37,254">
+ <family lang="und-Lepc" pages="0,28,37,254">
<font weight="400" style="normal">NotoSansLepcha-Regular.woff2</font>
</family>
- <family pages="0,9,25,254">
+ <family lang="und-Limb" pages="0,9,25,254">
<font weight="400" style="normal">NotoSansLimbu-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,256-257">
+ <family lang="und-Linb" pages="0,254,256-257">
<font weight="400" style="normal">NotoSansLinearB-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,2,164,254">
+ <family lang="und-Lisu" pages="0,2,164,254">
<font weight="400" style="normal">NotoSansLisu-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,258">
+ <family lang="und-Lyci" pages="0,254,258">
<font weight="400" style="normal">NotoSansLycian-Regular.woff2</font>
</family>
- <family pages="0,254,265">
+ <family lang="und-Lydi" pages="0,254,265">
<font weight="400" style="normal">NotoSansLydian-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,6,8,254">
+ <family lang="und-Mand" pages="0,6,8,254">
<font weight="400" style="normal">NotoSansMandaic-Regular.woff2</font>
</family>
- <family pages="0,170-171,254">
+ <family lang="und-Mtei" pages="0,170-171,254">
<font weight="400" style="normal">NotoSansMeeteiMayek-Regular.woff2</font>
</family>
- <family pages="0,25,254">
+ <family lang="und-Talu" pages="0,25,254">
<font weight="400" style="normal">NotoSansNewTaiLue-Regular.woff2</font>
</family>
- <family pages="0,6-7,32,46,253-254">
+ <family lang="und-Nkoo" pages="0,6-7,32,46,253-254">
<font weight="400" style="normal">NotoSansNKo-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,22,254">
+ <family lang="und-Ogam" pages="0,22,254">
<font weight="400" style="normal">NotoSansOgham-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,28,254">
+ <family lang="und-Olck" pages="0,28,254">
<font weight="400" style="normal">NotoSansOlChiki-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,259">
+ <family lang="und-Ital" pages="0,254,259">
<font weight="400" style="normal">NotoSansOldItalic-Regular.woff2</font>
</family>
- <family pages="0,254,259">
+ <family lang="und-Xpeo" pages="0,254,259">
<font weight="400" style="normal">NotoSansOldPersian-Regular.woff2</font>
</family>
- <family pages="0,254,266">
+ <family lang="und-Sarb" pages="0,254,266">
<font weight="400" style="normal">NotoSansOldSouthArabian-Regular.woff2</font>
</family>
- <family pages="0,254,268">
+ <family lang="und-Orkh" pages="0,254,268">
<font weight="400" style="normal">NotoSansOldTurkic-Regular.woff2</font>
</family>
- <family pages="0,254,260">
+ <family lang="und-Osma" pages="0,254,260">
<font weight="400" style="normal">NotoSansOsmanya-Regular.woff2</font>
</family>
- <family pages="0,254,265">
+ <family lang="und-Phnx" pages="0,254,265">
<font weight="400" style="normal">NotoSansPhoenician-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,169,254">
+ <family lang="und-Rjng" pages="0,169,254">
<font weight="400" style="normal">NotoSansRejang-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,22,254">
+ <family lang="und-Runr" pages="0,22,254">
<font weight="400" style="normal">NotoSansRunic-Regular.woff2</font>
</family>
- <family pages="0,8,46,254">
+ <family lang="und-Samr" pages="0,8,46,254">
<font weight="400" style="normal">NotoSansSamaritan-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,32,37,168,254">
+ <family lang="und-Saur" pages="0,32,37,168,254">
<font weight="400" style="normal">NotoSansSaurashtra-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,254,260">
+ <family lang="und-Shaw" pages="0,254,260">
<font weight="400" style="normal">NotoSansShavian-Regular.woff2</font>
</family>
</package>
<package name="fallback-lang-non-cjk">
- <family pages="0,27-28,254">
+ <family lang="und-Sund" pages="0,27-28,254">
<font weight="400" style="normal">NotoSansSundanese-Regular.woff2</font>
</family>
- <family pages="0,9,32,37,168,254">
+ <family lang="und-Sylo" pages="0,9,32,37,168,254">
<font weight="400" style="normal">NotoSansSylotiNagri-Regular.woff2</font>
</family>
<!-- Estrangela should precede Eastern and Western Syriac, since it's our default form. -->
- <family pages="0,3,6-7,32,34,37-38,254">
+ <family lang="und-Syre" pages="0,3,6-7,32,34,37-38,254">
<font weight="400" style="normal">NotoSansSyriacEstrangela-Regular.woff2</font>
</family>
- <family pages="0,3,6-7,32,34,37-38,254">
+ <family lang="und-Syrn" pages="0,3,6-7,32,34,37-38,254">
<font weight="400" style="normal">NotoSansSyriacEastern-Regular.woff2</font>
</family>
- <family pages="0,3,6-7,32,34,37-38,254">
+ <family lang="und-Syrj" pages="0,3,6-7,32,34,37-38,254">
<font weight="400" style="normal">NotoSansSyriacWestern-Regular.woff2</font>
</family>
- <family pages="0,23,254">
+ <family lang="und-Tglg" pages="0,23,254">
<font weight="400" style="normal">NotoSansTagalog-Regular.woff2</font>
</family>
- <family pages="0,23,254">
+ <family lang="und-Tagb" pages="0,23,254">
<font weight="400" style="normal">NotoSansTagbanwa-Regular.woff2</font>
</family>
- <family pages="0,26,32,34,37,254">
+ <family lang="und-Lana" pages="0,26,32,34,37,254">
<font weight="400" style="normal">NotoSansTaiTham-Regular.woff2</font>
</family>
- <family pages="0,32,37,167,170,254">
+ <family lang="und-Tavt" pages="0,32,37,167,170,254">
<font weight="400" style="normal">NotoSansTaiViet-Regular.woff2</font>
</family>
- <family pages="0,15,32,37,254">
+ <family lang="und-Tibt" pages="0,15,32,37,254">
<font weight="400" style="normal">NotoSansTibetan-Regular.woff2</font>
<font weight="700" style="normal">NotoSansTibetan-Bold.woff2</font>
</family>
- <family pages="0,3,32,45,254">
+ <family lang="und-Tfng" pages="0,3,32,45,254">
<font weight="400" style="normal">NotoSansTifinagh-Regular.woff2</font>
</family>
</package>
- <package name="fallback-historic">
+ <package lang="und-Ugar" name="fallback-historic">
<family pages="0,254,259">
<font weight="400" style="normal">NotoSansUgaritic-Regular.woff2</font>
</family>
</package>
- <package name="fallback-lang-non-cjk">
+ <package lang="und-Vaii" name="fallback-lang-non-cjk">
<family pages="0,165-166,254">
<font weight="400" style="normal">NotoSansVai-Regular.woff2</font>
</family>
@@ -519,7 +519,7 @@
</family>
</package>
<package name="fallback-color-emoji">
- <family pages="0,32-33,35-39,41,43,48,50,496-502,505,3584,4068,4072">
+ <family lang="und-Zsye" pages="0,32-33,35-39,41,43,48,50,496-502,505,3584,4068,4072">
<font weight="400" style="normal" disable_synthetic_bolding="true">NotoColorEmoji.woff2</font>
</family>
</package>
@@ -529,7 +529,7 @@
</family>
</package>
<package name="fallback-symbols">
- <family pages="35,37-39,43,496-498">
+ <family lang="und-Zsym" pages="35,37-39,43,496-498">
<font weight="400" style="normal">NotoSansSymbols-Regular-Subsetted2.woff2</font>
</family>
</package>
@@ -548,18 +548,18 @@
Tai Le, Yi, Mongolian, and Phags-pa are intentionally kept last, to make sure they don't
override the East Asian punctuation for Chinese.
-->
- <family pages="0,3,16,25,48,254">
+ <family lang="und-Tale" pages="0,3,16,25,48,254">
<font weight="400" style="normal">NotoSansTaiLe-Regular.woff2</font>
</family>
- <family pages="0,48,160-164,254-255">
+ <family lang="und-Yiii" pages="0,48,160-164,254-255">
<font weight="400" style="normal">NotoSansYi-Regular.woff2</font>
</family>
- <family pages="0,24,32,36-37,48,254">
+ <family lang="und-Mong" pages="0,24,32,36-37,48,254">
<font weight="400" style="normal">NotoSansMongolian-Regular.woff2</font>
</family>
</package>
<package name="fallback-historic">
- <family pages="0,24,32,37,48,168,254">
+ <family lang="und-Phag" pages="0,24,32,37,48,168,254">
<font weight="400" style="normal">NotoSansPhagsPa-Regular.woff2</font>
</family>
</package>
diff --git a/src/cobalt/content/licenses/platform/android/licenses_cobalt.txt b/src/cobalt/content/licenses/platform/android/licenses_cobalt.txt
index e431145..ef96d48 100644
--- a/src/cobalt/content/licenses/platform/android/licenses_cobalt.txt
+++ b/src/cobalt/content/licenses/platform/android/licenses_cobalt.txt
@@ -850,205 +850,6 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- xdg_mime
-
-
- Licensed under the Academic Free License version 2.0 (below)
- Or under the following terms:
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-
- --------------------------------------------------------------------------------
- Academic Free License v. 2.0
- --------------------------------------------------------------------------------
-
- This Academic Free License (the "License") applies to any original work of
- authorship (the "Original Work") whose owner (the "Licensor") has placed the
- following notice immediately following the copyright notice for the Original
- Work:
-
- Licensed under the Academic Free License version 2.0
- 1) Grant of Copyright License. Licensor hereby grants You a world-wide,
- royalty-free, non-exclusive, perpetual, sublicenseable license to do the
- following:
-
- a) to reproduce the Original Work in copies;
- b) to prepare derivative works ("Derivative Works") based upon the Original
- Work;
- c) to distribute copies of the Original Work and Derivative Works to the
- public;
- d) to perform the Original Work publicly; and
- e) to display the Original Work publicly.
-
- 2) Grant of Patent License. Licensor hereby grants You a world-wide,
- royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
- claims owned or controlled by the Licensor that are embodied in the Original
- Work as furnished by the Licensor, to make, use, sell and offer for sale the
- Original Work and Derivative Works.
-
- 3) Grant of Source Code License. The term "Source Code" means the preferred
- form of the Original Work for making modifications to it and all available
- documentation describing how to modify the Original Work. Licensor hereby
- agrees to provide a machine-readable copy of the Source Code of the Original
- Work along with each copy of the Original Work that Licensor distributes.
- Licensor reserves the right to satisfy this obligation by placing a
- machine-readable copy of the Source Code in an information repository
- reasonably calculated to permit inexpensive and convenient access by You for as
- long as Licensor continues to distribute the Original Work, and by publishing
- the address of that information repository in a notice immediately following
- the copyright notice that applies to the Original Work.
-
- 4) Exclusions From License Grant. Neither the names of Licensor, nor the names
- of any contributors to the Original Work, nor any of their trademarks or
- service marks, may be used to endorse or promote products derived from this
- Original Work without express prior written permission of the Licensor. Nothing
- in this License shall be deemed to grant any rights to trademarks, copyrights,
- patents, trade secrets or any other intellectual property of Licensor except as
- expressly stated herein. No patent license is granted to make, use, sell or
- offer to sell embodiments of any patent claims other than the licensed claims
- defined in Section 2. No right is granted to the trademarks of Licensor even if
- such marks are included in the Original Work. Nothing in this License shall be
- interpreted to prohibit Licensor from licensing under different terms from this
- License any Original Work that Licensor otherwise would have a right to
- license.
-
- 5) This section intentionally omitted.
-
- 6) Attribution Rights. You must retain, in the Source Code of any Derivative
- Works that You create, all copyright, patent or trademark notices from the
- Source Code of the Original Work, as well as any notices of licensing and any
- descriptive text identified therein as an "Attribution Notice." You must cause
- the Source Code for any Derivative Works that You create to carry a prominent
- Attribution Notice reasonably calculated to inform recipients that You have
- modified the Original Work.
-
- 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
- the copyright in and to the Original Work and the patent rights granted herein
- by Licensor are owned by the Licensor or are sublicensed to You under the terms
- of this License with the permission of the contributor(s) of those copyrights
- and patent rights. Except as expressly stated in the immediately proceeding
- sentence, the Original Work is provided under this License on an "AS IS" BASIS
- and WITHOUT WARRANTY, either express or implied, including, without limitation,
- the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
- This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
- license to Original Work is granted hereunder except under this disclaimer.
-
- 8) Limitation of Liability. Under no circumstances and under no legal theory,
- whether in tort (including negligence), contract, or otherwise, shall the
- Licensor be liable to any person for any direct, indirect, special, incidental,
- or consequential damages of any character arising as a result of this License
- or the use of the Original Work including, without limitation, damages for loss
- of goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses. This limitation of liability shall not
- apply to liability for death or personal injury resulting from Licensor's
- negligence to the extent applicable law prohibits such limitation. Some
- jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
- 9) Acceptance and Termination. If You distribute copies of the Original Work or
- a Derivative Work, You must make a reasonable effort under the circumstances to
- obtain the express assent of recipients to the terms of this License. Nothing
- else but this License (or another written agreement between Licensor and You)
- grants You permission to create Derivative Works based upon the Original Work
- or to exercise any of the rights granted in Section 1 herein, and any attempt
- to do so except under the terms of this License (or another written agreement
- between Licensor and You) is expressly prohibited by U.S. copyright law, the
- equivalent laws of other countries, and by international treaty. Therefore, by
- exercising any of the rights granted to You in Section 1 herein, You indicate
- Your acceptance of this License and all of its terms and conditions.
-
- 10) Termination for Patent Action. This License shall terminate automatically
- and You may no longer exercise any of the rights granted to You by this License
- as of the date You commence an action, including a cross-claim or counterclaim,
- for patent infringement (i) against Licensor with respect to a patent
- applicable to software or (ii) against any entity with respect to a patent
- applicable to the Original Work (but excluding combinations of the Original
- Work with other software or hardware).
-
- 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
- License may be brought only in the courts of a jurisdiction wherein the
- Licensor resides or in which Licensor conducts its primary business, and under
- the laws of that jurisdiction excluding its conflict-of-law provisions. The
- application of the United Nations Convention on Contracts for the International
- Sale of Goods is expressly excluded. Any use of the Original Work outside the
- scope of this License or after its termination shall be subject to the
- requirements and penalties of the U.S. Copyright Act, 17 U.S.C. 101 et seq.,
- the equivalent laws of other countries, and international treaty. This section
- shall survive the termination of this License.
-
- 12) Attorneys Fees. In any action to enforce the terms of this License or
- seeking damages relating thereto, the prevailing party shall be entitled to
- recover its costs and expenses, including, without limitation, reasonable
- attorneys' fees and costs incurred in connection with such action, including
- any appeal of such action. This section shall survive the termination of this
- License.
-
- 13) Miscellaneous. This License represents the complete agreement concerning
- the subject matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the extent necessary to
- make it enforceable.
-
- 14) Definition of "You" in This License. "You" throughout this License, whether
- in upper or lower case, means an individual or a legal entity exercising rights
- under, and complying with all of the terms of, this License. For legal
- entities, "You" includes any entity that controls, is controlled by, or is
- under common control with you. For purposes of this definition, "control" means
- (i) the power, direct or indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (ii) ownership of fifty percent
- (50%) or more of the outstanding shares, or (iii) beneficial ownership of such
- entity.
-
- 15) Right to Use. You may use the Original Work in all ways not otherwise
- restricted or conditioned by this License or by law, and Licensor promises not
- to interfere with or be responsible for such uses by You.
-
- This license is Copyright (C) 2003 Lawrence E. Rosen. All rights reserved.
- Permission is hereby granted to copy and distribute this license without
- modification. This license may not be modified without the express written
- permission of its copyright owner.
-
-
- xdg_user_dirs
-
-
- Copyright (c) 2007 Red Hat, inc
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-
-
uri_template
diff --git a/src/cobalt/content/licenses/platform/default/licenses_cobalt.txt b/src/cobalt/content/licenses/platform/default/licenses_cobalt.txt
index 757106b..5b4bc55 100644
--- a/src/cobalt/content/licenses/platform/default/licenses_cobalt.txt
+++ b/src/cobalt/content/licenses/platform/default/licenses_cobalt.txt
@@ -853,25 +853,6 @@
xdg_mime
- Licensed under the Academic Free License version 2.0 (below)
- Or under the following terms:
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-
--------------------------------------------------------------------------------
Academic Free License v. 2.0
--------------------------------------------------------------------------------
diff --git a/src/cobalt/extension/updater_notification.h b/src/cobalt/extension/updater_notification.h
index 151437f..ce301dc 100644
--- a/src/cobalt/extension/updater_notification.h
+++ b/src/cobalt/extension/updater_notification.h
@@ -51,7 +51,8 @@
// and prompt the user to free some storage. The implementation
// should keep track of the frequency of showing the prompt to the
// user and try to minimize the number of user notifications.
- void (*UpdaterState)(CobaltExtensionUpdaterNotificationState state);
+ void (*UpdaterState)(CobaltExtensionUpdaterNotificationState state,
+ const char* current_evergreen_version);
} CobaltExtensionUpdaterNotificationApi;
#ifdef __cplusplus
diff --git a/src/cobalt/media/base/starboard_utils.cc b/src/cobalt/media/base/starboard_utils.cc
index c4e9cb0..9043285 100644
--- a/src/cobalt/media/base/starboard_utils.cc
+++ b/src/cobalt/media/base/starboard_utils.cc
@@ -369,7 +369,8 @@
if (sb_media_color_metadata.primaries == kSbMediaPrimaryIdCustom) {
const float* custom_primary_matrix = color_space.custom_primary_matrix();
SbMemoryCopy(sb_media_color_metadata.custom_primary_matrix,
- custom_primary_matrix, sizeof(custom_primary_matrix));
+ custom_primary_matrix,
+ sizeof(sb_media_color_metadata.custom_primary_matrix));
}
return sb_media_color_metadata;
diff --git a/src/cobalt/render_tree/mock_resource_provider.h b/src/cobalt/render_tree/mock_resource_provider.h
index 244d695..3825a9a 100644
--- a/src/cobalt/render_tree/mock_resource_provider.h
+++ b/src/cobalt/render_tree/mock_resource_provider.h
@@ -59,6 +59,7 @@
MOCK_CONST_METHOD1(HasLocalFontFamily, bool(const char* font_family_name));
MOCK_METHOD2(GetLocalTypefaceMock,
Typeface*(const char* font_family_name, FontStyle font_style));
+ MOCK_METHOD0(LoadAdditionalFonts, void());
MOCK_METHOD1(GetLocalTypefaceIfAvailableMock,
Typeface*(const std::string& font_face_name));
MOCK_METHOD3(GetCharacterFallbackTypefaceMock,
diff --git a/src/cobalt/render_tree/resource_provider.h b/src/cobalt/render_tree/resource_provider.h
index af51209..ad8fd67 100644
--- a/src/cobalt/render_tree/resource_provider.h
+++ b/src/cobalt/render_tree/resource_provider.h
@@ -129,6 +129,9 @@
virtual scoped_refptr<Typeface> GetLocalTypeface(const char* font_family_name,
FontStyle font_style) = 0;
+ // Loads additional fonts that should be loaded asynchronously at startup.
+ virtual void LoadAdditionalFonts() = 0;
+
// Given a set of typeface information, this method returns the locally
// available typeface that best fits the specified parameters. In the case
// where no typeface is found that matches the font family name, NULL is
diff --git a/src/cobalt/render_tree/resource_provider_stub.h b/src/cobalt/render_tree/resource_provider_stub.h
index 961b59b..43ad4e8 100644
--- a/src/cobalt/render_tree/resource_provider_stub.h
+++ b/src/cobalt/render_tree/resource_provider_stub.h
@@ -329,6 +329,8 @@
return base::WrapRefCounted(new TypefaceStub(NULL));
}
+ void LoadAdditionalFonts() override {}
+
scoped_refptr<Typeface> CreateTypefaceFromRawData(
std::unique_ptr<RawTypefaceDataVector> raw_data,
std::string* error_string) override {
diff --git a/src/cobalt/renderer/pipeline.cc b/src/cobalt/renderer/pipeline.cc
index a78f0ed..75a5a1e 100644
--- a/src/cobalt/renderer/pipeline.cc
+++ b/src/cobalt/renderer/pipeline.cc
@@ -603,6 +603,9 @@
rasterizer_ = create_rasterizer_function.Run();
rasterizer_created_event_.Signal();
+ // Async load additional fonts after rasterizer thread is fully initialized.
+ GetResourceProvider()->LoadAdditionalFonts();
+
// Note that this is setup as high priority, but lower than the rasterizer
// thread's priority (ThreadPriority::HIGHEST). This is to ensure that
// we never interrupt the rasterizer in order to dispose render trees, but
diff --git a/src/cobalt/renderer/pipeline_test.cc b/src/cobalt/renderer/pipeline_test.cc
index 65e75cb..a5fc24e 100644
--- a/src/cobalt/renderer/pipeline_test.cc
+++ b/src/cobalt/renderer/pipeline_test.cc
@@ -18,6 +18,7 @@
#include "base/optional.h"
#include "base/threading/platform_thread.h"
#include "cobalt/render_tree/composition_node.h"
+#include "cobalt/render_tree/resource_provider_stub.h"
#include "cobalt/renderer/pipeline.h"
#include "cobalt/renderer/rasterizer/rasterizer.h"
#include "cobalt/renderer/submission.h"
@@ -36,6 +37,14 @@
const base::TimeDelta kRasterizeDelay =
base::TimeDelta::FromSecondsD(1.0 / 60.0);
+class MockResourceProvider : public cobalt::render_tree::ResourceProviderStub {
+ public:
+ MockResourceProvider() : fonts_loaded_(false){};
+ ~MockResourceProvider() override {}
+ void LoadAdditionalFonts() override { fonts_loaded_ = true; }
+ bool fonts_loaded_;
+};
+
// Unfortunately, we can't make use of gmock to test the number of submission
// calls that were made. This is because we need to test our expectations
// AFTER all Submit() calls have been made, whereas gmock requires us to
@@ -46,7 +55,9 @@
class MockRasterizer : public Rasterizer {
public:
explicit MockRasterizer(int* submission_count)
- : submission_count_(submission_count) {}
+ : submission_count_(submission_count),
+ provider_(new MockResourceProvider()) {}
+ ~MockRasterizer() { delete provider_; }
void Submit(const scoped_refptr<cobalt::render_tree::Node>&,
const scoped_refptr<cobalt::renderer::backend::RenderTarget>&,
@@ -67,7 +78,7 @@
}
cobalt::render_tree::ResourceProvider* GetResourceProvider() override {
- return NULL;
+ return provider_;
}
void MakeCurrent() override {}
@@ -76,6 +87,7 @@
private:
int* submission_count_;
base::Optional<base::TimeTicks> last_submission_time;
+ MockResourceProvider* provider_;
};
std::unique_ptr<Rasterizer> CreateMockRasterizer(int* submission_count) {
@@ -217,3 +229,16 @@
EXPECT_LE(expected_submissions.lower_bound, submission_count_);
EXPECT_GE(expected_submissions.upper_bound, submission_count_);
}
+
+TEST_F(RendererPipelineTest, LoadDefaultFontsAfterRasterizerCreated) {
+ MockResourceProvider* provider =
+ base::polymorphic_downcast<MockResourceProvider*>(
+ pipeline_->GetResourceProvider());
+
+ // Wait a little bit to give the pipeline some time to initialize rasterizer
+ // thread.
+ const base::TimeDelta kDelay = base::TimeDelta::FromMilliseconds(400);
+ base::PlatformThread::Sleep(kDelay);
+
+ EXPECT_EQ(true, provider->fonts_loaded_);
+}
diff --git a/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc b/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc
index 83d2baf..399f535 100644
--- a/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc
+++ b/src/cobalt/renderer/rasterizer/blitter/resource_provider.cc
@@ -150,6 +150,10 @@
utf32_character, font_style, language);
}
+void ResourceProvider::LoadAdditionalFonts() {
+ return skia_resource_provider_->LoadAdditionalFonts();
+}
+
scoped_refptr<Typeface> ResourceProvider::CreateTypefaceFromRawData(
std::unique_ptr<RawTypefaceDataVector> raw_data,
std::string* error_string) {
diff --git a/src/cobalt/renderer/rasterizer/blitter/resource_provider.h b/src/cobalt/renderer/rasterizer/blitter/resource_provider.h
index bb7fd0b..6e91345 100644
--- a/src/cobalt/renderer/rasterizer/blitter/resource_provider.h
+++ b/src/cobalt/renderer/rasterizer/blitter/resource_provider.h
@@ -86,6 +86,8 @@
int32 utf32_character, render_tree::FontStyle font_style,
const std::string& language) override;
+ void LoadAdditionalFonts() override;
+
scoped_refptr<render_tree::Typeface> CreateTypefaceFromRawData(
std::unique_ptr<RawTypefaceDataVector> raw_data,
std::string* error_string) override;
diff --git a/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc b/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
index 8b43221..7a14ae2 100644
--- a/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
+++ b/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
@@ -478,6 +478,13 @@
return scoped_refptr<render_tree::Typeface>(new SkiaTypeface(typeface));
}
+void HardwareResourceProvider::LoadAdditionalFonts() {
+ sk_sp<SkFontMgr> font_manager(SkFontMgr::RefDefault());
+ SkFontMgr_Cobalt* cobalt_font_manager =
+ base::polymorphic_downcast<SkFontMgr_Cobalt*>(font_manager.get());
+ cobalt_font_manager->LoadLocaleDefault();
+}
+
scoped_refptr<render_tree::Typeface>
HardwareResourceProvider::CreateTypefaceFromRawData(
std::unique_ptr<render_tree::ResourceProvider::RawTypefaceDataVector>
diff --git a/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.h b/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.h
index e6b7252..2a7dc3d 100644
--- a/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.h
+++ b/src/cobalt/renderer/rasterizer/skia/hardware_resource_provider.h
@@ -92,6 +92,8 @@
int32 character, render_tree::FontStyle font_style,
const std::string& language) override;
+ void LoadAdditionalFonts() override;
+
// This resource provider uses ots (OpenTypeSanitizer) to sanitize the raw
// typeface data and skia to generate the typeface. It supports TrueType,
// OpenType, and WOFF data formats.
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.cc b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.cc
index 2590ffc..bbe236f 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.cc
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.cc
@@ -26,11 +26,15 @@
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
+#include "cobalt/base/language.h"
#include "cobalt/configuration/configuration.h"
#include "cobalt/extension/font.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontConfigParser_cobalt.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkFreeType_cobalt.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.h"
+#include "third_party/icu/source/common/unicode/locid.h"
+
+const char* ROBOTO_SCRIPT = "latn";
SkFontMgr_Cobalt::SkFontMgr_Cobalt(
const char* cobalt_font_config_directory,
@@ -42,7 +46,8 @@
"Font.LocalTypefaceCache",
cobalt::configuration::Configuration::GetInstance()
->CobaltLocalTypefaceCacheSizeInBytes()),
- default_family_(NULL) {
+ default_fonts_loaded_event_(base::WaitableEvent::ResetPolicy::MANUAL,
+ base::WaitableEvent::InitialState::SIGNALED) {
TRACE_EVENT0("cobalt::renderer", "SkFontMgr_Cobalt::SkFontMgr_Cobalt()");
PriorityStyleSetArrayMap priority_fallback_families;
@@ -199,7 +204,7 @@
}
if (typeface == NULL) {
- typeface = default_family_->matchStyle(style);
+ typeface = default_families_[0]->matchStyle(style);
}
return typeface;
@@ -253,9 +258,10 @@
font_manager->FindFamilyStyleCharacter(style, SkString(), character);
// If no family was found that supports the character, then just fall back
- // to the default family.
- return matching_typeface ? matching_typeface
- : default_family_->MatchStyleWithoutLocking(style);
+ // to the first default family.
+ return matching_typeface
+ ? matching_typeface
+ : default_families_[0]->MatchStyleWithoutLocking(style);
}
sk_sp<SkTypeface> SkFontMgr_Cobalt::onMakeFromData(sk_sp<SkData> data,
@@ -270,12 +276,17 @@
bool is_fixed_pitch;
SkFontStyle style;
SkString name;
+
+ // To pre-fetch glyphs for remote fonts, we could pass character_map here.
if (!sk_freetype_cobalt::ScanFont(stream.get(), face_index, &name, &style,
- &is_fixed_pitch)) {
+ &is_fixed_pitch, nullptr)) {
return NULL;
}
- return sk_sp<SkTypeface>(new SkTypeface_CobaltStream(
- std::move(stream), face_index, style, is_fixed_pitch, name));
+ scoped_refptr<font_character_map::CharacterMap> character_map =
+ base::MakeRefCounted<font_character_map::CharacterMap>();
+ return sk_sp<SkTypeface>(
+ new SkTypeface_CobaltStream(std::move(stream), face_index, style,
+ is_fixed_pitch, name, character_map));
}
sk_sp<SkTypeface> SkFontMgr_Cobalt::onMakeFromFile(const char path[],
@@ -289,6 +300,25 @@
return sk_sp<SkTypeface>(matchFamilyStyle(family_name, style));
}
+void SkFontMgr_Cobalt::LoadLocaleDefault() {
+ std::string script =
+ icu::Locale::createCanonical(base::GetSystemLanguageScript().c_str())
+ .getScript();
+ if (SbStringCompareNoCase(script.c_str(), ROBOTO_SCRIPT) == 0) {
+ return;
+ }
+
+ default_fonts_loaded_event_.Reset();
+ for (int i = 0; i < families_.count(); i++) {
+ if (CheckIfFamilyMatchesLocaleScript(families_[i], script.c_str())) {
+ default_fonts_loaded_event_.Signal();
+ return;
+ }
+ }
+
+ default_fonts_loaded_event_.Signal();
+}
+
void SkFontMgr_Cobalt::ParseConfigAndBuildFamilies(
const char* font_config_directory, const char* font_files_directory,
PriorityStyleSetArrayMap* priority_fallback_families) {
@@ -458,20 +488,42 @@
sk_sp<SkTypeface> check_typeface(
check_family->MatchStyleWithoutLocking(SkFontStyle()));
if (check_typeface.get() != NULL) {
- default_family_ = check_family.get();
+ default_families_.push_back(check_family.get());
break;
}
}
- if (default_family_ == NULL) {
+ if (default_families_.empty()) {
sk_sp<SkTypeface> check_typeface(
families_[0]->MatchStyleWithoutLocking(SkFontStyle()));
if (check_typeface.get() != NULL) {
- default_family_ = families_[0].get();
+ default_families_.push_back(families_[0].get());
}
}
- CHECK(default_family_);
+ CHECK(!default_families_.empty());
+}
+
+bool SkFontMgr_Cobalt::CheckIfFamilyMatchesLocaleScript(
+ sk_sp<SkFontStyleSet_Cobalt> new_family, const char* script) {
+ SkString family_tag = new_family->get_language().GetTag();
+ if (family_tag.isEmpty()) {
+ return false;
+ }
+ std::string family_script =
+ icu::Locale::createCanonical(family_tag.c_str()).getScript();
+ if (SbStringCompareNoCase(script, family_script.c_str()) != 0) {
+ return false;
+ }
+
+ sk_sp<SkTypeface> check_typeface(
+ new_family->MatchStyleWithoutLocking(SkFontStyle()));
+ if (check_typeface.get() == NULL) {
+ return false;
+ }
+
+ default_families_.push_back(new_family.get());
+ return true;
}
SkTypeface* SkFontMgr_Cobalt::FindFamilyStyleCharacter(
@@ -481,6 +533,20 @@
return NULL;
}
+ // First attempt any extra default fonts set by locale.
+ default_fonts_loaded_event_.Wait();
+ if (default_families_.size() > 1) {
+ for (int i = 1; i < default_families_.size(); ++i) {
+ SkFontStyleSet_Cobalt* family = default_families_[i];
+ if (family->ContainsCharacter(style, character)) {
+ SkTypeface* matching_typeface = family->MatchStyleWithoutLocking(style);
+ if (matching_typeface) {
+ return matching_typeface;
+ }
+ }
+ }
+ }
+
StyleSetArray* fallback_families = GetMatchingFallbackFamilies(language_tag);
for (int i = 0; i < fallback_families->size(); ++i) {
SkFontStyleSet_Cobalt* family = (*fallback_families)[i];
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.h b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.h
index 8159969..10f6b0c 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.h
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontMgr_cobalt.h
@@ -25,6 +25,7 @@
#include "SkTypeface.h"
#include "base/containers/hash_tables.h"
#include "base/containers/small_map.h"
+#include "base/synchronization/waitable_event.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontUtil_cobalt.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkStream_cobalt.h"
@@ -65,6 +66,9 @@
// NOTE: This returns NULL if a match is not found.
SkTypeface* MatchFaceName(const char face_name[]);
+ // Loads the font that matches the suggested script for the device's locale.
+ void LoadLocaleDefault();
+
protected:
// From SkFontMgr
int onCountFamilies() const override;
@@ -125,6 +129,8 @@
void GeneratePriorityOrderedFallbackFamilies(
const PriorityStyleSetArrayMap& priority_fallback_families);
void FindDefaultFamily(const SkTArray<SkString, true>& default_families);
+ bool CheckIfFamilyMatchesLocaleScript(sk_sp<SkFontStyleSet_Cobalt> new_family,
+ const char* script);
// Returns the first encountered fallback family that matches the language tag
// and supports the specified character.
@@ -157,9 +163,12 @@
std::vector<std::unique_ptr<StyleSetArray>> language_fallback_families_array_;
NameToStyleSetArrayMap language_fallback_families_map_;
- // The default family that is used when no specific match is found during a
- // request.
- SkFontStyleSet_Cobalt* default_family_;
+ // List of default families that are used when no specific match is found
+ // during a request.
+ std::vector<SkFontStyleSet_Cobalt*> default_families_;
+
+ // Used to delay font loading until default fonts are fully loaded.
+ base::WaitableEvent default_fonts_loaded_event_;
// Mutex shared by all families for accessing their modifiable data.
mutable SkMutex family_mutex_;
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.cc b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.cc
index b9af82e..8d92c16 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.cc
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.cc
@@ -90,6 +90,8 @@
return;
}
+ character_map_ = base::MakeRefCounted<font_character_map::CharacterMap>();
+
family_name_ = family_info.names[0];
SkTHashMap<SkString, int> styles_index_map;
@@ -333,11 +335,8 @@
}
bool SkFontStyleSet_Cobalt::CharacterMapContainsCharacter(SkUnichar character) {
- font_character_map::CharacterMap::iterator page_iterator =
- character_map_.find(font_character_map::GetPage(character));
- return page_iterator != character_map_.end() &&
- page_iterator->second.test(
- font_character_map::GetPageCharacterIndex(character));
+ font_character_map::Character c = character_map_->Find(character);
+ return c.is_set && c.id > 0;
}
bool SkFontStyleSet_Cobalt::GenerateStyleFaceInfo(
@@ -349,7 +348,7 @@
// Providing a pointer to the character map will cause it to be generated
// during ScanFont. Only provide it if it hasn't already been generated.
font_character_map::CharacterMap* character_map =
- !is_character_map_generated_ ? &character_map_ : NULL;
+ !is_character_map_generated_ ? character_map_.get() : NULL;
if (!sk_freetype_cobalt::ScanFont(
stream, style->face_index, &style->face_name, &style->font_style,
@@ -396,7 +395,7 @@
style_entry->typeface.reset(new SkTypeface_CobaltStreamProvider(
stream_provider, style_entry->face_index, style_entry->font_style,
style_entry->face_is_fixed_pitch, family_name_,
- style_entry->disable_synthetic_bolding));
+ style_entry->disable_synthetic_bolding, character_map_));
} else {
LOG(ERROR) << "Failed to scan font: "
<< style_entry->font_file_path.c_str();
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.h b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.h
index 715aee8..33ec970 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.h
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.h
@@ -100,6 +100,8 @@
const SkString& get_family_name() const { return family_name_; }
+ const SkLanguage& get_language() const { return language_; }
+
private:
// NOTE: It is the responsibility of the caller to lock the mutex before
// calling any of the non-const private functions.
@@ -135,7 +137,7 @@
// NOTE: The following characters require locking when being accessed.
bool is_character_map_generated_;
- font_character_map::CharacterMap character_map_;
+ scoped_refptr<font_character_map::CharacterMap> character_map_;
SkTArray<sk_sp<SkFontStyleSetEntry_Cobalt>, true> styles_;
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontUtil_cobalt.h b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontUtil_cobalt.h
index 77023ae..4f0f1c3 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontUtil_cobalt.h
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontUtil_cobalt.h
@@ -19,9 +19,11 @@
#include <map>
#include <utility>
+#include "SkMutex.h"
#include "SkString.h"
#include "SkTDArray.h"
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
// The font_character_map namespace contains all of the constants, typedefs, and
// utility functions used with determining whether or not a font supports a
@@ -54,13 +56,46 @@
// in non-overlapping ascending order.
typedef SkTArray<PageRange> PageRanges;
-typedef std::bitset<kNumCharactersPerPage> PageCharacters;
-typedef std::map<int16, PageCharacters> CharacterMap;
-
bool IsCharacterValid(SkUnichar character);
int16 GetPage(SkUnichar character);
unsigned char GetPageCharacterIndex(SkUnichar character);
+struct Character {
+ SkGlyphID id = 0;
+ bool is_set = false;
+};
+
+using PageCharacters = Character[kNumCharactersPerPage];
+class CharacterMap : public base::RefCountedThreadSafe<CharacterMap> {
+ public:
+ const Character Find(SkUnichar character) {
+ SkAutoMutexExclusive scoped_mutex(mutex_);
+
+ int16 page = GetPage(character);
+ std::map<int16, PageCharacters>::iterator page_iterator = data_.find(page);
+
+ if (page_iterator == data_.end()) return {};
+
+ unsigned char character_index = GetPageCharacterIndex(character);
+ return page_iterator->second[character_index];
+ }
+
+ void Insert(SkUnichar character, SkGlyphID glyph) {
+ SkAutoMutexExclusive scoped_mutex(mutex_);
+
+ int16 page = GetPage(character);
+ unsigned char character_index = GetPageCharacterIndex(character);
+ Character c;
+ c.id = glyph;
+ c.is_set = true;
+ data_[page][character_index] = c;
+ }
+
+ private:
+ std::map<int16, PageCharacters> data_;
+ mutable SkMutex mutex_;
+};
+
} // namespace font_character_map
// The SkLanguage class represents a human written language, and is used by
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFreeType_cobalt.cc b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFreeType_cobalt.cc
index 637db3a..cbcc362 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFreeType_cobalt.cc
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkFreeType_cobalt.cc
@@ -106,19 +106,9 @@
TRACE_EVENT0("cobalt::renderer", "GenerateCharacterMapFromFace");
FT_UInt glyph_index;
-
- int last_page = -1;
- font_character_map::PageCharacters* page_characters = NULL;
-
SkUnichar code_point = FT_Get_First_Char(face, &glyph_index);
while (glyph_index) {
- int page = font_character_map::GetPage(code_point);
- if (page != last_page) {
- page_characters = &(*character_map)[page];
- last_page = page;
- }
- page_characters->set(font_character_map::GetPageCharacterIndex(code_point));
-
+ character_map->Insert(code_point, SkToU16(glyph_index));
code_point = FT_Get_Next_Char(face, code_point, &glyph_index);
}
}
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.cc b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.cc
index 8869e40..8f9cce8 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.cc
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.cc
@@ -20,27 +20,52 @@
#include "SkFontStyle.h"
#include "SkTypefaceCache.h"
-SkTypeface_Cobalt::SkTypeface_Cobalt(int face_index, SkFontStyle style,
- bool is_fixed_pitch,
- const SkString& family_name)
+SkTypeface_Cobalt::SkTypeface_Cobalt(
+ int face_index, SkFontStyle style, bool is_fixed_pitch,
+ const SkString& family_name,
+ scoped_refptr<font_character_map::CharacterMap> character_map)
: INHERITED(style, is_fixed_pitch),
face_index_(face_index),
family_name_(family_name),
- synthesizes_bold_(!isBold()) {}
+ synthesizes_bold_(!isBold()),
+ character_map_(character_map) {}
sk_sp<SkTypeface> SkTypeface_Cobalt::onMakeClone(
const SkFontArguments& args) const {
return sk_ref_sp(this);
}
+void SkTypeface_Cobalt::onCharsToGlyphs(const SkUnichar uni[], int count,
+ SkGlyphID glyphs[]) const {
+ for (int i = 0; i < count; ++i) {
+ glyphs[i] = characterMapGetGlyphIdForCharacter(uni[i]);
+ }
+}
+
+SkGlyphID SkTypeface_Cobalt::characterMapGetGlyphIdForCharacter(
+ SkUnichar character) const {
+ CHECK(character_map_);
+
+ // Check whether the character is cached in the character map.
+ font_character_map::Character c = character_map_->Find(character);
+ if (c.is_set) return c.id;
+
+ // If the character isn't there, look it up with FreeType, then cache it.
+ SkGlyphID glyphs[1] = {0};
+ SkTypeface_FreeType::onCharsToGlyphs(&character, 1, glyphs);
+ character_map_->Insert(character, glyphs[0]);
+ return glyphs[0];
+}
+
void SkTypeface_Cobalt::onGetFamilyName(SkString* family_name) const {
*family_name = family_name_;
}
SkTypeface_CobaltStream::SkTypeface_CobaltStream(
std::unique_ptr<SkStreamAsset> stream, int face_index, SkFontStyle style,
- bool is_fixed_pitch, const SkString& family_name)
- : INHERITED(face_index, style, is_fixed_pitch, family_name),
+ bool is_fixed_pitch, const SkString& family_name,
+ scoped_refptr<font_character_map::CharacterMap> character_map)
+ : INHERITED(face_index, style, is_fixed_pitch, family_name, character_map),
stream_(std::move(stream)) {
LOG(INFO) << "Created SkTypeface_CobaltStream: " << family_name.c_str() << "("
<< style.weight() << ", " << style.width() << ", " << style.slant()
@@ -68,8 +93,9 @@
SkTypeface_CobaltStreamProvider::SkTypeface_CobaltStreamProvider(
SkFileMemoryChunkStreamProvider* stream_provider, int face_index,
SkFontStyle style, bool is_fixed_pitch, const SkString& family_name,
- bool disable_synthetic_bolding)
- : INHERITED(face_index, style, is_fixed_pitch, family_name),
+ bool disable_synthetic_bolding,
+ scoped_refptr<font_character_map::CharacterMap> character_map)
+ : INHERITED(face_index, style, is_fixed_pitch, family_name, character_map),
stream_provider_(stream_provider) {
if (disable_synthetic_bolding) {
synthesizes_bold_ = false;
diff --git a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.h b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.h
index e5d94d5..291ff2d 100644
--- a/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.h
+++ b/src/cobalt/renderer/rasterizer/skia/skia/src/ports/SkTypeface_cobalt.h
@@ -20,6 +20,7 @@
#include "SkStream.h"
#include "SkString.h"
#include "base/memory/ref_counted.h"
+#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkFontStyleSet_cobalt.h"
#include "cobalt/renderer/rasterizer/skia/skia/src/ports/SkStream_cobalt.h"
#include "third_party/skia/src/ports/SkFontHost_FreeType_common.h"
@@ -27,8 +28,10 @@
class SkTypeface_Cobalt : public SkTypeface_FreeType {
public:
- SkTypeface_Cobalt(int face_index, SkFontStyle style, bool is_fixed_pitch,
- const SkString& family_name);
+ SkTypeface_Cobalt(
+ int face_index, SkFontStyle style, bool is_fixed_pitch,
+ const SkString& family_name,
+ scoped_refptr<font_character_map::CharacterMap> character_map);
virtual size_t GetStreamLength() const = 0;
@@ -37,6 +40,9 @@
protected:
sk_sp<SkTypeface> onMakeClone(const SkFontArguments& args) const override;
+ void onCharsToGlyphs(const SkUnichar uni[], int count,
+ SkGlyphID glyphs[]) const override;
+
void onGetFamilyName(SkString* family_name) const override;
int face_index_;
@@ -45,13 +51,16 @@
private:
typedef SkTypeface_FreeType INHERITED;
+ SkGlyphID characterMapGetGlyphIdForCharacter(SkUnichar character) const;
+ scoped_refptr<font_character_map::CharacterMap> character_map_;
};
class SkTypeface_CobaltStream : public SkTypeface_Cobalt {
public:
- SkTypeface_CobaltStream(std::unique_ptr<SkStreamAsset> stream, int face_index,
- SkFontStyle style, bool is_fixed_pitch,
- const SkString& family_name);
+ SkTypeface_CobaltStream(
+ std::unique_ptr<SkStreamAsset> stream, int face_index, SkFontStyle style,
+ bool is_fixed_pitch, const SkString& family_name,
+ scoped_refptr<font_character_map::CharacterMap> character_map);
void onGetFontDescriptor(SkFontDescriptor* descriptor,
bool* serialize) const override;
@@ -71,7 +80,8 @@
SkTypeface_CobaltStreamProvider(
SkFileMemoryChunkStreamProvider* stream_provider, int face_index,
SkFontStyle style, bool is_fixed_pitch, const SkString& family_name,
- bool disable_synthetic_bolding);
+ bool disable_synthetic_bolding,
+ scoped_refptr<font_character_map::CharacterMap> character_map);
void onGetFontDescriptor(SkFontDescriptor* descriptor,
bool* serialize) const override;
diff --git a/src/cobalt/renderer/rasterizer/skia/software_resource_provider.cc b/src/cobalt/renderer/rasterizer/skia/software_resource_provider.cc
index d6b2a10..25f9813 100644
--- a/src/cobalt/renderer/rasterizer/skia/software_resource_provider.cc
+++ b/src/cobalt/renderer/rasterizer/skia/software_resource_provider.cc
@@ -179,6 +179,13 @@
return scoped_refptr<render_tree::Typeface>(new SkiaTypeface(typeface));
}
+void SoftwareResourceProvider::LoadAdditionalFonts() {
+ sk_sp<SkFontMgr> font_manager(SkFontMgr::RefDefault());
+ SkFontMgr_Cobalt* cobalt_font_manager =
+ base::polymorphic_downcast<SkFontMgr_Cobalt*>(font_manager.get());
+ cobalt_font_manager->LoadLocaleDefault();
+}
+
scoped_refptr<render_tree::Typeface>
SoftwareResourceProvider::CreateTypefaceFromRawData(
std::unique_ptr<render_tree::ResourceProvider::RawTypefaceDataVector>
diff --git a/src/cobalt/renderer/rasterizer/skia/software_resource_provider.h b/src/cobalt/renderer/rasterizer/skia/software_resource_provider.h
index 68d06ff..aad9edd 100644
--- a/src/cobalt/renderer/rasterizer/skia/software_resource_provider.h
+++ b/src/cobalt/renderer/rasterizer/skia/software_resource_provider.h
@@ -84,6 +84,8 @@
int32 character, render_tree::FontStyle font_style,
const std::string& language) override;
+ void LoadAdditionalFonts() override;
+
// This resource provider uses ots (OpenTypeSanitizer) to sanitize the raw
// typeface data and skia to generate the typeface. It supports TrueType,
// OpenType, and WOFF data formats.
diff --git a/src/cobalt/renderer/rasterizer/skia/typeface.cc b/src/cobalt/renderer/rasterizer/skia/typeface.cc
index 5c9acc0..0a70a6c 100644
--- a/src/cobalt/renderer/rasterizer/skia/typeface.cc
+++ b/src/cobalt/renderer/rasterizer/skia/typeface.cc
@@ -65,26 +65,15 @@
render_tree::kUnknownGlyphIndex) {
return primary_page_character_glyphs_[utf32_character];
}
- // Otherwise, check for the character's glyph within the map.
- } else {
- CharacterToGlyphMap::iterator glyph_iterator =
- character_to_glyph_map_.find(utf32_character);
- if (glyph_iterator != character_to_glyph_map_.end()) {
- return glyph_iterator->second;
- }
}
-
- // If we reach this point, the character's glyph was not previously cached and
- // needs to be retrieved now.
render_tree::GlyphIndex glyph = render_tree::kInvalidGlyphIndex;
typeface_->unicharsToGlyphs(&utf32_character, 1, &glyph);
// Both cache and return the character's glyph.
if (utf32_character < kPrimaryPageSize) {
return primary_page_character_glyphs_[utf32_character] = glyph;
- } else {
- return character_to_glyph_map_[utf32_character] = glyph;
}
+ return glyph;
}
} // namespace skia
diff --git a/src/cobalt/renderer/rasterizer/skia/typeface.h b/src/cobalt/renderer/rasterizer/skia/typeface.h
index f0efded..26aad50 100644
--- a/src/cobalt/renderer/rasterizer/skia/typeface.h
+++ b/src/cobalt/renderer/rasterizer/skia/typeface.h
@@ -63,7 +63,6 @@
private:
// Usually covers Latin-1 in a single page.
static const int kPrimaryPageSize = 256;
- typedef base::hash_map<int32, render_tree::GlyphIndex> CharacterToGlyphMap;
// The underlying SkTypeface that was used to create this typeface.
sk_sp<SkTypeface_Cobalt> typeface_;
@@ -73,7 +72,6 @@
// Thread checking is used to used to ensure that they are only accessed and
// modified on a single thread.
std::unique_ptr<render_tree::GlyphIndex[]> primary_page_character_glyphs_;
- CharacterToGlyphMap character_to_glyph_map_;
THREAD_CHECKER(character_glyph_thread_checker_);
};
diff --git a/src/cobalt/updater/updater_module.cc b/src/cobalt/updater/updater_module.cc
index db02d9a..8f5663f 100644
--- a/src/cobalt/updater/updater_module.cc
+++ b/src/cobalt/updater/updater_module.cc
@@ -105,7 +105,8 @@
if (updater_notification_ext_ != nullptr) {
updater_notification_ext_->UpdaterState(
ComponentStateToCobaltExtensionUpdaterNotificationState(
- crx_update_item_.state));
+ crx_update_item_.state),
+ GetCurrentEvergreenVersion().c_str());
}
} else {
status = "No status available";
diff --git a/src/starboard/android/apk/app/cobalt-ninja.sh b/src/starboard/android/apk/app/cobalt-ninja.sh
index 6dc1375..f1edba2 100755
--- a/src/starboard/android/apk/app/cobalt-ninja.sh
+++ b/src/starboard/android/apk/app/cobalt-ninja.sh
@@ -19,7 +19,6 @@
# https://cobalt.googlesource.com/cobalt/+/master/src/#Building-and-Running-the-Code
# Allow for a developer-specific environment setup from .cobaltrc
-# e.g., it may set DEPOT_TOOLS and/or setup some distributed build tools.
local_rc=$(dirname $0)/.cobaltrc
global_rc=${HOME}/.cobaltrc
if [ -r ${local_rc} ]; then
@@ -28,9 +27,6 @@
source ${global_rc}
fi
-# DEPOT_TOOLS may be set in .cobaltrc, otherwise assume it's in $HOME.
-[ -x ${DEPOT_TOOLS}/ninja ] || DEPOT_TOOLS=${HOME}/depot_tools
-
# Use Cobalt's clang if it's not anywhere earlier in the PATH.
SRC_DIR=$(cd $(dirname $0)/../../../..; pwd)
PATH=$PATH:${SRC_DIR}/third_party/llvm-build/Release+Asserts/bin
@@ -42,6 +38,4 @@
exit
fi
-# When running in CMake, depot_tools isn't in the path, so we have to be
-# explicit about which ninja to run. Fail if we didn't find depot_tools.
-exec ${DEPOT_TOOLS}/ninja "$@"
+exec ninja "$@"
diff --git a/src/starboard/android/apk/build.id b/src/starboard/android/apk/build.id
index ef01811..772184d 100644
--- a/src/starboard/android/apk/build.id
+++ b/src/starboard/android/apk/build.id
@@ -1 +1 @@
-301999
\ No newline at end of file
+302879
\ No newline at end of file
diff --git a/src/starboard/doc/c99.md b/src/starboard/doc/c99.md
new file mode 100644
index 0000000..e767002
--- /dev/null
+++ b/src/starboard/doc/c99.md
@@ -0,0 +1,4 @@
+<!--
+This file is required to exist by some tools but its contents are not used in
+21.lts.1+.
+-->
diff --git a/src/starboard/doc/evergreen/cobalt_evergreen_overview.md b/src/starboard/doc/evergreen/cobalt_evergreen_overview.md
index 247d19f..fe48bd6 100644
--- a/src/starboard/doc/evergreen/cobalt_evergreen_overview.md
+++ b/src/starboard/doc/evergreen/cobalt_evergreen_overview.md
@@ -120,7 +120,7 @@
Evergreen:
* `kSbSystemPathStorageDirectory`
- * Dedidated location for storing Cobalt Evergreen-related binaries
+ * Dedicated location for storing Cobalt Evergreen-related binaries
* This path must be writable and have at least 96MB of reserved space for
Evergreen updates. Please see the “Platforms Requirements” section below
for more details.
@@ -403,7 +403,7 @@
│ └── app
│ └── cobalt <--(SLOT_0)
│ ├── content <--(relative path defined in kSystemImageContentPath)
-│ │ ├── fonts <--(`minimal` configuration)
+│ │ ├── fonts <--(`empty` configuration)
│ │ ├── (icu) <--(only present when it needs to be updated by Cobalt Update)
│ │ ├── licenses
│ │ ├── ssl
@@ -424,7 +424,7 @@
├── installation_1 <--(SLOT_1 - currently unused)
├── installation_2 <--(SLOT_2 - contains new Cobalt version)
│ ├── content
- │ │ ├── fonts <--(`minimal` configuration)
+ │ │ ├── fonts <--(`empty` configuration)
│ │ ├── (icu) <--(only present when it needs to be updated by Cobalt Update)
│ │ ├── licenses
│ │ ├── ssl
@@ -460,13 +460,13 @@
the system font directory and setting the `cobalt_font_package` to `standard` or
`limited` in your port.
-Cobalt Evergreen (built by Google), will by default use the `minimal` font
-package which is around 16KB to minimize storage requirements. A separate
-`cobalt_font_package` variable is set to `minimal` in the Evergreen platform.
+Cobalt Evergreen (built by Google), will by default use the `empty` font
+package to minimize storage requirements. A separate
+`cobalt_font_package` variable is set to `empty` in the Evergreen platform.
On Raspberry Pi this is:
-`minimal` set of fonts under:
+`empty` set of fonts under:
```
<kSbSystemPathContentDirectory>/app/cobalt/content/fonts
```
diff --git a/src/starboard/elf_loader/program_table.cc b/src/starboard/elf_loader/program_table.cc
index bab921d..425c16d 100644
--- a/src/starboard/elf_loader/program_table.cc
+++ b/src/starboard/elf_loader/program_table.cc
@@ -65,7 +65,8 @@
SB_DLOG(INFO) << "elf_header->e_phnum=" << elf_header->e_phnum;
Addr page_min = PAGE_START(elf_header->e_phoff);
- Addr page_max = PAGE_END(elf_header->e_phoff + (phdr_num_ * elf_header->e_phentsize));
+ Addr page_max =
+ PAGE_END(elf_header->e_phoff + (phdr_num_ * elf_header->e_phentsize));
Addr page_offset = PAGE_OFFSET(elf_header->e_phoff);
SB_DLOG(INFO) << "page_min=" << page_min;
@@ -379,7 +380,7 @@
void ProgramTable::PublishEvergreenInfo(const char* file_path) {
EvergreenInfo evergreen_info;
- SbMemorySet(&evergreen_info, sizeof(EvergreenInfo), 0);
+ SbMemorySet(&evergreen_info, 0, sizeof(EvergreenInfo));
SbStringCopy(evergreen_info.file_path_buf, file_path,
EVERGREEN_FILE_PATH_MAX_SIZE);
evergreen_info.base_address = base_memory_address_;
diff --git a/src/starboard/elf_loader/sandbox.cc b/src/starboard/elf_loader/sandbox.cc
index 05f4098..55cc559 100644
--- a/src/starboard/elf_loader/sandbox.cc
+++ b/src/starboard/elf_loader/sandbox.cc
@@ -80,7 +80,7 @@
SB_LOG(ERROR) << "Failed to get user agent string";
} else {
CrashpadAnnotations cobalt_version_info;
- SbMemorySet(&cobalt_version_info, sizeof(CrashpadAnnotations), 0);
+ SbMemorySet(&cobalt_version_info, 0, sizeof(CrashpadAnnotations));
SbStringCopy(cobalt_version_info.user_agent_string, get_user_agent_func(),
USER_AGENT_STRING_MAX_SIZE);
third_party::crashpad::wrapper::AddAnnotationsToCrashpad(
diff --git a/src/starboard/loader_app/loader_app.cc b/src/starboard/loader_app/loader_app.cc
index 489d214..c5c92a5 100644
--- a/src/starboard/loader_app/loader_app.cc
+++ b/src/starboard/loader_app/loader_app.cc
@@ -126,7 +126,7 @@
SB_LOG(ERROR) << "Failed to get user agent string";
} else {
CrashpadAnnotations cobalt_version_info;
- SbMemorySet(&cobalt_version_info, sizeof(CrashpadAnnotations), 0);
+ SbMemorySet(&cobalt_version_info, 0, sizeof(CrashpadAnnotations));
SbStringCopy(cobalt_version_info.user_agent_string, get_user_agent_func(),
USER_AGENT_STRING_MAX_SIZE);
third_party::crashpad::wrapper::AddAnnotationsToCrashpad(
diff --git a/src/starboard/loader_app/slot_management.cc b/src/starboard/loader_app/slot_management.cc
index 0639e7d..aef6c5e 100644
--- a/src/starboard/loader_app/slot_management.cc
+++ b/src/starboard/loader_app/slot_management.cc
@@ -267,7 +267,7 @@
SB_LOG(ERROR) << "Failed to get user agent string";
} else {
CrashpadAnnotations cobalt_version_info;
- SbMemorySet(&cobalt_version_info, sizeof(CrashpadAnnotations), 0);
+ SbMemorySet(&cobalt_version_info, 0, sizeof(CrashpadAnnotations));
SbStringCopy(cobalt_version_info.user_agent_string, get_user_agent_func(),
USER_AGENT_STRING_MAX_SIZE);
third_party::crashpad::wrapper::AddAnnotationsToCrashpad(
diff --git a/src/starboard/nplb/nplb_evergreen_compat_tests/fonts_test.cc b/src/starboard/nplb/nplb_evergreen_compat_tests/fonts_test.cc
index df9ba2b..091a496 100644
--- a/src/starboard/nplb/nplb_evergreen_compat_tests/fonts_test.cc
+++ b/src/starboard/nplb/nplb_evergreen_compat_tests/fonts_test.cc
@@ -36,9 +36,15 @@
std::vector<char> system_fonts_dir(kSbFileMaxPath);
ASSERT_TRUE(SbSystemGetPath(kSbSystemPathFontDirectory,
system_fonts_dir.data(), kSbFileMaxPath));
-
ASSERT_TRUE(SbFileExists(system_fonts_dir.data()));
- std::string fonts_descriptor_file = system_fonts_dir.data();
+}
+
+TEST(FontsTest, VerifySystemFontsConfigDirectory) {
+ std::vector<char> system_fonts_conf_dir(kSbFileMaxPath);
+ ASSERT_TRUE(SbSystemGetPath(kSbSystemPathFontConfigurationDirectory,
+ system_fonts_conf_dir.data(), kSbFileMaxPath));
+ ASSERT_TRUE(SbFileExists(system_fonts_conf_dir.data()));
+ std::string fonts_descriptor_file = system_fonts_conf_dir.data();
fonts_descriptor_file += kSbFileSepString;
fonts_descriptor_file += kFileName;
ASSERT_TRUE(SbFileExists(fonts_descriptor_file.c_str()));
diff --git a/src/starboard/raspi/shared/dispmanx_util.cc b/src/starboard/raspi/shared/dispmanx_util.cc
index 906cfb0..e26dab4 100644
--- a/src/starboard/raspi/shared/dispmanx_util.cc
+++ b/src/starboard/raspi/shared/dispmanx_util.cc
@@ -14,6 +14,8 @@
#include "starboard/raspi/shared/dispmanx_util.h"
+#include <utility>
+
#include "starboard/common/scoped_ptr.h"
#include "starboard/memory.h"
@@ -91,8 +93,8 @@
void DispmanxYUV420Resource::ClearWithBlack() {
scoped_array<uint8_t> data(new uint8_t[width() * height() * 3 / 2]);
- SbMemorySet(data.get(), width() * height(), 0);
- SbMemorySet(data.get() + width() * height(), width() * height() / 2, 0x80);
+ SbMemorySet(data.get(), 0, width() * height());
+ SbMemorySet(data.get() + width() * height(), 0x80, width() * height() / 2);
WriteData(data.get());
}
@@ -108,7 +110,7 @@
void DispmanxRGB565Resource::ClearWithBlack() {
scoped_array<uint8_t> data(new uint8_t[width() * height() * 2]);
- SbMemorySet(data.get(), width() * height() * 2, 0);
+ SbMemorySet(data.get(), 0, width() * height() * 2);
WriteData(data.get());
}