Browse Source

Some cleaning up

Michael Ragazzon 6 years ago
parent
commit
4f8c216c5e

+ 33 - 33
Include/Rocket/Core/ComputedValues.h

@@ -34,6 +34,9 @@
 namespace Rocket {
 namespace Rocket {
 namespace Core {
 namespace Core {
 
 
+namespace Style
+{
+
 struct LengthPercentageAuto {
 struct LengthPercentageAuto {
 	enum Type { Auto, Length, Percentage } type = Length;
 	enum Type { Auto, Length, Percentage } type = Length;
 	float value = 0;
 	float value = 0;
@@ -48,42 +51,44 @@ struct LengthPercentage {
 };
 };
 
 
 struct NumberAuto {
 struct NumberAuto {
-	enum Type { Number, Auto } type = Number;
+	enum Type { Auto, Number } type = Number;
 	float value = 0;
 	float value = 0;
 	NumberAuto() {}
 	NumberAuto() {}
 	NumberAuto(Type type, float value = 0) : type(type), value(value) {}
 	NumberAuto(Type type, float value = 0) : type(type), value(value) {}
 };
 };
 
 
 
 
-namespace Style
-{
-
 using Margin = LengthPercentageAuto;
 using Margin = LengthPercentageAuto;
-using Width = LengthPercentageAuto;
-using Height = LengthPercentageAuto;
+using Padding = LengthPercentage;
+
+enum class Display { None, Block, Inline, InlineBlock };
+enum class Position { Static, Relative, Absolute, Fixed };
 
 
 using Top = LengthPercentageAuto;
 using Top = LengthPercentageAuto;
 using Right = LengthPercentageAuto;
 using Right = LengthPercentageAuto;
 using Bottom = LengthPercentageAuto;
 using Bottom = LengthPercentageAuto;
 using Left = LengthPercentageAuto;
 using Left = LengthPercentageAuto;
 
 
-using Padding = LengthPercentage;
+enum class Float { None, Left, Right };
+enum class Clear { None, Left, Right, Both };
 
 
+using ZIndex = NumberAuto;
+
+using Width = LengthPercentageAuto;
 using MinWidth = LengthPercentage;
 using MinWidth = LengthPercentage;
 using MaxWidth = LengthPercentage;
 using MaxWidth = LengthPercentage;
+
+using Height = LengthPercentageAuto;
 using MinHeight = LengthPercentage;
 using MinHeight = LengthPercentage;
 using MaxHeight = LengthPercentage;
 using MaxHeight = LengthPercentage;
 
 
-using PerspectiveOrigin = LengthPercentage;
-using TransformOrigin = LengthPercentage;
-
-
-enum class Display { None, Block, Inline, InlineBlock };
-enum class Position { Static, Relative, Absolute, Fixed };
-
-enum class Float { None, Left, Right };
-enum class Clear { None, Left, Right, Both };
-
+struct LineHeight {
+	float value = 12.f * 1.2f; // The computed value (length)
+	enum InheritType { Number, Length } inherit_type = Number;
+	float inherit_value = 1.2f;
+	LineHeight() {}
+	LineHeight(float value, InheritType inherit_type, float inherit_value) : value(value), inherit_type(inherit_type), inherit_value(inherit_value) {}
+};
 struct VerticalAlign {
 struct VerticalAlign {
 	enum Type { Baseline, Middle, Sub, Super, TextTop, TextBottom, Top, Bottom, Length } type;
 	enum Type { Baseline, Middle, Sub, Super, TextTop, TextBottom, Top, Bottom, Length } type;
 	float value; // For length type
 	float value; // For length type
@@ -92,10 +97,9 @@ struct VerticalAlign {
 };
 };
 
 
 enum class Overflow { Visible, Hidden, Auto, Scroll };
 enum class Overflow { Visible, Hidden, Auto, Scroll };
-
 struct Clip {
 struct Clip {
 	// Note, internally Auto is 0 and None is -1, however, the enum must correspond to the keywords in StyleSheetSpec
 	// Note, internally Auto is 0 and None is -1, however, the enum must correspond to the keywords in StyleSheetSpec
-	enum Type { Auto, None, Number }; 
+	enum Type { Auto, None, Number };
 	int number = 0;
 	int number = 0;
 	Clip() {}
 	Clip() {}
 	Clip(Type type, int number = 0) : number(type == Auto ? 0 : (type == None ? -1 : number)) {}
 	Clip(Type type, int number = 0) : number(type == Auto ? 0 : (type == None ? -1 : number)) {}
@@ -116,16 +120,12 @@ enum class TabIndex { None, Auto };
 enum class Focus { None, Auto };
 enum class Focus { None, Auto };
 enum class PointerEvents { None, Auto };
 enum class PointerEvents { None, Auto };
 
 
+using PerspectiveOrigin = LengthPercentage;
+using TransformOrigin = LengthPercentage;
+
 enum class OriginX { Left, Center, Right };
 enum class OriginX { Left, Center, Right };
 enum class OriginY { Top, Center, Bottom };
 enum class OriginY { Top, Center, Bottom };
 
 
-struct LineHeight {
-	float value = 12.f*1.2f; // The computed value (length)
-	enum InheritType { Number, Length } inherit_type = Number;
-	float inherit_value = 1.2f;
-	LineHeight() {}
-	LineHeight(float value, InheritType inherit_type, float inherit_value) : value(value), inherit_type(inherit_type), inherit_value(inherit_value) {}
-};
 
 
 // A computed value is a value resolved as far as possible :before: updating layout. See CSS specs for details of each property.
 // A computed value is a value resolved as far as possible :before: updating layout. See CSS specs for details of each property.
 struct ComputedValues
 struct ComputedValues
@@ -146,7 +146,7 @@ struct ComputedValues
 	Float float_ = Float::None;
 	Float float_ = Float::None;
 	Clear clear = Clear::None;
 	Clear clear = Clear::None;
 
 
-	NumberAuto z_index = { NumberAuto::Auto };
+	ZIndex z_index = { ZIndex::Auto };
 
 
 	Width width = { Width::Auto };
 	Width width = { Width::Auto };
 	MinWidth min_width;
 	MinWidth min_width;
@@ -202,18 +202,18 @@ struct ComputedValues
 }
 }
 
 
 // Note: Auto must be manually handled during layout, here it returns zero.
 // Note: Auto must be manually handled during layout, here it returns zero.
-inline float ResolveProperty(LengthPercentageAuto length, float base_value) {
-	if (length.type == LengthPercentageAuto::Length)
+inline float ResolveProperty(Style::LengthPercentageAuto length, float base_value) {
+	if (length.type == Style::LengthPercentageAuto::Length)
 		return length.value;
 		return length.value;
-	else if (length.type == LengthPercentageAuto::Percentage)
+	else if (length.type == Style::LengthPercentageAuto::Percentage)
 		return length.value * 0.01f * base_value;
 		return length.value * 0.01f * base_value;
 	return 0.0f;
 	return 0.0f;
 }
 }
 
 
-inline float ResolveProperty(LengthPercentage length, float base_value) {
-	if (length.type == LengthPercentage::Length)
+inline float ResolveProperty(Style::LengthPercentage length, float base_value) {
+	if (length.type == Style::LengthPercentage::Length)
 		return length.value;
 		return length.value;
-	else if (length.type == LengthPercentage::Percentage)
+	else if (length.type == Style::LengthPercentage::Percentage)
 		return length.value * 0.01f * base_value;
 		return length.value * 0.01f * base_value;
 	return 0.0f;
 	return 0.0f;
 }
 }

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

@@ -95,7 +95,8 @@ public:
 		  Computed transform and other optimizations: 86.0  [654fa09]
 		  Computed transform and other optimizations: 86.0  [654fa09]
 		  Computed layout engine: 90.0   [e18ac30]
 		  Computed layout engine: 90.0   [e18ac30]
 		  Replace style cache by computed values: 96.0
 		  Replace style cache by computed values: 96.0
-		
+		  More computed values: 100.0  [edc78bb] !Woo!
+		  
 		*/
 		*/
 
 
 		if (!document)
 		if (!document)

+ 2 - 2
Source/Core/Context.cpp

@@ -892,8 +892,8 @@ bool Context::OnFocusChange(Element* new_focus)
 	ElementDocument* document = focus->GetOwnerDocument();
 	ElementDocument* document = focus->GetOwnerDocument();
 	if (document != NULL)
 	if (document != NULL)
 	{
 	{
-		NumberAuto z_index_property = document->GetComputedValues().z_index;
-		if (z_index_property.type == NumberAuto::Auto)
+		Style::ZIndex z_index_property = document->GetComputedValues().z_index;
+		if (z_index_property.type == Style::ZIndex::Auto)
 			document->PullToFront();
 			document->PullToFront();
 	}
 	}
 
 

+ 14 - 14
Source/Core/Element.cpp

@@ -1805,9 +1805,9 @@ void Element::OnPropertyChange(const PropertyNameList& changed_properties)
 	if (all_dirty || 
 	if (all_dirty || 
 		changed_properties.find(Z_INDEX) != changed_properties.end())
 		changed_properties.find(Z_INDEX) != changed_properties.end())
 	{
 	{
-		NumberAuto z_index_property = element_meta->computed_values.z_index;
+		Style::ZIndex z_index_property = element_meta->computed_values.z_index;
 
 
-		if (z_index_property.type == NumberAuto::Auto)
+		if (z_index_property.type == Style::ZIndex::Auto)
 		{
 		{
 			if (local_stacking_context &&
 			if (local_stacking_context &&
 				!local_stacking_context_forced)
 				!local_stacking_context_forced)
@@ -2137,23 +2137,23 @@ void Element::UpdateOffset()
 			Vector2f containing_block = parent_box.GetSize(Box::PADDING);
 			Vector2f containing_block = parent_box.GetSize(Box::PADDING);
 
 
 			// If the element is anchored left, then the position is offset by that resolved value.
 			// If the element is anchored left, then the position is offset by that resolved value.
-			if (computed.left.type != LengthPercentageAuto::Auto)
+			if (computed.left.type != Left::Auto)
 				relative_offset_base.x = parent_box.GetEdge(Box::BORDER, Box::LEFT) + (::Rocket::Core::ResolveProperty(computed.left, containing_block.x) + GetBox().GetEdge(Box::MARGIN, Box::LEFT));
 				relative_offset_base.x = parent_box.GetEdge(Box::BORDER, Box::LEFT) + (::Rocket::Core::ResolveProperty(computed.left, containing_block.x) + GetBox().GetEdge(Box::MARGIN, Box::LEFT));
 
 
 			// If the element is anchored right, then the position is set first so the element's right-most edge
 			// If the element is anchored right, then the position is set first so the element's right-most edge
 			// (including margins) will render up against the containing box's right-most content edge, and then
 			// (including margins) will render up against the containing box's right-most content edge, and then
 			// offset by the resolved value.
 			// offset by the resolved value.
-			else if (computed.right.type != LengthPercentageAuto::Auto)
+			else if (computed.right.type != Right::Auto)
 				relative_offset_base.x = containing_block.x + parent_box.GetEdge(Box::BORDER, Box::LEFT) - (::Rocket::Core::ResolveProperty(computed.right, containing_block.x) + GetBox().GetSize(Box::BORDER).x + GetBox().GetEdge(Box::MARGIN, Box::RIGHT));
 				relative_offset_base.x = containing_block.x + parent_box.GetEdge(Box::BORDER, Box::LEFT) - (::Rocket::Core::ResolveProperty(computed.right, containing_block.x) + GetBox().GetSize(Box::BORDER).x + GetBox().GetEdge(Box::MARGIN, Box::RIGHT));
 
 
 			// If the element is anchored top, then the position is offset by that resolved value.
 			// If the element is anchored top, then the position is offset by that resolved value.
-			if (computed.top.type != LengthPercentageAuto::Auto)
+			if (computed.top.type != Top::Auto)
 				relative_offset_base.y = parent_box.GetEdge(Box::BORDER, Box::TOP) + (::Rocket::Core::ResolveProperty(computed.top, containing_block.y) + GetBox().GetEdge(Box::MARGIN, Box::TOP));
 				relative_offset_base.y = parent_box.GetEdge(Box::BORDER, Box::TOP) + (::Rocket::Core::ResolveProperty(computed.top, containing_block.y) + GetBox().GetEdge(Box::MARGIN, Box::TOP));
 
 
 			// If the element is anchored bottom, then the position is set first so the element's right-most edge
 			// If the element is anchored bottom, then the position is set first so the element's right-most edge
 			// (including margins) will render up against the containing box's right-most content edge, and then
 			// (including margins) will render up against the containing box's right-most content edge, and then
 			// offset by the resolved value.
 			// offset by the resolved value.
-			else if (computed.bottom.type != LengthPercentageAuto::Auto)
+			else if (computed.bottom.type != Bottom::Auto)
 				relative_offset_base.y = containing_block.y + parent_box.GetEdge(Box::BORDER, Box::TOP) - (::Rocket::Core::ResolveProperty(computed.bottom, containing_block.y) + GetBox().GetSize(Box::BORDER).y + GetBox().GetEdge(Box::MARGIN, Box::BOTTOM));
 				relative_offset_base.y = containing_block.y + parent_box.GetEdge(Box::BORDER, Box::TOP) - (::Rocket::Core::ResolveProperty(computed.bottom, containing_block.y) + GetBox().GetSize(Box::BORDER).y + GetBox().GetEdge(Box::MARGIN, Box::BOTTOM));
 		}
 		}
 	}
 	}
@@ -2164,16 +2164,16 @@ void Element::UpdateOffset()
 			const Box& parent_box = offset_parent->GetBox();
 			const Box& parent_box = offset_parent->GetBox();
 			Vector2f containing_block = parent_box.GetSize();
 			Vector2f containing_block = parent_box.GetSize();
 
 
-			if (computed.left.type != LengthPercentageAuto::Auto)
+			if (computed.left.type != Left::Auto)
 				relative_offset_position.x = ::Rocket::Core::ResolveProperty(computed.left, containing_block.x);
 				relative_offset_position.x = ::Rocket::Core::ResolveProperty(computed.left, containing_block.x);
-			else if (computed.right.type != LengthPercentageAuto::Auto)
+			else if (computed.right.type != Right::Auto)
 				relative_offset_position.x = -1 * ::Rocket::Core::ResolveProperty(computed.right, containing_block.x);
 				relative_offset_position.x = -1 * ::Rocket::Core::ResolveProperty(computed.right, containing_block.x);
 			else
 			else
 				relative_offset_position.x = 0;
 				relative_offset_position.x = 0;
 
 
-			if (computed.top.type != LengthPercentageAuto::Auto)
+			if (computed.top.type != Top::Auto)
 				relative_offset_position.y = ::Rocket::Core::ResolveProperty(computed.top, containing_block.y);
 				relative_offset_position.y = ::Rocket::Core::ResolveProperty(computed.top, containing_block.y);
-			else if (computed.bottom.type != LengthPercentageAuto::Auto)
+			else if (computed.bottom.type != Bottom::Auto)
 				relative_offset_position.y = -1 * ::Rocket::Core::ResolveProperty(computed.bottom, containing_block.y);
 				relative_offset_position.y = -1 * ::Rocket::Core::ResolveProperty(computed.bottom, containing_block.y);
 			else
 			else
 				relative_offset_position.y = 0;
 				relative_offset_position.y = 0;
@@ -2570,12 +2570,12 @@ void Element::UpdateTransformState()
 				perspective_value.distance = computed.perspective;
 				perspective_value.distance = computed.perspective;
 
 
 				// Compute the perspective origin, if necessary
 				// Compute the perspective origin, if necessary
-				if (computed.perspective_origin_x.type == LengthPercentage::Percentage)
+				if (computed.perspective_origin_x.type == Style::PerspectiveOrigin::Percentage)
 					perspective_value.vanish.x = pos.x + computed.perspective_origin_x.value * 0.01f * size.x;
 					perspective_value.vanish.x = pos.x + computed.perspective_origin_x.value * 0.01f * size.x;
 				else
 				else
 					perspective_value.vanish.x = pos.x + computed.perspective_origin_x.value;
 					perspective_value.vanish.x = pos.x + computed.perspective_origin_x.value;
 
 
-				if (computed.perspective_origin_y.type == LengthPercentage::Percentage)
+				if (computed.perspective_origin_y.type == Style::PerspectiveOrigin::Percentage)
 					perspective_value.vanish.y = pos.y + computed.perspective_origin_y.value * 0.01f * size.y;
 					perspective_value.vanish.y = pos.y + computed.perspective_origin_y.value * 0.01f * size.y;
 				else
 				else
 					perspective_value.vanish.y = pos.y + computed.perspective_origin_y.value;
 					perspective_value.vanish.y = pos.y + computed.perspective_origin_y.value;
@@ -2626,12 +2626,12 @@ void Element::UpdateTransformState()
 				}
 				}
 
 
 				// Compute the transform origin
 				// Compute the transform origin
-				if (computed.transform_origin_x.type == LengthPercentage::Percentage)
+				if (computed.transform_origin_x.type == Style::TransformOrigin::Percentage)
 					transform_origin.x = pos.x + computed.transform_origin_x.value * size.x * 0.01f;
 					transform_origin.x = pos.x + computed.transform_origin_x.value * size.x * 0.01f;
 				else
 				else
 					transform_origin.x = pos.x + computed.transform_origin_x.value;
 					transform_origin.x = pos.x + computed.transform_origin_x.value;
 
 
-				if (computed.transform_origin_y.type == LengthPercentage::Percentage)
+				if (computed.transform_origin_y.type == Style::TransformOrigin::Percentage)
 					transform_origin.y = pos.y + computed.transform_origin_y.value * size.y * 0.01f;
 					transform_origin.y = pos.y + computed.transform_origin_y.value * size.y * 0.01f;
 				else
 				else
 					transform_origin.y = pos.y + computed.transform_origin_y.value;
 					transform_origin.y = pos.y + computed.transform_origin_y.value;

+ 4 - 4
Source/Core/ElementHandle.cpp

@@ -117,13 +117,13 @@ void ElementHandle::ProcessEvent(Event& event)
 				const auto& computed = GetComputedValues();
 				const auto& computed = GetComputedValues();
 
 
 				// Check if we have auto-margins; if so, they have to be set to the current margins.
 				// Check if we have auto-margins; if so, they have to be set to the current margins.
-				if (computed.margin_top.type == LengthPercentageAuto::Auto)
+				if (computed.margin_top.type == Margin::Auto)
 					size_target->SetProperty(MARGIN_TOP, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::TOP)), Property::PX));
 					size_target->SetProperty(MARGIN_TOP, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::TOP)), Property::PX));
