chromium/third_party/blink/renderer/core/css/resolver/style_cascade_test.cc

// Copyright 2019 The Chromium Authors
// 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/resolver/style_cascade.h"

#include <vector>

#include "third_party/blink/renderer/bindings/core/v8/v8_css_style_sheet_init.h"
#include "third_party/blink/renderer/core/animation/css/css_animations.h"
#include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/css/active_style_sheets.h"
#include "third_party/blink/renderer/core/css/css_appearance_auto_base_select_value_pair.h"
#include "third_party/blink/renderer/core/css/css_flip_revert_value.h"
#include "third_party/blink/renderer/core/css/css_identifier_value.h"
#include "third_party/blink/renderer/core/css/css_initial_color_value.h"
#include "third_party/blink/renderer/core/css/css_pending_substitution_value.h"
#include "third_party/blink/renderer/core/css/css_primitive_value.h"
#include "third_party/blink/renderer/core/css/css_revert_value.h"
#include "third_party/blink/renderer/core/css/css_test_helpers.h"
#include "third_party/blink/renderer/core/css/css_unparsed_declaration_value.h"
#include "third_party/blink/renderer/core/css/document_style_environment_variables.h"
#include "third_party/blink/renderer/core/css/document_style_sheet_collection.h"
#include "third_party/blink/renderer/core/css/media_query_evaluator.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_local_context.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser.h"
#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h"
#include "third_party/blink/renderer/core/css/parser/css_variable_parser.h"
#include "third_party/blink/renderer/core/css/properties/css_property_instances.h"
#include "third_party/blink/renderer/core/css/properties/css_property_ref.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/css/properties/longhands/custom_property.h"
#include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/resolver/cascade_filter.h"
#include "third_party/blink/renderer/core/css/resolver/cascade_interpolations.h"
#include "third_party/blink/renderer/core/css/resolver/cascade_map.h"
#include "third_party/blink/renderer/core/css/resolver/cascade_priority.h"
#include "third_party/blink/renderer/core/css/resolver/cascade_resolver.h"
#include "third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/css/style_sheet_contents.h"
#include "third_party/blink/renderer/core/execution_context/security_context.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
#include "third_party/blink/renderer/core/testing/color_scheme_helper.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

