blob: d5de80e82ed51fc94bc49b200f3791164d4f5799 [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/css_property_names.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
// A wrapper class containing all local context when parsing a property.
class CORE_EXPORT CSSParserLocalContext {
// When parsing registered custom properties, a different result is required
// depending on the context.
enum class VariableMode {
// The custom property is parsed according to the registered syntax (if
// available).
// The registration of the custom property (if any) is ignored; the custom
// property will parse as if unregistered.
// The custom property will be parsed as if unregistered (that is,
// a CSSCustomPropertyDeclaration will be returned), but the tokens must
// also match the registered syntax (if any). This is useful for CSSOM,
// where incoming values must validate against the registered syntax, but
// are otherwise treated as unregistered.
CSSParserLocalContext WithAliasParsing(bool) const;
CSSParserLocalContext WithAnimationTainted(bool) const;
CSSParserLocalContext WithCurrentShorthand(CSSPropertyID) const;
CSSParserLocalContext WithVariableMode(VariableMode) const;
bool UseAliasParsing() const;
// Any custom property used in a @keyframes rule becomes animation-tainted,
// which prevents the custom property from being substituted into the
// 'animation' property, or one of its longhands.
bool IsAnimationTainted() const;
CSSPropertyID CurrentShorthand() const;
VariableMode GetVariableMode() const;
bool use_alias_parsing_;
bool is_animation_tainted_;
CSSPropertyID current_shorthand_;
VariableMode variable_mode_;
} // namespace blink