CSSFontStyleValue.h [plain text]
#pragma once
#include "CSSPrimitiveValue.h"
#include "CSSValue.h"
#include "FontSelectionAlgorithm.h"
namespace WebCore {
class CSSFontStyleValue final : public CSSValue {
public:
static Ref<CSSFontStyleValue> create(Ref<CSSPrimitiveValue>&& fontStyleValue)
{
return adoptRef(*new CSSFontStyleValue(WTFMove(fontStyleValue), nullptr));
}
static Ref<CSSFontStyleValue> create(Ref<CSSPrimitiveValue>&& fontStyleValue, RefPtr<CSSPrimitiveValue>&& obliqueValue)
{
return adoptRef(*new CSSFontStyleValue(WTFMove(fontStyleValue), WTFMove(obliqueValue)));
}
String customCSSText() const;
bool equals(const CSSFontStyleValue&) const;
bool isItalicOrOblique() const
{
if (!obliqueValue) {
auto valueID = fontStyleValue->valueID();
return valueID == CSSValueItalic || valueID == CSSValueOblique;
}
return obliqueValue->value<float>(CSSPrimitiveValue::CSS_DEG) >= static_cast<float>(italicValue());
}
Ref<CSSPrimitiveValue> fontStyleValue;
RefPtr<CSSPrimitiveValue> obliqueValue;
private:
CSSFontStyleValue(Ref<CSSPrimitiveValue>&& fontStyleValue, RefPtr<CSSPrimitiveValue>&& obliqueValue)
: CSSValue(FontStyleClass)
, fontStyleValue(WTFMove(fontStyleValue))
, obliqueValue(WTFMove(obliqueValue))
{
}
};
}
SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSFontStyleValue, isFontStyleValue())