chromium/third_party/blink/renderer/core/css/style_engine.cc

/*
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 1999 Antti Koivisto ([email protected])
 *           (C) 2001 Dirk Mueller ([email protected])
 *           (C) 2006 Alexey Proskuryakov ([email protected])
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
 * rights reserved.
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
 * (http://www.torchmobile.com/)
 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/css/style_engine.h"

#include "base/auto_reset.h"
#include "base/containers/adapters.h"
#include "base/hash/hash.h"
#include "base/ranges/algorithm.h"
#include "third_party/blink/public/mojom/timing/resource_timing.mojom-blink.h"
#include "third_party/blink/renderer/core/css/cascade_layer_map.h"
#include "third_party/blink/renderer/core/css/check_pseudo_has_cache_scope.h"
#include "third_party/blink/renderer/core/css/container_query_data.h"
#include "third_party/blink/renderer/core/css/container_query_evaluator.h"
#include "third_party/blink/renderer/core/css/counter_style_map.h"
#include "third_party/blink/renderer/core/css/css_default_style_sheets.h"
#include "third_party/blink/renderer/core/css/css_font_family_value.h"
#include "third_party/blink/renderer/core/css/css_font_selector.h"
#include "third_party/blink/renderer/core/css/css_style_sheet.h"
#include "third_party/blink/renderer/core/css/css_uri_value.h"
#include "third_party/blink/renderer/core/css/css_value_list.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/font_face_cache.h"
#include "third_party/blink/renderer/core/css/invalidation/invalidation_set.h"
#include "third_party/blink/renderer/core/css/media_feature_overrides.h"
#include "third_party/blink/renderer/core/css/media_values.h"
#include "third_party/blink/renderer/core/css/out_of_flow_data.h"
#include "third_party/blink/renderer/core/css/property_registration.h"
#include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h"
#include "third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope.h"
#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver_stats.h"
#include "third_party/blink/renderer/core/css/resolver/style_rule_usage_tracker.h"
#include "third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h"
#include "third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css/style_containment_scope_tree.h"
#include "third_party/blink/renderer/core/css/style_environment_variables.h"
#include "third_party/blink/renderer/core/css/style_rule_font_feature_values.h"
#include "third_party/blink/renderer/core/css/style_sheet_contents.h"
#include "third_party/blink/renderer/core/css/vision_deficiency.h"
#include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h"
#include "third_party/blink/renderer/core/dom/document_lifecycle.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/nth_index_cache.h"
#include "third_party/blink/renderer/core/dom/processing_instruction.h"
#include "third_party/blink/renderer/core/dom/scriptable_document_parser.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/frame/frame_owner.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/forms/html_field_set_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_element.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/html/html_html_element.h"
#include "third_party/blink/renderer/core/html/html_slot_element.h"
#include "third_party/blink/renderer/core/html/track/text_track.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/invalidation_set_to_selector_map.h"
#include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h"
#include "third_party/blink/renderer/core/layout/geometry/logical_size.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_size.h"
#include "third_party/blink/renderer/core/layout/layout_counter.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_theme.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/layout/list/layout_inline_list_item.h"
#include "third_party/blink/renderer/core/layout/list/layout_list_item.h"
#include "third_party/blink/renderer/core/loader/render_blocking_resource_manager.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/page_popup_controller.h"
#include "third_party/blink/renderer/core/preferences/preference_overrides.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/filter_operations.h"
#include "third_party/blink/renderer/core/style/style_initial_data.h"
#include "third_party/blink/renderer/core/svg/svg_resource.h"
#include "third_party/blink/renderer/core/view_transition/view_transition.h"
#include "third_party/blink/renderer/core/view_transition/view_transition_supplement.h"
#include "third_party/blink/renderer/core/view_transition/view_transition_utils.h"
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
#include "third_party/blink/renderer/platform/fonts/font_selector.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"

namespace blink {

namespace {

CSSFontSelector* CreateCSSFontSelectorFor(Document& document) {}

enum RuleSetFlags {};

const unsigned kRuleSetFlagsAll =;

unsigned GetRuleSetFlags(const HeapHashSet<Member<RuleSet>> rule_sets) {}

const Vector<AtomicString> ConvertFontFamilyToVector(const CSSValue* value) {}

}  // namespace

StyleEngine::StyleEngine(Document& document)
    :{}

StyleEngine::~StyleEngine() = default;

TreeScopeStyleSheetCollection& StyleEngine::EnsureStyleSheetCollectionFor(
    TreeScope& tree_scope) {}

TreeScopeStyleSheetCollection* StyleEngine::StyleSheetCollectionFor(
    TreeScope& tree_scope) {}

const HeapVector<Member<StyleSheet>>& StyleEngine::StyleSheetsForStyleSheetList(
    TreeScope& tree_scope) {}

void StyleEngine::InjectSheet(const StyleSheetKey& key,
                              StyleSheetContents* sheet,
                              WebCssOrigin origin) {}

void StyleEngine::RemoveInjectedSheet(const StyleSheetKey& key,
                                      WebCssOrigin origin) {}

CSSStyleSheet& StyleEngine::EnsureInspectorStyleSheet() {}

void StyleEngine::AddPendingBlockingSheet(Node& style_sheet_candidate_node,
                                          PendingSheetType type) {}

// This method is called whenever a top-level stylesheet has finished loading.
void StyleEngine::RemovePendingBlockingSheet(Node& style_sheet_candidate_node,
                                             PendingSheetType type) {}

void StyleEngine::SetNeedsActiveStyleUpdate(TreeScope& tree_scope) {}

void StyleEngine::AddStyleSheetCandidateNode(Node& node) {}

void StyleEngine::RemoveStyleSheetCandidateNode(
    Node& node,
    ContainerNode& insertion_point) {}

void StyleEngine::ModifiedStyleSheetCandidateNode(Node& node) {}

void StyleEngine::AdoptedStyleSheetAdded(TreeScope& tree_scope,
                                         CSSStyleSheet* sheet) {}

void StyleEngine::AdoptedStyleSheetRemoved(TreeScope& tree_scope,
                                           CSSStyleSheet* sheet) {}

void StyleEngine::MediaQueryAffectingValueChanged(TreeScope& tree_scope,
                                                  MediaValueChange change) {}

void StyleEngine::WatchedSelectorsChanged() {}

void StyleEngine::DocumentRulesSelectorsChanged() {}

bool StyleEngine::ShouldUpdateDocumentStyleSheetCollection() const {}

bool StyleEngine::ShouldUpdateShadowTreeStyleSheetCollection() const {}

void StyleEngine::MediaQueryAffectingValueChanged(
    UnorderedTreeScopeSet& tree_scopes,
    MediaValueChange change) {}

void StyleEngine::AddTextTrack(TextTrack* text_track) {}

void StyleEngine::RemoveTextTrack(TextTrack* text_track) {}

Element* StyleEngine::EnsureVTTOriginatingElement() {}

void StyleEngine::MediaQueryAffectingValueChanged(
    HeapHashSet<Member<TextTrack>>& text_tracks,
    MediaValueChange change) {}

void StyleEngine::MediaQueryAffectingValueChanged(MediaValueChange change) {}

void StyleEngine::UpdateActiveStyleSheetsInShadow(
    TreeScope* tree_scope,
    UnorderedTreeScopeSet& tree_scopes_removed) {}

void StyleEngine::UpdateActiveUserStyleSheets() {}

void StyleEngine::UpdateActiveStyleSheets() {}

void StyleEngine::UpdateCounterStyles() {}

void StyleEngine::MarkPositionTryStylesDirty(
    const HeapHashSet<Member<RuleSet>>& changed_rule_sets) {}

void StyleEngine::InvalidatePositionTryStyles() {}

void StyleEngine::UpdateViewport() {}

bool StyleEngine::NeedsActiveStyleUpdate() const {}

void StyleEngine::UpdateActiveStyle() {}

const ActiveStyleSheetVector StyleEngine::ActiveStyleSheetsForInspector() {}

void StyleEngine::UpdateCounters() {}

// Recursively look for potential LayoutCounters to update,
// since in case of ::marker they can be deep child of original
// pseudo element's layout object.
void StyleEngine::UpdateLayoutCounters(const Element& element,
                                       const LayoutObject& layout_object,
                                       CountersAttachmentContext& context) {}

void StyleEngine::UpdateCounters(const Element& element,
                                 CountersAttachmentContext& context) {}

void StyleEngine::ShadowRootInsertedToDocument(ShadowRoot& shadow_root) {}

void StyleEngine::ShadowRootRemovedFromDocument(ShadowRoot* shadow_root) {}

void StyleEngine::ResetAuthorStyle(TreeScope& tree_scope) {}

StyleContainmentScopeTree& StyleEngine::EnsureStyleContainmentScopeTree() {}

void StyleEngine::SetRuleUsageTracker(StyleRuleUsageTracker* tracker) {}

Font StyleEngine::ComputeFont(Element& element,
                              const ComputedStyle& font_style,
                              const CSSPropertyValueSet& font_properties) {}

RuleSet* StyleEngine::RuleSetForSheet(CSSStyleSheet& sheet) {}

RuleSet* StyleEngine::RuleSetScope::RuleSetForSheet(StyleEngine& engine,
                                                    CSSStyleSheet* css_sheet) {}

void StyleEngine::ClearResolvers() {}

void StyleEngine::DidDetach() {}

bool StyleEngine::ClearFontFaceCacheAndAddUserFonts(
    const ActiveStyleSheetVector& user_sheets) {}

void StyleEngine::UpdateGenericFontFamilySettings() {}

void StyleEngine::RemoveFontFaceRules(
    const HeapVector<Member<const StyleRuleFontFace>>& font_face_rules) {}

void StyleEngine::MarkTreeScopeDirty(TreeScope& scope) {}

void StyleEngine::MarkDocumentDirty() {}

void StyleEngine::MarkUserStyleDirty() {}

void StyleEngine::MarkViewportStyleDirty() {}

CSSStyleSheet* StyleEngine::CreateSheet(
    Element& element,
    const String& text,
    TextPosition start_position,
    PendingSheetType type,
    RenderBlockingBehavior render_blocking_behavior) {}

CSSStyleSheet* StyleEngine::ParseSheet(
    Element& element,
    const String& text,
    TextPosition start_position,
    RenderBlockingBehavior render_blocking_behavior) {}

void StyleEngine::CollectUserStyleFeaturesTo(RuleFeatureSet& features) const {}

void StyleEngine::CollectScopedStyleFeaturesTo(RuleFeatureSet& features) const {}

void StyleEngine::MarkViewportUnitDirty(ViewportUnitFlag flag) {}

namespace {

void SetNeedsStyleRecalcForViewportUnits(TreeScope& tree_scope,
                                         unsigned dirty_flags) {}

}  // namespace

void StyleEngine::InvalidateViewportUnitStylesIfNeeded() {}

void StyleEngine::InvalidateStyleAndLayoutForFontUpdates() {}

void StyleEngine::MarkFontsNeedUpdate() {}

void StyleEngine::MarkCounterStylesNeedUpdate() {}

void StyleEngine::FontsNeedUpdate(FontSelector*, FontInvalidationReason) {}

void StyleEngine::PlatformColorsChanged() {}

bool StyleEngine::ShouldSkipInvalidationFor(const Element& element) const {}

bool StyleEngine::IsSubtreeAndSiblingsStyleDirty(const Element& element) const {}

namespace {

bool PossiblyAffectingHasState(Element& element) {}

bool InsertionOrRemovalPossiblyAffectHasStateOfAncestorsOrAncestorSiblings(
    Element* parent) {}

bool InsertionOrRemovalPossiblyAffectHasStateOfPreviousSiblings(
    Element* previous_sibling) {}

inline Element* SelfOrPreviousSibling(Node* node) {}

}  // namespace

void PossiblyScheduleNthPseudoInvalidations(Node& node) {}

void StyleEngine::InvalidateElementAffectedByHas(
    Element& element,
    bool for_element_affected_by_pseudo_in_has) {}

// Context class to provide :has() invalidation traversal information.
//
// This class provides this information to the :has() invalidation traversal:
// - first element of the traversal.
// - flag to indicate whether the traversal moves to the parent of the first
//   element.
// - flag to indicate whether the :has() invalidation invalidates the elements
//   with AffectedByPseudoInHas flag set.
class StyleEngine::PseudoHasInvalidationTraversalContext {};

void StyleEngine::InvalidateAncestorsOrSiblingsAffectedByHas(
    const PseudoHasInvalidationTraversalContext& traversal_context) {}

void StyleEngine::InvalidateChangedElementAffectedByLogicalCombinationsInHas(
    Element& changed_element,
    bool for_element_affected_by_pseudo_in_has) {}

void StyleEngine::ClassChangedForElement(
    const SpaceSplitString& changed_classes,
    Element& element) {}

void StyleEngine::ClassChangedForElement(const SpaceSplitString& old_classes,
                                         const SpaceSplitString& new_classes,
                                         Element& element) {}

namespace {

bool HasAttributeDependentGeneratedContent(const Element& element) {}

bool HasAttributeDependentStyle(const Element& element) {}

}  // namespace

void StyleEngine::AttributeChangedForElement(
    const QualifiedName& attribute_name,
    Element& element) {}

void StyleEngine::IdChangedForElement(const AtomicString& old_id,
                                      const AtomicString& new_id,
                                      Element& element) {}

void StyleEngine::PseudoStateChangedForElement(
    CSSSelector::PseudoType pseudo_type,
    Element& element,
    bool invalidate_descendants_or_siblings,
    bool invalidate_ancestors_or_siblings) {}

void StyleEngine::PartChangedForElement(Element& element) {}

void StyleEngine::ExportpartsChangedForElement(Element& element) {}

void StyleEngine::ScheduleSiblingInvalidationsForElement(
    Element& element,
    ContainerNode& scheduling_parent,
    unsigned min_direct_adjacent) {}

void StyleEngine::ScheduleInvalidationsForInsertedSibling(
    Element* before_element,
    Element& inserted_element) {}

void StyleEngine::ScheduleInvalidationsForRemovedSibling(
    Element* before_element,
    Element& removed_element,
    Element& after_element) {}

void StyleEngine::ScheduleNthPseudoInvalidations(ContainerNode& nth_parent) {}

// Inserting/changing some types of rules cause invalidation even if they don't
// match, because the very act of evaluating them has side effects for the
// ComputedStyle. For instance, evaluating a rule with :hover will set the
// AffectedByHover() flag on ComputedStyle even if it matches (for
// invalidation). So we need to test for that here, and invalidate the element
// so that such rules are properly evaluated.
//
// We don't need to care specifically about @starting-style, but all other flags
// should probably be covered here.
static bool FlagsCauseInvalidation(const MatchResult& result) {}

static bool AnyRuleCausesInvalidation(const MatchRequest& match_request,
                                      ElementRuleCollector& collector,
                                      bool is_shadow_host) {}

namespace {

bool CanRejectRuleSet(ElementRuleCollector& collector,
                      const RuleSet& rule_set) {}

}  // namespace

// See if a given element needs to be recalculated after RuleSet changes
// (see ApplyRuleSetInvalidation()).
void StyleEngine::ApplyRuleSetInvalidationForElement(
    const TreeScope& tree_scope,
    Element& element,
    SelectorFilter& selector_filter,
    StyleScopeFrame& style_scope_frame,
    const HeapHashSet<Member<RuleSet>>& rule_sets,
    unsigned changed_rule_flags,
    bool is_shadow_host) {}

void StyleEngine::ScheduleCustomElementInvalidations(
    HashSet<AtomicString> tag_names) {}

void StyleEngine::ScheduleInvalidationsForHasPseudoAffectedByInsertion(
    Element* parent,
    Node* node_before_change,
    Element& inserted_element) {}

void StyleEngine::ScheduleInvalidationsForHasPseudoAffectedByRemoval(
    Element* parent,
    Node* node_before_change,
    Element& removed_element) {}

void StyleEngine::ScheduleInvalidationsForHasPseudoWhenAllChildrenRemoved(
    Element& parent) {}

void StyleEngine::InvalidateStyle() {}

void StyleEngine::InvalidateSlottedElements(
    HTMLSlotElement& slot,
    const StyleChangeReasonForTracing& reason) {}

bool StyleEngine::HasViewportDependentPropertyRegistrations() {}

// Given a list of RuleSets that have changed (both old and new), see what
// elements in the given TreeScope that could be affected by them and need
// style recalculation.
//
// This generally works by our regular selector matching; if any selector
// in any of the given RuleSets match, it means we need to mark the element
// for style recalc. This could either be because the element is affected
// by a rule where it wasn't before, or because the element used to be
// affected by some rule and isn't anymore, or even that the rule itself
// changed. (It could also be a false positive, e.g. because someone added
// a single new rule to a style sheet, causing a new RuleSet to be created
// that also contains all the old rules, and the element matches one of them.)
//
// There are some twists to this; e.g., for a rule like a:hover, we will need
// to invalidate all <a> elements whether they are currently matching :hover
// or not (see FlagsCauseInvalidation()).
//
// In general, we check all elements in this TreeScope and nothing else.
// There are some exceptions (in both directions); in particular, if an element
// is already marked for subtree recalc, we don't need to go below it. Also,
// if invalidation_scope says so, or if we have rules pertaining to UA shadows,
// we may need to descend into child TreeScopes.
void StyleEngine::ApplyRuleSetInvalidationForTreeScope(
    TreeScope& tree_scope,
    ContainerNode& node,
    SelectorFilter& selector_filter,
    StyleScopeFrame& style_scope_frame,
    const HeapHashSet<Member<RuleSet>>& rule_sets,
    unsigned changed_rule_flags,
    InvalidationScope invalidation_scope) {}

void StyleEngine::ApplyRuleSetInvalidationForSubtree(
    TreeScope& tree_scope,
    Element& element,
    SelectorFilter& selector_filter,
    StyleScopeFrame& parent_style_scope_frame,
    const HeapHashSet<Member<RuleSet>>& rule_sets,
    unsigned changed_rule_flags,
    InvalidationScope invalidation_scope,
    bool invalidate_slotted,
    bool invalidate_part) {}

void StyleEngine::SetStatsEnabled(bool enabled) {}

void StyleEngine::SetPreferredStylesheetSetNameIfNotSet(const String& name) {}

void StyleEngine::SetHttpDefaultStyle(const String& content) {}

void StyleEngine::CollectFeaturesTo(RuleFeatureSet& features) {}

void StyleEngine::EnsureUAStyleForFullscreen(const Element& element) {}

void StyleEngine::EnsureUAStyleForElement(const Element& element) {}

void StyleEngine::EnsureUAStyleForPseudoElement(PseudoId pseudo_id) {}

void StyleEngine::EnsureUAStyleForForcedColors() {}

RuleSet* StyleEngine::DefaultViewTransitionStyle() const {}

void StyleEngine::UpdateViewTransitionOptIn() {}

bool StyleEngine::HasRulesForId(const AtomicString& id) const {}

void StyleEngine::InitialStyleChanged() {}

void StyleEngine::ViewportStyleSettingChanged() {}

void StyleEngine::InvalidateForRuleSetChanges(
    TreeScope& tree_scope,
    const HeapHashSet<Member<RuleSet>>& changed_rule_sets,
    unsigned changed_rule_flags,
    InvalidationScope invalidation_scope) {}

void StyleEngine::InvalidateInitialData() {}

// A miniature CascadeMap for cascading @property at-rules according to their
// origin, cascade layer order and position.
class StyleEngine::AtRuleCascadeMap {};

void StyleEngine::ApplyUserRuleSetChanges(
    const ActiveStyleSheetVector& old_style_sheets,
    const ActiveStyleSheetVector& new_style_sheets) {}

void StyleEngine::ApplyRuleSetChanges(
    TreeScope& tree_scope,
    const ActiveStyleSheetVector& old_style_sheets,
    const ActiveStyleSheetVector& new_style_sheets,
    const HeapVector<Member<RuleSetDiff>>& diffs) {}

void StyleEngine::LoadVisionDeficiencyFilter() {}

void StyleEngine::VisionDeficiencyChanged() {}

void StyleEngine::ApplyVisionDeficiencyStyle(
    ComputedStyleBuilder& layout_view_style_builder) {}

const MediaQueryEvaluator& StyleEngine::EnsureMediaQueryEvaluator() {}

bool StyleEngine::StyleMaybeAffectedByLayout(const Node& node) {}

bool StyleEngine::UpdateRootFontRelativeUnits(
    const ComputedStyle* old_root_style,
    const ComputedStyle* new_root_style) {}

void StyleEngine::PropertyRegistryChanged() {}

void StyleEngine::EnvironmentVariableChanged() {}

void StyleEngine::NodeWillBeRemoved(Node& node) {}

void StyleEngine::ChildrenRemoved(ContainerNode& parent) {}

void StyleEngine::CollectMatchingUserRules(
    ElementRuleCollector& collector) const {}

void StyleEngine::ClearKeyframeRules() {}

void StyleEngine::ClearPropertyRules() {}

void StyleEngine::AddPropertyRulesFromSheets(
    AtRuleCascadeMap& cascade_map,
    const ActiveStyleSheetVector& sheets,
    bool is_user_style) {}

void StyleEngine::AddFontPaletteValuesRulesFromSheets(
    const ActiveStyleSheetVector& sheets) {}

bool StyleEngine::AddUserFontFaceRules(const RuleSet& rule_set) {}

void StyleEngine::AddUserKeyframeRules(const RuleSet& rule_set) {}

void StyleEngine::AddUserKeyframeStyle(StyleRuleKeyframes* rule) {}

bool StyleEngine::UserKeyframeStyleShouldOverride(
    const StyleRuleKeyframes* new_rule,
    const StyleRuleKeyframes* existing_rule) const {}

void StyleEngine::AddViewTransitionRules(const ActiveStyleSheetVector& sheets) {}

void StyleEngine::AddFontPaletteValuesRules(const RuleSet& rule_set) {}

void StyleEngine::AddPropertyRules(AtRuleCascadeMap& cascade_map,
                                   const RuleSet& rule_set,
                                   bool is_user_style) {}

StyleRuleKeyframes* StyleEngine::KeyframeStylesForAnimation(
    const AtomicString& animation_name) {}

StyleRuleFontPaletteValues* StyleEngine::FontPaletteValuesForNameAndFamily(
    AtomicString palette_name,
    AtomicString family_name) {}

DocumentStyleEnvironmentVariables& StyleEngine::EnsureEnvironmentVariables() {}

StyleInitialData* StyleEngine::MaybeCreateAndGetInitialData() {}

bool StyleEngine::RecalcHighlightStylesForContainer(Element& container) {}

#if DCHECK_IS_ON()
namespace {
bool ContainerStyleChangesAllowed(Element& container,
                                  const ComputedStyle* old_element_style,
                                  const ComputedStyle* old_layout_style) {}
}  // namespace
#endif  // DCHECK_IS_ON()

void StyleEngine::RecalcStyleForContainer(Element& container,
                                          StyleRecalcChange change) {}

void StyleEngine::UpdateStyleForNonEligibleContainer(Element& container) {}

void StyleEngine::UpdateStyleAndLayoutTreeForContainer(
    Element& container,
    const LogicalSize& logical_size,
    LogicalAxes contained_axes) {}

void StyleEngine::UpdateStyleForOutOfFlow(Element& element,
                                          const CSSPropertyValueSet* try_set,
                                          const TryTacticList& tactic_list,
                                          AnchorEvaluator* anchor_evaluator) {}

StyleRulePositionTry* StyleEngine::GetPositionTryRule(
    const ScopedCSSName& scoped_name) {}

void StyleEngine::RecalcStyle(StyleRecalcChange change,
                              const StyleRecalcContext& style_recalc_context) {}

void StyleEngine::RecalcPositionTryStyleForPseudoElement(
    PseudoElement& pseudo_element,
    const StyleRecalcChange style_recalc_change,
    const StyleRecalcContext& style_recalc_context) {}

void StyleEngine::RecalcTransitionPseudoStyle() {}

void StyleEngine::RecalcStyle() {}

void StyleEngine::ClearEnsuredDescendantStyles(Element& root) {}

void StyleEngine::RebuildLayoutTreeForTraversalRootAncestors(
    Element* parent,
    Element* container_parent) {}

void StyleEngine::RebuildLayoutTree(Element* size_container) {}

void StyleEngine::ReattachContainerSubtree(Element& container) {}

void StyleEngine::UpdateStyleAndLayoutTree() {}

void StyleEngine::ViewportDefiningElementDidChange() {}

void StyleEngine::FirstBodyElementChanged(HTMLBodyElement* body) {}

void StyleEngine::UpdateStyleInvalidationRoot(ContainerNode* ancestor,
                                              Node* dirty_node) {}

void StyleEngine::UpdateStyleRecalcRoot(ContainerNode* ancestor,
                                        Node* dirty_node) {}

void StyleEngine::UpdateLayoutTreeRebuildRoot(ContainerNode* ancestor,
                                              Node* dirty_node) {}

namespace {

Node* AnalysisParent(const Node& node) {}

bool IsRootOrSibling(const Node* root, const Node& node) {}

}  // namespace

StyleEngine::AncestorAnalysis StyleEngine::AnalyzeInclusiveAncestor(
    const Node& node) {}

StyleEngine::AncestorAnalysis StyleEngine::AnalyzeExclusiveAncestor(
    const Node& node) {}

StyleEngine::AncestorAnalysis StyleEngine::AnalyzeAncestors(const Node& node) {}

bool StyleEngine::MarkReattachAllowed() const {}

bool StyleEngine::MarkStyleDirtyAllowed() const {}

bool StyleEngine::SupportsDarkColorScheme() {}

void StyleEngine::UpdateColorScheme() {}

void StyleEngine::UpdateColorSchemeMetrics() {}

void StyleEngine::ColorSchemeChanged() {}

void StyleEngine::SetPageColorSchemes(const CSSValue* color_scheme) {}

void StyleEngine::UpdateColorSchemeBackground(bool color_scheme_changed) {}

void StyleEngine::SetOwnerColorScheme(
    mojom::blink::ColorScheme color_scheme,
    mojom::blink::PreferredColorScheme preferred_color_scheme) {}

mojom::blink::PreferredColorScheme StyleEngine::ResolveColorSchemeForEmbedding(
    const ComputedStyle* embedder_style) const {}

void StyleEngine::UpdateForcedBackgroundColor() {}

Color StyleEngine::ColorAdjustBackgroundColor() const {}

void StyleEngine::MarkAllElementsForStyleRecalc(
    const StyleChangeReasonForTracing& reason) {}

void StyleEngine::UpdateViewportStyle() {}

bool StyleEngine::NeedsFullStyleUpdate() const {}

void StyleEngine::PropagateWritingModeAndDirectionToHTMLRoot() {}

CounterStyleMap& StyleEngine::EnsureUserCounterStyleMap() {}

const CounterStyle& StyleEngine::FindCounterStyleAcrossScopes(
    const AtomicString& name,
    const TreeScope* scope) const {}

void StyleEngine::Trace(Visitor* visitor) const {}

namespace {

inline bool MayHaveFlatTreeChildren(const Element& element) {}

}  // namespace

void StyleEngine::MarkForLayoutTreeChangesAfterDetach() {}

void StyleEngine::InvalidateSVGResourcesAfterDetach() {}

bool StyleEngine::AllowSkipStyleRecalcForScope() const {}

void StyleEngine::AddCachedFillOrClipPathURIValue(const AtomicString& string,
                                                  const CSSValue& value) {}

const CSSValue* StyleEngine::GetCachedFillOrClipPathURIValue(
    const AtomicString& string) {}

void StyleEngine::BaseURLChanged() {}

void StyleEngine::UpdateViewportSize() {}

namespace {

bool UpdateLastSuccessfulPositionFallback(Element& element) {}

bool InvalidatePositionTryNames(Element* root,
                                const HashSet<AtomicString>& try_names) {}

}  // namespace

bool StyleEngine::UpdateLastSuccessfulPositionFallbacks() {}

void StyleEngine::RevisitActiveStyleSheetsForInspector() {}

void StyleEngine::RevisitStyleRulesForInspector(
    const RuleFeatureSet& features,
    const HeapVector<Member<StyleRuleBase>>& rules) {}

}  // namespace blink