blob: 0c0750caa16fb3b9d3d1a8871d8c8dfb75042cb5 [file] [log] [blame]
// Copyright 2017 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.
#include "third_party/blink/renderer/core/css/properties/longhands/font_size_adjust.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h"
#include "third_party/blink/renderer/core/css/properties/computed_style_utils.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
namespace css_longhand {
const CSSValue* FontSizeAdjust::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
DCHECK(RuntimeEnabledFeatures::CSSFontSizeAdjustEnabled());
if (range.Peek().Id() == CSSValueID::kNone)
return css_property_parser_helpers::ConsumeIdent(range);
return css_property_parser_helpers::ConsumeNumber(range,
kValueRangeNonNegative);
}
const CSSValue* FontSizeAdjust::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject*,
Node* styled_node,
bool allow_visited_style) const {
if (style.HasFontSizeAdjust()) {
return CSSPrimitiveValue::Create(style.FontSizeAdjust(),
CSSPrimitiveValue::UnitType::kNumber);
}
return CSSIdentifierValue::Create(CSSValueID::kNone);
}
} // namespace css_longhand
} // namespace blink