Przeglądaj źródła

StyleSheetNode: Remove unused volatility flag

Michael Ragazzon 3 lat temu
rodzic
commit
f1f862bf3b

+ 0 - 1
Source/Core/StyleSheet.cpp

@@ -101,7 +101,6 @@ void StyleSheet::BuildNodeIndex()
 	RMLUI_ZoneScoped;
 	styled_node_index = {};
 	root->BuildIndex(styled_node_index);
-	root->SetStructurallyVolatileRecursive(false);
 }
 
 // Returns the Keyframes of the given name, or null if it does not exist.

+ 2 - 25
Source/Core/StyleSheetNode.cpp

@@ -173,24 +173,6 @@ void StyleSheetNode::BuildIndex(StyleSheetIndex& styled_node_index) const
 		child->BuildIndex(styled_node_index);
 }
 
-bool StyleSheetNode::SetStructurallyVolatileRecursive(bool ancestor_is_structural_pseudo_class)
-{
-	// If any ancestor or descendant is a structural pseudo class, then we are structurally volatile.
-	bool self_is_structural_pseudo_class = (!structural_selectors.empty());
-
-	// Check our children for structural pseudo-classes.
-	bool descendant_is_structural_pseudo_class = false;
-	for (auto& child : children)
-	{
-		if (child->SetStructurallyVolatileRecursive(self_is_structural_pseudo_class || ancestor_is_structural_pseudo_class))
-			descendant_is_structural_pseudo_class = true;
-	}
-
-	is_structurally_volatile = (self_is_structural_pseudo_class || ancestor_is_structural_pseudo_class || descendant_is_structural_pseudo_class);
-
-	return (self_is_structural_pseudo_class || descendant_is_structural_pseudo_class);
-}
-
 bool StyleSheetNode::EqualRequirements(const String& _tag, const String& _id, const StringList& _class_names, const StringList& _pseudo_class_names,
 	const StructuralSelectorList& _structural_selectors, SelectorCombinator _combinator) const
 {
@@ -348,11 +330,6 @@ bool StyleSheetNode::IsApplicable(const Element* const in_element) const
 	return true;
 }
 
-bool StyleSheetNode::IsStructurallyVolatile() const
-{
-	return is_structurally_volatile;
-}
-
 void StyleSheetNode::CalculateAndSetSpecificity()
 {
 	// First calculate the specificity of this node alone.
@@ -366,9 +343,9 @@ void StyleSheetNode::CalculateAndSetSpecificity()
 
 	specificity += SelectorSpecificity::Class * (int)class_names.size();
 	specificity += SelectorSpecificity::PseudoClass * (int)pseudo_class_names.size();
-	
+
 	for (const StructuralSelector& selector : structural_selectors)
-		specificity += selector.specificity; 
+		specificity += selector.specificity;
 
 	// Then add our parent's specificity onto ours.
 	if (parent)

+ 0 - 8
Source/Core/StyleSheetNode.h

@@ -64,8 +64,6 @@ public:
 	void MergeHierarchy(StyleSheetNode* node, int specificity_offset = 0);
 	/// Copy this node including all descendent nodes.
 	UniquePtr<StyleSheetNode> DeepCopy(StyleSheetNode* parent = nullptr) const;
-	/// Recursively set structural volatility.
-	bool SetStructurallyVolatileRecursive(bool ancestor_is_structurally_volatile);
 	/// Builds up a style sheet's index recursively.
 	void BuildIndex(StyleSheetIndex& styled_node_index) const;
 
@@ -84,9 +82,6 @@ public:
 
 	/// Returns the specificity of this node.
 	int GetSpecificity() const;
-	/// Returns true if this node employs a structural selector, and therefore generates element definitions that are sensitive to sibling changes.
-	/// @warning Result is only valid if structural volatility is set since any changes to the node tree.
-	bool IsStructurallyVolatile() const;
 
 private:
 	// Returns true if the requirements of this node equals the given arguments.
@@ -111,9 +106,6 @@ private:
 	StructuralSelectorList structural_selectors; // Represents structural pseudo classes
 	SelectorCombinator combinator = SelectorCombinator::None;
 
-	// True if any ancestor, descendent, or self is a structural pseudo class.
-	bool is_structurally_volatile = true;
-
 	// A measure of specificity of this node; the attribute in a node with a higher value will override those of a node with a lower value.
 	int specificity = 0;