diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-26 13:57:00 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-11-02 11:31:01 +0000 |
commit | 1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch) | |
tree | 8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/third_party/blink/renderer/core/css/css_pending_system_font_value.h | |
parent | 21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff) | |
download | qtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz |
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css/css_pending_system_font_value.h')
-rw-r--r-- | chromium/third_party/blink/renderer/core/css/css_pending_system_font_value.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/css/css_pending_system_font_value.h b/chromium/third_party/blink/renderer/core/css/css_pending_system_font_value.h new file mode 100644 index 00000000000..d1687283166 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_pending_system_font_value.h @@ -0,0 +1,67 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PENDING_SYSTEM_FONT_VALUE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PENDING_SYSTEM_FONT_VALUE_H_ + +#include "third_party/blink/renderer/core/css/css_value.h" +#include "third_party/blink/renderer/core/css_value_keywords.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" + +namespace blink { + +class FontSelectionValue; + +namespace cssvalue { + +// The 'font' shorthand accepts some special system font values, like 'caption' +// (https://drafts.csswg.org/css-fonts/#valdef-font-caption). +// +// The resolution of these values into longhands is platform-dependent, and can +// also depend on user's settings, like the default font size. +// +// The CSS parser wouldn't be able to resolve these, since we need a |Document| +// in order to retrieve the settings, and |CSSParserContext::GetDocument()| +// would be null when system fonts are set in UA styles. +// +// So the parser sets all the font longhands to a |CSSPendingSystemFontValue|, +// and the resolution is deferred until computed-value time, when we can use +// |StyleResolverState::GetDocument()|. +class CSSPendingSystemFontValue : public CSSValue { + public: + static CSSPendingSystemFontValue* Create(CSSValueID); + + explicit CSSPendingSystemFontValue(CSSValueID); + + CSSValueID SystemFontId() const { return system_font_id_; } + + const FontSelectionValue& ResolveFontStyle() const; + const FontSelectionValue& ResolveFontWeight() const; + const AtomicString& ResolveFontFamily() const; + float ResolveFontSize(const Document*) const; + + bool Equals(const CSSPendingSystemFontValue& other) const { + return system_font_id_ == other.system_font_id_; + } + + String CustomCSSText() const; + + void TraceAfterDispatch(blink::Visitor*) const; + + private: + const CSSValueID system_font_id_; +}; + +} // namespace cssvalue + +template <> +struct DowncastTraits<cssvalue::CSSPendingSystemFontValue> { + static bool AllowFrom(const CSSValue& value) { + return value.IsPendingSystemFontValue(); + } +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PENDING_SYSTEM_FONT_VALUE_H_ |