2
0
Michael Ragazzon 2 жил өмнө
parent
commit
bc84fcdffc

+ 1 - 1
Include/RmlUi/Core/StyleSheet.h

@@ -114,7 +114,7 @@ private:
 	StyleSheetIndex styled_node_index;
 
 	// Index of node sets to element definitions.
-	using ElementDefinitionCache = UnorderedMap<StyleSheetIndex::NodeList, SharedPtr<const ElementDefinition>>;
+	using ElementDefinitionCache = UnorderedMap<StyleSheetIndex::StyleSheetNodeListRawConst, SharedPtr<const ElementDefinition>>;
 	mutable ElementDefinitionCache node_cache;
 
 	// Cached decorator instances.

+ 6 - 6
Include/RmlUi/Core/StyleSheetTypes.h

@@ -101,20 +101,20 @@ using MediaBlockList = Vector<MediaBlock>;
    element.
  */
 struct StyleSheetIndex {
-	using NodeList = Vector<const StyleSheetNode*>;
-	using NodeIndex = UnorderedMap<size_t, NodeList>;
+	using StyleSheetNodeListRawConst = Vector<const StyleSheetNode*>;
+	using StyleSheetNodeIndex = UnorderedMap<size_t, StyleSheetNodeListRawConst>;
 
 	// The following objects are given in prioritized order. Any nodes in the first object will not be contained in the next one and so on.
-	NodeIndex ids, classes, tags;
-	NodeList other;
+	StyleSheetNodeIndex ids, classes, tags;
+	StyleSheetNodeListRawConst other;
 };
 } // namespace Rml
 
 namespace std {
 // Hash specialization for the node list, so it can be used as key in UnorderedMap.
 template <>
-struct hash<::Rml::StyleSheetIndex::NodeList> {
-	size_t operator()(const ::Rml::StyleSheetIndex::NodeList& nodes) const noexcept
+struct hash<::Rml::StyleSheetIndex::StyleSheetNodeListRawConst> {
+	size_t operator()(const ::Rml::StyleSheetIndex::StyleSheetNodeListRawConst& nodes) const noexcept
 	{
 		size_t seed = 0;
 		for (const ::Rml::StyleSheetNode* node : nodes)

+ 2 - 2
Source/Core/StyleSheet.cpp

@@ -198,11 +198,11 @@ SharedPtr<const ElementDefinition> StyleSheet::GetElementDefinition(const Elemen
 	static Vector<const StyleSheetNode*> applicable_nodes;
 	applicable_nodes.clear();
 
-	auto AddApplicableNodes = [element](const StyleSheetIndex::NodeIndex& node_index, const String& key) {
+	auto AddApplicableNodes = [element](const StyleSheetIndex::StyleSheetNodeIndex& node_index, const String& key) {
 		auto it_nodes = node_index.find(Hash<String>()(key));
 		if (it_nodes != node_index.end())
 		{
-			const StyleSheetIndex::NodeList& nodes = it_nodes->second;
+			const StyleSheetIndex::StyleSheetNodeListRawConst& nodes = it_nodes->second;
 
 			for (const StyleSheetNode* node : nodes)
 			{

+ 2 - 2
Source/Core/StyleSheetNode.cpp

@@ -129,8 +129,8 @@ void StyleSheetNode::BuildIndex(StyleSheetIndex& styled_node_index) const
 	// If this has properties defined, then we insert it into the styled node index.
 	if (properties.GetNumProperties() > 0)
 	{
-		auto IndexInsertNode = [](StyleSheetIndex::NodeIndex& node_index, const String& key, const StyleSheetNode* node) {
-			StyleSheetIndex::NodeList& nodes = node_index[Hash<String>()(key)];
+		auto IndexInsertNode = [](StyleSheetIndex::StyleSheetNodeIndex& node_index, const String& key, const StyleSheetNode* node) {
+			StyleSheetIndex::StyleSheetNodeListRawConst& nodes = node_index[Hash<String>()(key)];
 			auto it = std::find(nodes.begin(), nodes.end(), node);
 			if (it == nodes.end())
 				nodes.push_back(node);