Skip to content

Truly independent web browser

LibWeb: Remove unused generated content subtree checks

Shannon Booth3e6622881937
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 563bd03f39b..abf163153fc 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -57,7 +57,6 @@ set(SOURCES
CSS/ContainerQuery.cpp
CSS/CountersSet.cpp
CSS/CustomPropertyRegistration.cpp
- CSS/GeneratedContent.cpp
CSS/CSS.cpp
CSS/CSSDescriptors.cpp
CSS/CSSFontFaceRule.cpp
diff --git a/Libraries/LibWeb/CSS/GeneratedContent.cpp b/Libraries/LibWeb/CSS/GeneratedContent.cpp
deleted file mode 100644
index bca8e735d32..00000000000
--- a/Libraries/LibWeb/CSS/GeneratedContent.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibWeb/CSS/ComputedValues.h>
-#include <LibWeb/CSS/GeneratedContent.h>
-#include <LibWeb/DOM/Element.h>
-#include <LibWeb/DOM/Node.h>
-
-namespace Web::CSS {
-
-static bool subtree_has_generated_content_facts(DOM::Node const& node, u8 facts)
-{
- auto style_affects_state = [facts](auto const& style) {
- return style && (style->generated_content_facts() & facts);
- };
- bool affects_generated_content_state = false;
- node.for_each_in_inclusive_subtree([&](DOM::Node const& descendant) {
- auto const* element = as_if<DOM::Element>(descendant);
- if (!element)
- return TraversalDecision::Continue;
-
- auto style = element->computed_style();
- if (!style_affects_state(style)
- && !style_affects_state(element->computed_style(PseudoElement::Before))
- && !style_affects_state(element->computed_style(PseudoElement::After))
- && !style_affects_state(element->computed_style(PseudoElement::Marker))) {
- // NB: An element's style is computed only with the styles of the elements it inherits from, so the
- // subtree of an element without style holds none, as that of a revealed display:none root does.
- return style ? TraversalDecision::Continue : TraversalDecision::SkipChildrenAndContinue;
- }
-
- affects_generated_content_state = true;
- return TraversalDecision::Break;
- });
- return affects_generated_content_state;
-}
-
-bool subtree_affects_generated_content_state(DOM::Node const& node)
-{
- return subtree_has_generated_content_facts(node, ComputedValuesFFI::GENERATED_CONTENT_DEFINES_COUNTERS | ComputedValuesFFI::GENERATED_CONTENT_HAS_QUOTES);
-}
-
-bool subtree_affects_counters(DOM::Node const& node)
-{
- return subtree_has_generated_content_facts(node, ComputedValuesFFI::GENERATED_CONTENT_DEFINES_COUNTERS);
-}
-
-}
diff --git a/Libraries/LibWeb/CSS/GeneratedContent.h b/Libraries/LibWeb/CSS/GeneratedContent.h
deleted file mode 100644
index 1cc7a3f7047..00000000000
--- a/Libraries/LibWeb/CSS/GeneratedContent.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-namespace Web::DOM {
-
-class Node;
-
-}
-
-namespace Web::CSS {
-
-bool subtree_affects_generated_content_state(DOM::Node const&);
-bool subtree_affects_counters(DOM::Node const&);
-
-}
diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp
index f06214d3073..60f1dd489ab 100644
--- a/Libraries/LibWeb/DOM/Element.cpp
+++ b/Libraries/LibWeb/DOM/Element.cpp
@@ -37,7 +37,6 @@
#include <LibWeb/CSS/CountersSet.h>
#include <LibWeb/CSS/CustomPropertyData.h>
#include <LibWeb/CSS/ElementBoxKind.h>
-#include <LibWeb/CSS/GeneratedContent.h>
#include <LibWeb/CSS/Invalidation/AttributeInvalidator.h>
#include <LibWeb/CSS/Invalidation/CustomElementInvalidator.h>
#include <LibWeb/CSS/Invalidation/ElementStateInvalidator.h>
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp
index bd58cb281c9..6e829abd04d 100644
--- a/Libraries/LibWeb/DOM/Node.cpp
+++ b/Libraries/LibWeb/DOM/Node.cpp
@@ -23,7 +23,6 @@
#include <LibWeb/Bindings/Sanitizer.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/CSS/CountersSet.h>
-#include <LibWeb/CSS/GeneratedContent.h>
#include <LibWeb/CSS/Invalidation/ElementStateInvalidator.h>
#include <LibWeb/CSS/Invalidation/LanguageInvalidator.h>
#include <LibWeb/CSS/Invalidation/PseudoClassInvalidator.h>