-				if (computed.margin_right.type == LengthPercentageAuto::Auto)
+				if (computed.margin_right.type == Margin::Auto)
 					size_target->SetProperty(MARGIN_RIGHT, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::RIGHT)), Property::PX));
 					size_target->SetProperty(MARGIN_RIGHT, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::RIGHT)), Property::PX));
-				if (computed.margin_bottom.type == LengthPercentageAuto::Auto)
+				if (computed.margin_bottom.type == Margin::Auto)
 					size_target->SetProperty(MARGIN_BOTTOM, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::BOTTOM)), Property::PX));
 					size_target->SetProperty(MARGIN_BOTTOM, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::BOTTOM)), Property::PX));
-				if (computed.margin_left.type == LengthPercentageAuto::Auto)
+				if (computed.margin_left.type == Margin::Auto)
 					size_target->SetProperty(MARGIN_LEFT, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::LEFT)), Property::PX));
 					size_target->SetProperty(MARGIN_LEFT, Property((float) Math::RealToInteger(size_target->GetBox().GetEdge(Box::MARGIN, Box::LEFT)), Property::PX));
 
 
 				int new_x = Math::RealToInteger(size_original_size.x + x);
 				int new_x = Math::RealToInteger(size_original_size.x + x);

+ 6 - 6
Source/Core/ElementStyle.cpp