namespace blink {

ParseDeclarationBlock;
RegisterProperty;
Origin;
Priority;
UnitType;

class TestCascadeResolver {};

struct AddOptions {};

class TestCascade {};

class TestCascadeAutoLock {};

class StyleCascadeTest : public PageTestBase {};

TEST_F(StyleCascadeTest, ApplySingle) {}

TEST_F(StyleCascadeTest, ApplyImportance) {}

TEST_F(StyleCascadeTest, ApplyAll) {}

TEST_F(StyleCascadeTest, ApplyAllImportance) {}

TEST_F(StyleCascadeTest, ApplyAllWithPhysicalLonghands) {}

TEST_F(StyleCascadeTest, ApplyCustomProperty) {}

TEST_F(StyleCascadeTest, ApplyGenerations) {}

TEST_F(StyleCascadeTest, ApplyCustomPropertyVar) {}

TEST_F(StyleCascadeTest, InvalidVarReferenceCauseInvalidVariable) {}

TEST_F(StyleCascadeTest, ApplyCustomPropertyFallback) {}

TEST_F(StyleCascadeTest, RegisteredPropertyFallback) {}

TEST_F(StyleCascadeTest, RegisteredPropertyFallbackValidation) {}

TEST_F(StyleCascadeTest, VarInFallback) {}

TEST_F(StyleCascadeTest, VarReferenceInNormalProperty) {}

TEST_F(StyleCascadeTest, MultipleVarRefs) {}

TEST_F(StyleCascadeTest, RegisteredPropertyComputedValue) {}

TEST_F(StyleCascadeTest, RegisteredPropertySyntaxErrorCausesInitial) {}

TEST_F(StyleCascadeTest, RegisteredPropertySubstitution) {}

TEST_F(StyleCascadeTest, RegisteredPropertyChain) {}

TEST_F(StyleCascadeTest, BasicShorthand) {}

TEST_F(StyleCascadeTest, BasicVarShorthand) {}

TEST_F(StyleCascadeTest, ApplyingPendingSubstitutionFirst) {}

TEST_F(StyleCascadeTest, ApplyingPendingSubstitutionLast) {}

TEST_F(StyleCascadeTest, PendingSubstitutionInLogicalShorthand) {}

TEST_F(StyleCascadeTest, DetectCycleByName) {}

TEST_F(StyleCascadeTest, ResolverDetectCycle) {}

TEST_F(StyleCascadeTest, ResolverDetectNoCycle) {}

TEST_F(StyleCascadeTest, ResolverDetectCycleSelf) {}

TEST_F(StyleCascadeTest, ResolverDetectMultiCycle) {}

TEST_F(StyleCascadeTest, ResolverDetectMultiCycleReverse) {}

TEST_F(StyleCascadeTest, CurrentProperty) {}

TEST_F(StyleCascadeTest, CycleWithExtraEdge) {}

TEST_F(StyleCascadeTest, BasicCycle) {}

TEST_F(StyleCascadeTest, SelfCycle) {}

TEST_F(StyleCascadeTest, SelfCycleInFallback) {}

TEST_F(StyleCascadeTest, SelfCycleInUnusedFallback) {}

TEST_F(StyleCascadeTest, LongCycle) {}

TEST_F(StyleCascadeTest, PartialCycle) {}

TEST_F(StyleCascadeTest, VarCycleViaFallback) {}

TEST_F(StyleCascadeTest, FallbackTriggeredByCycle) {}

TEST_F(StyleCascadeTest, RegisteredCycle) {}

TEST_F(StyleCascadeTest, UniversalSyntaxCycle) {}

TEST_F(StyleCascadeTest, PartiallyRegisteredCycle) {}

TEST_F(StyleCascadeTest, ReferencedRegisteredCycle) {}

TEST_F(StyleCascadeTest, CycleStillInvalidWithFallback) {}

TEST_F(StyleCascadeTest, CycleInFallbackStillInvalid) {}

TEST_F(StyleCascadeTest, CycleMultiple) {}

TEST_F(StyleCascadeTest, CycleMultipleFallback) {}

TEST_F(StyleCascadeTest, CycleMultipleUnusedFallback) {}

TEST_F(StyleCascadeTest, CycleReferencedFromStandardProperty) {}

TEST_F(StyleCascadeTest, CycleReferencedFromShorthand) {}

TEST_F(StyleCascadeTest, EmUnit) {}

TEST_F(StyleCascadeTest, EmUnitCustomProperty) {}

TEST_F(StyleCascadeTest, EmUnitNonCycle) {}

TEST_F(StyleCascadeTest, EmUnitCycle) {}

TEST_F(StyleCascadeTest, SubstitutingEmCycles) {}

TEST_F(StyleCascadeTest, RemUnit) {}

TEST_F(StyleCascadeTest, RemUnitCustomProperty) {}

TEST_F(StyleCascadeTest, RemUnitInFontSize) {}

TEST_F(StyleCascadeTest, RemUnitInRootFontSizeCycle) {}

TEST_F(StyleCascadeTest, RemUnitInRootFontSizeNonCycle) {}

TEST_F(StyleCascadeTest, Initial) {}

TEST_F(StyleCascadeTest, Inherit) {}

TEST_F(StyleCascadeTest, Unset) {}

TEST_F(StyleCascadeTest, RevertUA) {}

TEST_F(StyleCascadeTest, RevertStandardProperty) {}

TEST_F(StyleCascadeTest, RevertCustomProperty) {}

TEST_F(StyleCascadeTest, RevertChain) {}

TEST_F(StyleCascadeTest, RevertFromAuthorToUA) {}

TEST_F(StyleCascadeTest, RevertInitialFallback) {}

TEST_F(StyleCascadeTest, RevertInheritedFallback) {}

TEST_F(StyleCascadeTest, RevertRegistered) {}

TEST_F(StyleCascadeTest, RevertRegisteredInitialFallback) {}

TEST_F(StyleCascadeTest, RevertRegisteredInheritedFallback) {}

TEST_F(StyleCascadeTest, RevertUASurrogate) {}

TEST_F(StyleCascadeTest, RevertWithImportantPhysical) {}

TEST_F(StyleCascadeTest, RevertWithImportantLogical) {}

TEST_F(StyleCascadeTest, RevertSurrogateChain) {}

TEST_F(StyleCascadeTest, RevertInKeyframe) {}

TEST_F(StyleCascadeTest, RevertToCustomPropertyInKeyframe) {}

TEST_F(StyleCascadeTest, RevertToCustomPropertyInKeyframeUnset) {}

TEST_F(StyleCascadeTest, RevertToCustomPropertyInKeyframeEmptyInherit) {}

TEST_F(StyleCascadeTest, RevertInKeyframeResponsive) {}

TEST_F(StyleCascadeTest, RevertToCycleInKeyframe) {}

TEST_F(StyleCascadeTest, RevertCausesTransition) {}

TEST_F(StyleCascadeTest, CSSWideKeywordsInFallbacks) {}

TEST_F(StyleCascadeTest, RegisteredInitial) {}

TEST_F(StyleCascadeTest, SubstituteRegisteredImplicitInitialValue) {}

TEST_F(StyleCascadeTest, SubstituteRegisteredUniversal) {}

TEST_F(StyleCascadeTest, SubstituteRegisteredUniversalInvalid) {}

TEST_F(StyleCascadeTest, SubstituteRegisteredUniversalInitial) {}

TEST_F(StyleCascadeTest, RegisteredExplicitInitial) {}

TEST_F(StyleCascadeTest, RegisteredExplicitInherit) {}

TEST_F(StyleCascadeTest, RegisteredExplicitUnset) {}

TEST_F(StyleCascadeTest, SubstituteAnimationTaintedInCustomProperty) {}

TEST_F(StyleCascadeTest, SubstituteAnimationTaintedInStandardProperty) {}

TEST_F(StyleCascadeTest, SubstituteAnimationTaintedInAnimationDelay) {}

TEST_F(StyleCascadeTest, SubstituteAnimationTaintedInAnimationProperty) {}

TEST_F(StyleCascadeTest, IndirectlyAnimationTainted) {}

TEST_F(StyleCascadeTest, AnimationTaintedFallback) {}

TEST_F(StyleCascadeTest, EnvMissingNestedVar) {}

TEST_F(StyleCascadeTest, EnvMissingNestedVarFallback) {}

TEST_F(StyleCascadeTest, EnvMissingFallback) {}

TEST_F(StyleCascadeTest, ValidEnv) {}

TEST_F(StyleCascadeTest, ValidEnvFallback) {}

TEST_F(StyleCascadeTest, ValidEnvInUnusedFallback) {}

TEST_F(StyleCascadeTest, ValidEnvInUsedFallback) {}

TEST_F(StyleCascadeTest, AnimationApplyFilter) {}

TEST_F(StyleCascadeTest, TransitionApplyFilter) {}

TEST_F(StyleCascadeTest, PendingKeyframeAnimation) {}

TEST_F(StyleCascadeTest, PendingKeyframeAnimationApply) {}

TEST_F(StyleCascadeTest, TransitionCausesInterpolationValue) {}

TEST_F(StyleCascadeTest, TransitionDetectedForChangedFontSize) {}

TEST_F(StyleCascadeTest, AnimatingVarReferences) {}

TEST_F(StyleCascadeTest, AnimateStandardProperty) {}

TEST_F(StyleCascadeTest, AnimateLogicalProperty) {}

TEST_F(StyleCascadeTest, AnimateLogicalPropertyWithLookup) {}

TEST_F(StyleCascadeTest, AuthorImportantWinOverAnimations) {}

TEST_F(StyleCascadeTest, TransitionsWinOverAuthorImportant) {}

TEST_F(StyleCascadeTest, EmRespondsToAnimatedFontSize) {}

TEST_F(StyleCascadeTest, AnimateStandardPropertyWithVar) {}

TEST_F(StyleCascadeTest, AnimateStandardShorthand) {}

TEST_F(StyleCascadeTest, AnimatedVisitedImportantOverride) {}

TEST_F(StyleCascadeTest, AnimatedVisitedHighPrio) {}

TEST_F(StyleCascadeTest, AnimatePendingSubstitutionValue) {}

TEST_F(StyleCascadeTest, ZoomCascadeOrder) {}

TEST_F(StyleCascadeTest, ZoomVsAll) {}

TEST_F(StyleCascadeTest, ZoomReversedCascadeOrder) {}

TEST_F(StyleCascadeTest, ZoomImportant) {}

TEST_F(StyleCascadeTest, ZoomExplicitDefault) {}

TEST_F(StyleCascadeTest, ZoomNoExplicitDefault) {}

TEST_F(StyleCascadeTest, WritingModeCascadeOrder) {}

TEST_F(StyleCascadeTest, WritingModeReversedCascadeOrder) {}

TEST_F(StyleCascadeTest, WritingModePriority) {}

TEST_F(StyleCascadeTest, RubyPositionCascadeOrder) {}

TEST_F(StyleCascadeTest, RubyPositionReverseCascadeOrder) {}

TEST_F(StyleCascadeTest, RubyPositionSurrogateCanCascadeAsOriginal) {}

TEST_F(StyleCascadeTest, TextOrientationPriority) {}

TEST_F(StyleCascadeTest, TextOrientationRevert) {}

TEST_F(StyleCascadeTest, TextOrientationLegacyKeyword) {}

TEST_F(StyleCascadeTest, WebkitBorderImageCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitBorderImageReverseCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitBorderImageMixedOrder) {}

TEST_F(StyleCascadeTest, WebkitPerspectiveOriginCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitPerspectiveOriginReverseCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitPerspectiveOriginMixedCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitPerspectiveOriginRevert) {}

TEST_F(StyleCascadeTest, WebkitTransformOriginCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitTransformOriginReverseCascadeOrder) {}

TEST_F(StyleCascadeTest, WebkitTransformOriginMixedCascadeOrder) {}

TEST_F(StyleCascadeTest, VerticalAlignBaselineSource) {}

TEST_F(StyleCascadeTest, VerticalAlignBaselineSourceReversed) {}

TEST_F(StyleCascadeTest, WebkitBoxDecorationBreakOverlap) {}

TEST_F(StyleCascadeTest, WebkitBoxDecorationBreakOverlapReverse) {}

TEST_F(StyleCascadeTest, InitialDirection) {}

TEST_F(StyleCascadeTest, NonInitialDirection) {}

TEST_F(StyleCascadeTest, InitialWritingMode) {}

TEST_F(StyleCascadeTest, NonInitialWritingMode) {}

TEST_F(StyleCascadeTest, InitialTextSizeAdjust) {}

TEST_F(StyleCascadeTest, NonInitialTextSizeAdjust) {}

TEST_F(StyleCascadeTest, DoesNotDependOnCascadeAffectingProperty) {}

TEST_F(StyleCascadeTest, DependsOnCascadeAffectingProperty) {}

TEST_F(StyleCascadeTest, ResetDependsOnCascadeAffectingPropertyFlag) {}

TEST_F(StyleCascadeTest, MarkReferenced) {}

TEST_F(StyleCascadeTest, MarkHasVariableReferenceLonghand) {}

TEST_F(StyleCascadeTest, MarkHasVariableReferenceShorthand) {}

TEST_F(StyleCascadeTest, MarkHasVariableReferenceLonghandMissingVar) {}

TEST_F(StyleCascadeTest, MarkHasVariableReferenceShorthandMissingVar) {}

TEST_F(StyleCascadeTest, NoMarkHasVariableReferenceInherited) {}

TEST_F(StyleCascadeTest, NoMarkHasVariableReferenceWithoutVar) {}

TEST_F(StyleCascadeTest, InternalVisitedColorLonghand) {}

TEST_F(StyleCascadeTest, VarInInternalVisitedColorShorthand) {}

TEST_F(StyleCascadeTest, ApplyWithFilter) {}

TEST_F(StyleCascadeTest, FilterWebkitBorderImage) {}

TEST_F(StyleCascadeTest, FilterPerspectiveOrigin) {}

TEST_F(StyleCascadeTest, FilterTransformOrigin) {}

TEST_F(StyleCascadeTest, HasAuthorBackground) {}

TEST_F(StyleCascadeTest, HasAuthorBorder) {}

TEST_F(StyleCascadeTest, HasAuthorBorderLogical) {}

TEST_F(StyleCascadeTest, NoAuthorBackgroundOrBorder) {}

TEST_F(StyleCascadeTest, AuthorBackgroundRevert) {}

TEST_F(StyleCascadeTest, AuthorBorderRevert) {}

TEST_F(StyleCascadeTest, AuthorBorderRevertLogical) {}

TEST_F(StyleCascadeTest, AnalyzeMatchResult) {}

TEST_F(StyleCascadeTest, AnalyzeMatchResultAll) {}

TEST_F(StyleCascadeTest, AnalyzeFlagsClean) {}

TEST_F(StyleCascadeTest, ApplyMatchResultFilter) {}

TEST_F(StyleCascadeTest, ApplyMatchResultAllFilter) {}

TEST_F(StyleCascadeTest, MarkHasReferenceLonghand) {}

TEST_F(StyleCascadeTest, MarkHasReferenceShorthand) {}

TEST_F(StyleCascadeTest, NoMarkHasReferenceForInherited) {}

TEST_F(StyleCascadeTest, Reset) {}

TEST_F(StyleCascadeTest, GetImportantSetEmpty) {}

TEST_F(StyleCascadeTest, GetImportantSetSingle) {}

TEST_F(StyleCascadeTest, GetImportantSetMany) {}

TEST_F(StyleCascadeTest, RootColorNotModifiedByEmptyCascade) {}

TEST_F(StyleCascadeTest, InitialColor) {}

TEST_F(StyleCascadeTest, MaxVariableBytes) {}

TEST_F(StyleCascadeTest, UnicodeEscapeInCustomProperty) {}

TEST_F(StyleCascadeTest, GetCascadedValues) {}

TEST_F(StyleCascadeTest, GetCascadedValuesCssWide) {}

TEST_F(StyleCascadeTest, GetCascadedValuesLogical) {}

TEST_F(StyleCascadeTest, GetCascadedValuesInterpolated) {}

TEST_F(StyleCascadeTest, GetCascadedValuesWithExplicitDefaults) {}

TEST_F(StyleCascadeTest, StaticResolveNoVar) {}

TEST_F(StyleCascadeTest, StaticResolveVar) {}

TEST_F(StyleCascadeTest, StaticResolveRegisteredVar) {}

TEST_F(StyleCascadeTest, RevertOrigin) {}

TEST_F(StyleCascadeTest, FlipRevertValue_Swap) {}

TEST_F(StyleCascadeTest, FlipRevertValue_Chain) {}

TEST_F(StyleCascadeTest, FlipRevertValue_Asymmetric) {}

TEST_F(StyleCascadeTest, FlipRevertValue_DifferentOrigins) {}

TEST_F(StyleCascadeTest, FlipRevertValue_Overwritten) {}

TEST_F(StyleCascadeTest, InlineStyleWonCascade) {}

TEST_F(StyleCascadeTest, InlineStyleLostCascade) {}

TEST_F(StyleCascadeTest, TryStyle) {}

TEST_F(StyleCascadeTest, TryTacticsStyle) {}

TEST_F(StyleCascadeTest, TryTacticsStyleRevertLayer) {}

TEST_F(StyleCascadeTest, TryTacticsStyleRevertTo) {}

TEST_F(StyleCascadeTest, RevertToAnchor) {}

TEST_F(StyleCascadeTest, RevertToAnchorInvalid) {}

TEST_F(StyleCascadeTest, RevertLayerToAnchor) {}

TEST_F(StyleCascadeTest, RevertLayerToAnchorInvalid) {}

TEST_F(StyleCascadeTest, VarInAnchor) {}

TEST_F(StyleCascadeTest, VarInAnchorInvalid) {}

TEST_F(StyleCascadeTest, RevertToVarAnchor) {}

TEST_F(StyleCascadeTest, RevertToVarAnchorInvalid) {}

namespace {

// An AnchorEvaluator that responds to Mode::kTop only. This can be used to
// test what happens when a flip converts a top (valid) into a bottom
// (invalid).
class TopAnchorEvaluator : public AnchorEvaluator {};

}  // namespace

TEST_F(StyleCascadeTest, FlipToAnchorInvalid) {}

TEST_F(StyleCascadeTest, RevertInAppearanceAutoBaseSelectValue) {}

TEST_F(StyleCascadeTest, EnvInAppearanceAutoBaseSelectValue) {}

TEST_F(StyleCascadeTest, LhUnitCycle) {}

TEST_F(StyleCascadeTest, SubstitutingLhCycles) {}

TEST_F(StyleCascadeTest, CSSFunctionTrivial) {}

TEST_F(StyleCascadeTest, CSSFunctionWithArgument) {}

TEST_F(StyleCascadeTest, CSSFunctionWithTwoArguments) {}

TEST_F(StyleCascadeTest, CSSFunctionCallingOtherFunction) {}

TEST_F(StyleCascadeTest, CSSFunctionReturnTypeCoercion) {}

TEST_F(StyleCascadeTest, CSSFunctionImplicitCalc) {}

TEST_F(StyleCascadeTest, AffectedByCSSFunction) {}

TEST_F(StyleCascadeTest, CSSFunctionDoesNotExistInShorthand) {}

}  // namespace blink