Browse Source

Fix some bugs

Michael Ragazzon 6 years ago
parent
commit
d9c0ca4735

+ 2 - 0
Source/Core/ElementStyle.cpp

@@ -921,6 +921,7 @@ DirtyPropertyList ElementStyle::ComputeValues(Style::ComputedValues& values, con
 
 		case PropertyId::Transform:
 			values.transform = p->Get<TransformRef>();
+			break;
 		case PropertyId::TransformOriginX:
 			values.transform_origin_x = ComputeOrigin(p, font_size, document_font_size, dp_ratio);
 			break;
@@ -936,6 +937,7 @@ DirtyPropertyList ElementStyle::ComputeValues(Style::ComputedValues& values, con
 			break;
 		case PropertyId::Animation:
 			values.animation = p->Get<AnimationList>();
+			break;
 		}
 	}
 

+ 2 - 2
Source/Core/PropertyDictionary.cpp

@@ -42,14 +42,14 @@ PropertyDictionary::~PropertyDictionary()
 // Sets a property on the dictionary. Any existing property with a similar name will be overwritten.
 void PropertyDictionary::SetProperty(PropertyId id, const Property& property)
 {
-	ROCKET_ASSERT(id != PropertyId::Invalid && (size_t)id < properties.size());
+	ROCKET_ASSERT(id != PropertyId::Invalid);
 	properties[id] = property;
 }
 
 // Removes a property from the dictionary, if it exists.
 void PropertyDictionary::RemoveProperty(PropertyId id)
 {
-	ROCKET_ASSERT(id != PropertyId::Invalid && (size_t)id < properties.size());
+	ROCKET_ASSERT(id != PropertyId::Invalid);
 	properties.erase(id);
 }
 

+ 2 - 2
Source/Core/PropertySpecification.cpp

@@ -86,7 +86,7 @@ PropertyDefinition& PropertySpecification::RegisterProperty(const String& proper
 // Returns a property definition.
 const PropertyDefinition* PropertySpecification::GetProperty(PropertyId id) const
 {
-	if (id == PropertyId::Invalid || (size_t)id < properties.size())
+	if (id == PropertyId::Invalid || (size_t)id >= properties.size())
 		return nullptr;
 
 	return properties[(size_t)id];
@@ -197,7 +197,7 @@ bool PropertySpecification::RegisterShorthand(const String& shorthand_name, cons
 // Returns a shorthand definition.
 const ShorthandDefinition* PropertySpecification::GetShorthand(ShorthandId id) const
 {
-	if (id == ShorthandId::Invalid || (size_t)id < properties.size())
+	if (id == ShorthandId::Invalid || (size_t)id >= shorthands.size())
 		return nullptr;
 
 	return shorthands[(size_t)id];