@@ -1098,8 +1098,9 @@ static inline Style::VerticalAlign ComputeVerticalAlign(const Property* property
 	return Style::VerticalAlign((Style::VerticalAlign::Type)property->Get<int>());
 	return Style::VerticalAlign((Style::VerticalAlign::Type)property->Get<int>());
 }
 }
 
 
-static inline LengthPercentage ComputeLengthPercentage(const Property* property, float font_size, float document_font_size, float dp_ratio, float pixels_per_inch)
+static inline Style::LengthPercentage ComputeLengthPercentage(const Property* property, float font_size, float document_font_size, float dp_ratio, float pixels_per_inch)
 {
 {
+	using namespace Style;
 	if (property->unit & Property::PERCENT)
 	if (property->unit & Property::PERCENT)
 		return LengthPercentage(LengthPercentage::Percentage, property->Get<float>());
 		return LengthPercentage(LengthPercentage::Percentage, property->Get<float>());
 
 
@@ -1107,8 +1108,9 @@ static inline LengthPercentage ComputeLengthPercentage(const Property* property,
 }
 }
 
 
 
 
-static inline LengthPercentageAuto ComputeLengthPercentageAuto(const Property* property, float font_size, float document_font_size, float dp_ratio, float pixels_per_inch)
+static inline Style::LengthPercentageAuto ComputeLengthPercentageAuto(const Property* property, float font_size, float document_font_size, float dp_ratio, float pixels_per_inch)
 {
 {
+	using namespace Style;
 	// Assuming here that 'auto' is the only possible keyword
 	// Assuming here that 'auto' is the only possible keyword
 	if (property->unit & Property::PERCENT)
 	if (property->unit & Property::PERCENT)
 		return LengthPercentageAuto(LengthPercentageAuto::Percentage, property->Get<float>());
 		return LengthPercentageAuto(LengthPercentageAuto::Percentage, property->Get<float>());
@@ -1118,7 +1120,7 @@ static inline LengthPercentageAuto ComputeLengthPercentageAuto(const Property* p
 	return LengthPercentageAuto(LengthPercentageAuto::Length, ComputeLength(property, font_size, document_font_size, dp_ratio, pixels_per_inch));
 	return LengthPercentageAuto(LengthPercentageAuto::Length, ComputeLength(property, font_size, document_font_size, dp_ratio, pixels_per_inch));
 }
 }
 
 
-static inline LengthPercentage ComputeOrigin(const Property* property, float font_size, float document_font_size, float dp_ratio, float pixels_per_inch)
+static inline Style::LengthPercentage ComputeOrigin(const Property* property, float font_size, float document_font_size, float dp_ratio, float pixels_per_inch)
 {
 {
 	using namespace Style;
 	using namespace Style;
 	static_assert((int)OriginX::Left == (int)OriginY::Top && (int)OriginX::Center == (int)OriginY::Center && (int)OriginX::Right == (int)OriginY::Bottom, "");
 	static_assert((int)OriginX::Left == (int)OriginY::Top && (int)OriginX::Center == (int)OriginY::Center && (int)OriginX::Right == (int)OriginY::Bottom, "");
@@ -1278,7 +1280,7 @@ void ElementStyle::ComputeValues(Style::ComputedValues& values, const Style::Com
 			values.clear = (Clear)p->Get<int>();
 			values.clear = (Clear)p->Get<int>();
 
 
 		else if (name == Z_INDEX)
 		else if (name == Z_INDEX)
-			values.z_index = (p->unit == Property::KEYWORD ? NumberAuto(NumberAuto::Auto) : NumberAuto(NumberAuto::Number, p->Get<float>()));
+			values.z_index = (p->unit == Property::KEYWORD ? ZIndex(ZIndex::Auto) : ZIndex(ZIndex::Number, p->Get<float>()));
 
 
 		else if (name == WIDTH)
 		else if (name == WIDTH)
 			values.width = ComputeLengthPercentageAuto(p, font_size, document_font_size, dp_ratio, pixels_per_inch);
 			values.width = ComputeLengthPercentageAuto(p, font_size, document_font_size, dp_ratio, pixels_per_inch);
@@ -1307,7 +1309,6 @@ void ElementStyle::ComputeValues(Style::ComputedValues& values, const Style::Com
 		else if (name == VISIBILITY)
 		else if (name == VISIBILITY)
 			values.visibility = (Visibility)p->Get< int >();
 			values.visibility = (Visibility)p->Get< int >();
 
 
-
 		else if (name == BACKGROUND_COLOR)
 		else if (name == BACKGROUND_COLOR)
 			values.background_color = p->Get<Colourb>();
 			values.background_color = p->Get<Colourb>();
 		else if (name == COLOR)
 		else if (name == COLOR)
@@ -1317,7 +1318,6 @@ void ElementStyle::ComputeValues(Style::ComputedValues& values, const Style::Com
 		else if (name == OPACITY)
 		else if (name == OPACITY)
 			values.opacity = p->Get<float>();
 			values.opacity = p->Get<float>();
 
 
-
 		else if (name == FONT_FAMILY)
 		else if (name == FONT_FAMILY)
 			values.font_family = p->Get<String>();
 			values.font_family = p->Get<String>();
 		else if (name == FONT_CHARSET)
 		else if (name == FONT_CHARSET)

+ 9 - 9
Source/Core/LayoutEngine.cpp

@@ -157,12 +157,12 @@ void LayoutEngine::BuildBox(Box& box, const Vector2f& containing_block, Element*
 		// 'auto' (or 'auto-fit', ie, both keywords) means keep (or adjust) the intrinsic dimensions.
 		// 'auto' (or 'auto-fit', ie, both keywords) means keep (or adjust) the intrinsic dimensions.
 		bool auto_width = false, auto_height = false;
 		bool auto_width = false, auto_height = false;
 
 
-		if (computed.width.type != LengthPercentageAuto::Auto)
+		if (computed.width.type != Style::Width::Auto)
 			content_area.x = ResolveProperty(computed.width, containing_block.x);
 			content_area.x = ResolveProperty(computed.width, containing_block.x);
 		else
 		else
 			auto_width = true;
 			auto_width = true;
 
 
-		if (computed.height.type != LengthPercentageAuto::Auto)
+		if (computed.height.type != Style::Height::Auto)
 			content_area.y = ResolveProperty(computed.height, containing_block.y);
 			content_area.y = ResolveProperty(computed.height, containing_block.y);
 		else
 		else
 			auto_height = true;
 			auto_height = true;
@@ -457,7 +457,7 @@ void LayoutEngine::BuildBoxWidth(Box& box, const ComputedValues& computed, float
 	}
 	}
 	else
 	else
 	{
 	{
-		if (computed.width.type == LengthPercentageAuto::Auto)
+		if (computed.width.type == Style::Width::Auto)
 		{
 		{
 			width_auto = true;
 			width_auto = true;
 		}
 		}
@@ -475,7 +475,7 @@ void LayoutEngine::BuildBoxWidth(Box& box, const ComputedValues& computed, float
 	for (int i = 0; i < 2; ++i)
 	for (int i = 0; i < 2; ++i)
 	{
 	{
 		auto* margin_value = (i == 0 ? &computed.margin_left : &computed.margin_right);
 		auto* margin_value = (i == 0 ? &computed.margin_left : &computed.margin_right);
-		if (margin_value->type == LengthPercentageAuto::Auto)
+		if (margin_value->type == Style::Margin::Auto)
 		{
 		{
 			margins_auto[i] = true;
 			margins_auto[i] = true;
 			num_auto_margins++;
 			num_auto_margins++;
@@ -495,9 +495,9 @@ void LayoutEngine::BuildBoxWidth(Box& box, const ComputedValues& computed, float
 		// consider if the left and right properties are set, since the width can be affected.
 		// consider if the left and right properties are set, since the width can be affected.
 		if (computed.position == Style::Position::Absolute || computed.position == Style::Position::Fixed)
 		if (computed.position == Style::Position::Absolute || computed.position == Style::Position::Fixed)
 		{
 		{
-			if (computed.left.type != LengthPercentageAuto::Auto)
+			if (computed.left.type != Style::Left::Auto)
 				left = ResolveProperty(computed.left, containing_block_width );
 				left = ResolveProperty(computed.left, containing_block_width );
-			if (computed.right.type != LengthPercentageAuto::Auto)
+			if (computed.right.type != Style::Right::Auto)
 				right = ResolveProperty(computed.right, containing_block_width);
 				right = ResolveProperty(computed.right, containing_block_width);
 		}
 		}
 
 
@@ -562,7 +562,7 @@ void LayoutEngine::BuildBoxHeight(Box& box, const ComputedValues& computed, floa
 	}
 	}
 	else
 	else
 	{
 	{
-		if (computed.height.type == LengthPercentageAuto::Auto)
+		if (computed.height.type == Style::Height::Auto)
 		{
 		{
 			height_auto = true;
 			height_auto = true;
 		}
 		}
@@ -580,7 +580,7 @@ void LayoutEngine::BuildBoxHeight(Box& box, const ComputedValues& computed, floa
 	for (int i = 0; i < 2; ++i)
 	for (int i = 0; i < 2; ++i)
 	{
 	{
 		auto* margin_value = (i == 0 ? &computed.margin_top : &computed.margin_bottom);
 		auto* margin_value = (i == 0 ? &computed.margin_top : &computed.margin_bottom);
-		if (margin_value->type == LengthPercentageAuto::Auto)
+		if (margin_value->type == Style::Margin::Auto)
 		{
 		{
 			margins_auto[i] = true;
 			margins_auto[i] = true;
 			num_auto_margins++;
 			num_auto_margins++;
@@ -610,7 +610,7 @@ void LayoutEngine::BuildBoxHeight(Box& box, const ComputedValues& computed, floa
 		{
 		{
 			float top = 0.0f, bottom = 0.0f;
 			float top = 0.0f, bottom = 0.0f;
 
 
-			if (computed.top.type != LengthPercentageAuto::Auto && computed.bottom.type != LengthPercentageAuto::Auto)
+			if (computed.top.type != Style::Top::Auto && computed.bottom.type != Style::Bottom::Auto)
 			{
 			{
 				top = ResolveProperty(computed.top, containing_block_height );
 				top = ResolveProperty(computed.top, containing_block_height );
 				bottom = ResolveProperty(computed.bottom, containing_block_height );
 				bottom = ResolveProperty(computed.bottom, containing_block_height );

+ 2 - 2
Source/Core/WidgetSlider.cpp

@@ -310,8 +310,8 @@ void WidgetSlider::FormatBar(float bar_length)
 
 
 	const auto& computed = bar->GetComputedValues();
 	const auto& computed = bar->GetComputedValues();
 
 
-	const LengthPercentageAuto& width = computed.width;
-	const LengthPercentageAuto& height = computed.height;
+	const Style::Width width = computed.width;
+	const Style::Height height = computed.height;
 
 
 	Vector2f bar_box_content = bar_box.GetSize();
 	Vector2f bar_box_content = bar_box.GetSize();
 	if (orientation == HORIZONTAL)
 	if (orientation == HORIZONTAL)