Browse Source

Use all_properties_dirty flag when constructing elements

Michael Ragazzon 6 years ago
parent
commit
fa6bd0a062

+ 2 - 1
Samples/basic/animation/src/main.cpp

@@ -143,7 +143,8 @@ public:
 		  Replace Dictionary with unordered_flat_map: 40.0  [b04b4e5]
 		  Replace Dictionary with unordered_flat_map: 40.0  [b04b4e5]
 		  Dirty flag for structure changes: 43.0  [fdf6f53]
 		  Dirty flag for structure changes: 43.0  [fdf6f53]
 		  Replacing containers: 46.0  [c307140]
 		  Replacing containers: 46.0  [c307140]
-		  Replace 'resize' event with virtual function call: 57.0  [7ad658f]
+		  Replace 'resize' event with virtual function call: 53.0  [7ad658f]
+		  Use all_properties_dirty flag when constructing elements: 55.0
 		
 		
 		*/
 		*/
 
 

+ 3 - 3
Source/Core/Element.cpp

@@ -1405,7 +1405,7 @@ void Element::AppendChild(Element* child, bool dom_element)
 	}
 	}
 
 
 	child->GetStyle()->DirtyDefinition();
 	child->GetStyle()->DirtyDefinition();
-	child->GetStyle()->DirtyProperties();
+	all_properties_dirty = true;
 
 
 	child->OnChildAdd(child);
 	child->OnChildAdd(child);
 	DirtyStackingContext();
 	DirtyStackingContext();
@@ -1453,7 +1453,7 @@ void Element::InsertBefore(Element* child, Element* adjacent_element)
 		children.insert(children.begin() + child_index, child);
 		children.insert(children.begin() + child_index, child);
 
 
 		child->GetStyle()->DirtyDefinition();
 		child->GetStyle()->DirtyDefinition();
-		child->GetStyle()->DirtyProperties();
+		all_properties_dirty = true;
 
 
 		child->OnChildAdd(child);
 		child->OnChildAdd(child);
 		DirtyStackingContext();
 		DirtyStackingContext();
@@ -1491,7 +1491,7 @@ bool Element::ReplaceChild(Element* inserted_element, Element* replaced_element)
 	RemoveChild(replaced_element);
 	RemoveChild(replaced_element);
 
 
 	inserted_element->GetStyle()->DirtyDefinition();
 	inserted_element->GetStyle()->DirtyDefinition();
-	inserted_element->GetStyle()->DirtyProperties();
+	all_properties_dirty = true;
 	inserted_element->OnChildAdd(inserted_element);
 	inserted_element->OnChildAdd(inserted_element);
 
 
 	LockLayout(false);
 	LockLayout(false);

+ 0 - 1
Source/Core/ElementStyle.cpp

@@ -916,7 +916,6 @@ void ElementStyle::DirtyInheritedProperties(const PropertyNameList& properties)
 		element->GetChild(i)->GetStyle()->DirtyInheritedProperties(inherited_properties);
 		element->GetChild(i)->GetStyle()->DirtyInheritedProperties(inherited_properties);
 
 
 	element->DirtyProperties(properties);
 	element->DirtyProperties(properties);
-	//element->OnPropertyChange(properties);
 }
 }
 
 
 void ElementStyle::GetOffsetProperties(const Property **top, const Property **bottom, const Property **left, const Property **right )
 void ElementStyle::GetOffsetProperties(const Property **top, const Property **bottom, const Property **left, const Property **right )

+ 11 - 3
Source/Core/StringUtilities.cpp

@@ -42,6 +42,14 @@ void StringUtilities::ExpandString(StringList& string_list, const String& string
 	const char* start_ptr = NULL;
 	const char* start_ptr = NULL;
 	const char* end_ptr = ptr;
 	const char* end_ptr = ptr;
 
 
+	size_t num_delimiter_values = std::count(string.begin(), string.end(), delimiter);
+	if (num_delimiter_values == 0)
+	{
+		string_list.push_back(StripWhitespace(string));
+		return;
+	}
+	string_list.reserve(num_delimiter_values + 1);
+
 	while (*ptr)
 	while (*ptr)
 	{
 	{
 		// Switch into quote mode if the last char was a delimeter ( excluding whitespace )
 		// Switch into quote mode if the last char was a delimeter ( excluding whitespace )
@@ -59,9 +67,9 @@ void StringUtilities::ExpandString(StringList& string_list, const String& string
 		else if (*ptr == delimiter && !quote)
 		else if (*ptr == delimiter && !quote)
 		{
 		{
 			if (start_ptr)
 			if (start_ptr)
-				string_list.push_back(String(start_ptr, end_ptr + 1));
+				string_list.emplace_back(start_ptr, end_ptr + 1);
 			else
 			else
-				string_list.push_back("");
+				string_list.emplace_back();
 			last_char_delimiter = true;
 			last_char_delimiter = true;
 			start_ptr = NULL;
 			start_ptr = NULL;
 		}
 		}
@@ -79,7 +87,7 @@ void StringUtilities::ExpandString(StringList& string_list, const String& string
 
 
 	// If there's data pending, add it.
 	// If there's data pending, add it.
 	if (start_ptr)
 	if (start_ptr)
-		string_list.push_back(String(start_ptr, end_ptr + 1));
+		string_list.emplace_back(start_ptr, end_ptr + 1);
 }
 }
 
 
 // Joins a list of string values into a single string separated by a character delimiter.
 // Joins a list of string values into a single string separated by a character delimiter.