CSS font-display can't be used with third party font services because the developers don't necessarily have access to the @font-face definitions. This can be solved by implementing: https://www.w3.org/TR/css-fonts-4/#font-display-font-feature-values
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5 commit 234fc1b55d82694a89ca31cd4b36b5a47da2d0e5 Author: Kunihiko Sakamoto <ksakamoto@chromium.org> Date: Fri Dec 22 06:40:08 2017 Update fallback font visibility on FontFace.display change This patch lets RemoteFontFaceSource recalculate font display period when the FontFace's display attribute is changed. This gives a workaround for crbug.com/777846, allowing developers to monkey patch font faces from third party font services. Bug: 682117, 762957, 777846 Change-Id: Ic25392b2d1bd240015e51cda52896415373afa97 Reviewed-on: https://chromium-review.googlesource.com/828227 Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Cr-Commit-Position: refs/heads/master@{#525947} [add] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-display/font-display-change-ref.html [add] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-display/font-display-change.html [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/LayoutTests/external/wpt/lint.whitelist [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/Source/core/css/CSSFontFace.cpp [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/Source/core/css/CSSFontFace.h [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/Source/core/css/CSSFontFaceSource.h [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/Source/core/css/FontFace.cpp [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp [modify] https://crrev.com/234fc1b55d82694a89ca31cd4b36b5a47da2d0e5/third_party/WebKit/Source/core/css/RemoteFontFaceSource.h
Default font-display in @font-feature-values will resolve this issue. (Thanks Rune for working on this!) https://groups.google.com/a/chromium.org/d/msg/blink-dev/C6taiCkYayU/hlKC-v0GCQAJ
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5d39943cf7bd8db8aa1f874f3444affca39e408f commit 5d39943cf7bd8db8aa1f874f3444affca39e408f Author: Rune Lillesveen <futhark@chromium.org> Date: Tue Nov 27 09:54:53 2018 @font-feature-values with default font-display This CL implements support for specifying a default value for font-display for @font-face rules which do not provide a font-display descriptor. See spec [1]. The implementation is currently behind a flag which is off by default (not tested, not in experimental). For intent-to-implement, see [4]. There is a question if we should mix descriptors with @-rules in @font-feature-values because an unrecognized descriptor would be seen as part of the following rule as the start of a qualified ruled which means forward-compatibility could break. Also, there is a question if this is a font feature value and should be added to that @-rule at all. Both these issue are discussed/mentioned in [2]. Since using a descriptor directly in @font-feature values is not compatible with Gecko, we're wrapping the font-display descriptor in a block with no prelude for now. Note that the default font-display cannot currently apply to fonts loaded by FontFace.load() because the dictionary passed to FontFace have default values which effectively overrides any @font-feature-values descriptors[3]. [1] https://drafts.csswg.org/css-fonts-4/#font-display-font-feature-values [2] https://github.com/w3c/csswg-drafts/issues/2973 [3] https://github.com/w3c/csswg-drafts/issues/3188 [4] https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/C6taiCkYayU Bug: 777846 Change-Id: I290f23e7489afeef64812d7604417268c2464455 Reviewed-on: https://chromium-review.googlesource.com/c/1222966 Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/master@{#611056} [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/public/platform/web_feature.mojom [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/core_idl_files.gni [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/BUILD.gn [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/css_font_face_source.h [add] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/css_font_feature_values_rule.cc [add] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/css_font_feature_values_rule.h [add] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/css_font_feature_values_rule.idl [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/css_rule.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/css_rule.idl [add] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/font_display.cc [add] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/font_display.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/font_face.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/font_face.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/parser/css_at_rule_id.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/parser/css_at_rule_id.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/parser/css_parser_impl.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/parser/css_parser_impl.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/remote_font_face_source.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/rule_set.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/rule_set.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/style_engine.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/style_engine.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/style_engine_test.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/style_rule.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/style_rule.h [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/css/style_sheet_contents.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/frame/frame_serializer.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/third_party/blink/renderer/platform/runtime_enabled_features.json5 [modify] https://crrev.com/5d39943cf7bd8db8aa1f874f3444affca39e408f/tools/metrics/histograms/enums.xml
Comment 1 by kenjibaheux@chromium.org
, Dec 14 2017