Browse Source

Scale transform single argument

Michael 7 years ago
parent
commit
322b983803

+ 1 - 1
Samples/basic/transform/data/transform.rml

@@ -19,7 +19,7 @@
 
 		div#title_bar:hover
 		{
-			transform: rotate3d(1, 0, 0, 25);
+			transform: rotate3d(1, 0, 0, 25) scale(0.5);
 			transform-origin: center bottom;
 		}
 

+ 5 - 0
Source/Core/PropertyParserTransform.cpp

@@ -116,6 +116,11 @@ bool PropertyParserTransform::ParseValue(Property& property, const String& value
 		{
 			transform->AddPrimitive(Transforms::Scale2D(args));
 		}
+		else if ((bytes_read = Scan(next, "scale", number1, args, 1)))
+		{
+			args[1] = args[0];
+			transform->AddPrimitive(Transforms::Scale2D(args));
+		}
 		else if ((bytes_read = Scan(next, "scale3d", number3, args, 3)))
 		{
 			transform->AddPrimitive(Transforms::Scale3D(args));

+ 9 - 26
Source/Core/StyleSheetSpecification.cpp

@@ -234,9 +234,7 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(OVERFLOW_X, "visible", false, true).AddParser("keyword", "visible, hidden, auto, scroll");
 	RegisterProperty(OVERFLOW_Y, "visible", false, true).AddParser("keyword", "visible, hidden, auto, scroll");
 	RegisterShorthand("overflow", "overflow-x, overflow-y", PropertySpecification::REPLICATE);
-	RegisterProperty(CLIP, "auto", true, false)
-		.AddParser("keyword", "auto, none")
-		.AddParser("length");
+	RegisterProperty(CLIP, "auto", true, false).AddParser("keyword", "auto, none").AddParser("length");
 	RegisterProperty(VISIBILITY, "visible", false, false).AddParser("keyword", "visible, hidden");
 
 	// Need some work on this if we are to include images.
@@ -259,9 +257,7 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(TEXT_TRANSFORM, "none", true, true).AddParser("keyword", "none, capitalize, uppercase, lowercase");
 	RegisterProperty(WHITE_SPACE, "normal", true, true).AddParser("keyword", "normal, pre, nowrap, pre-wrap, pre-line");
 
-	RegisterProperty(CURSOR, "auto", true, false)
-		.AddParser("keyword", "auto")
-		.AddParser("string");
+	RegisterProperty(CURSOR, "auto", true, false).AddParser("keyword", "auto").AddParser("string");
 
 	// Functional property specifications.
 	RegisterProperty(DRAG, "none", false, false).AddParser("keyword", "none, drag, drag-drop, block, clone");
@@ -271,27 +267,14 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("length");
 
 	// Perspective and Transform specifications
-	RegisterProperty(PERSPECTIVE, "none", false, false)
-		.AddParser("keyword", "none")
-		.AddParser("length");
-	RegisterProperty(PERSPECTIVE_ORIGIN_X, "50%", false, false)
-		.AddParser("keyword", "left, center, right")
-		.AddParser("length");
-	RegisterProperty(PERSPECTIVE_ORIGIN_Y, "50%", false, false)
-		.AddParser("keyword", "top, center, bottom")
-		.AddParser("length");
+	RegisterProperty(PERSPECTIVE, "none", false, false).AddParser("keyword", "none").AddParser("length");
+	RegisterProperty(PERSPECTIVE_ORIGIN_X, "50%", false, false).AddParser("keyword", "left, center, right").AddParser("length");
+	RegisterProperty(PERSPECTIVE_ORIGIN_Y, "50%", false, false).AddParser("keyword", "top, center, bottom").AddParser("length");
 	RegisterShorthand(PERSPECTIVE_ORIGIN, "perspective-origin-x, perspective-origin-y");
-	RegisterProperty(TRANSFORM, "none", false, false)
-		.AddParser("keyword", "none")
-		.AddParser(TRANSFORM);
-	RegisterProperty(TRANSFORM_ORIGIN_X, "50%", false, false)
-		.AddParser("keyword", "left, center, right")
-		.AddParser("length");
-	RegisterProperty(TRANSFORM_ORIGIN_Y, "50%", false, false)
-		.AddParser("keyword", "top, center, bottom")
-		.AddParser("length");
-	RegisterProperty(TRANSFORM_ORIGIN_Z, "0", false, false)
-		.AddParser("length");
+	RegisterProperty(TRANSFORM, "none", false, false).AddParser("keyword", "none").AddParser(TRANSFORM);
+	RegisterProperty(TRANSFORM_ORIGIN_X, "50%", false, false).AddParser("keyword", "left, center, right").AddParser("length");
+	RegisterProperty(TRANSFORM_ORIGIN_Y, "50%", false, false).AddParser("keyword", "top, center, bottom").AddParser("length");
+	RegisterProperty(TRANSFORM_ORIGIN_Z, "0", false, false).AddParser("length");
 	RegisterShorthand(TRANSFORM_ORIGIN, "transform-origin-x, transform-origin-y, transform-origin-z");
 
 	RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("number");