Browse Source

Debugger: Sort properties by name.

Michael Ragazzon 5 years ago
parent
commit
ede2c6892c
1 changed files with 9 additions and 2 deletions
  1. 9 2
      Source/Debugger/ElementInfo.cpp

+ 9 - 2
Source/Debugger/ElementInfo.cpp

@@ -36,6 +36,7 @@
 #include "../../Include/RmlUi/Core/StyleSheet.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
 #include "../../Include/RmlUi/Core/SystemInterface.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 #include "Geometry.h"
 #include "CommonSource.h"
 #include "InfoSource.h"
@@ -603,7 +604,13 @@ void ElementInfo::BuildElementPropertiesRML(String& property_rml, Element* eleme
 		[](const NamedProperty& a, const NamedProperty& b) {
 			if (a.second->source && !b.second->source) return false;
 			if (!a.second->source && b.second->source) return true;
-			return a.second->specificity > b.second->specificity; 
+			if (a.second->specificity < b.second->specificity) return false;
+			if (a.second->specificity > b.second->specificity) return true;
+			if (a.second->definition && !b.second->definition) return false;
+			if (!a.second->definition && b.second->definition) return true;
+			const String& a_name = StyleSheetSpecification::GetPropertyName(a.second->definition->GetId());
+			const String& b_name = StyleSheetSpecification::GetPropertyName(b.second->definition->GetId());
+			return a_name < b_name;
 		}
 	);
 
@@ -627,7 +634,7 @@ void ElementInfo::BuildElementPropertiesRML(String& property_rml, Element* eleme
 				first_iteration = false;
 
 				// Print the rule name header.
-				if(source)
+				if (source)
 				{
 					String str_line_number;
 					TypeConverter<int, String>::Convert(source->line_number, str_line_number);