diff --git a/apps/app/ui-tests-app/css/clip-path-inset.xml b/apps/app/ui-tests-app/css/clip-path-inset.xml
new file mode 100644
index 000000000..d802ec1f2
--- /dev/null
+++ b/apps/app/ui-tests-app/css/clip-path-inset.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/css/clip-path.xml b/apps/app/ui-tests-app/css/clip-path.xml
index f567cd119..14765d1c3 100644
--- a/apps/app/ui-tests-app/css/clip-path.xml
+++ b/apps/app/ui-tests-app/css/clip-path.xml
@@ -1,9 +1,25 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/css/inset-test.png b/apps/app/ui-tests-app/css/inset-test.png
new file mode 100644
index 000000000..d4c6e9f0c
Binary files /dev/null and b/apps/app/ui-tests-app/css/inset-test.png differ
diff --git a/apps/app/ui-tests-app/css/main-page.ts b/apps/app/ui-tests-app/css/main-page.ts
index 417339673..d8d28ca32 100644
--- a/apps/app/ui-tests-app/css/main-page.ts
+++ b/apps/app/ui-tests-app/css/main-page.ts
@@ -22,6 +22,7 @@ export function pageLoaded(args: EventData) {
examples.set("switch", "css/views");
examples.set("zindex", "css/zindex");
examples.set("clipPath", "css/clip-path");
+ examples.set("clipPathInset", "css/clip-path-inset");
examples.set("padding", "css/padding");
examples.set("label-background-image", "css/label-background-image");
examples.set("transform-decoration-color", "css/transform-decoration-color");
diff --git a/tns-core-modules/ui/styling/background.ios.ts b/tns-core-modules/ui/styling/background.ios.ts
index 0f280467b..3dbef7427 100644
--- a/tns-core-modules/ui/styling/background.ios.ts
+++ b/tns-core-modules/ui/styling/background.ios.ts
@@ -255,13 +255,46 @@ function drawClipPath(nativeView: UIView, background: common.Background) {
var arr = value.split(/[\s]+/);
var top = common.cssValueToDevicePixels(arr[0], bounds.top);
- var left = common.cssValueToDevicePixels(arr[1], bounds.left);
+ var right = common.cssValueToDevicePixels(arr[1], bounds.right);
var bottom = common.cssValueToDevicePixels(arr[2], bounds.bottom);
- var right = common.cssValueToDevicePixels(arr[3], bounds.right);
+ var left = common.cssValueToDevicePixels(arr[3], bounds.left);
- path = UIBezierPath.bezierPathWithRect(CGRectMake(left, top, right, bottom)).CGPath;
+ path = UIBezierPath.bezierPathWithRect(CGRectMake(left, top, right - left, bottom - top)).CGPath;
+ }
+ else if (functionName === "inset") {
+ var arr = value.split(/[\s]+/);
+
+ let topString: string;
+ let rightString: string;
+ let bottomString: string;
+ let leftString: string;
+ if (arr.length === 1) {
+ topString = rightString = bottomString = leftString = arr[0];
+ }
+ else if (arr.length === 2) {
+ topString = bottomString = arr[0];
+ rightString = leftString = arr[1];
+ }
+ else if (arr.length === 3) {
+ topString = arr[0];
+ rightString = leftString = arr[1];
+ bottomString = arr[2];
+ }
+ else if (arr.length === 4) {
+ topString = arr[0];
+ rightString = arr[1];
+ bottomString = arr[2];
+ leftString = arr[3];
+ }
- } else if (functionName === "circle") {
+ var top = common.cssValueToDevicePixels(topString, bounds.bottom);
+ var right = common.cssValueToDevicePixels("100%", bounds.right) - common.cssValueToDevicePixels(rightString, bounds.right);
+ var bottom = common.cssValueToDevicePixels("100%", bounds.bottom) - common.cssValueToDevicePixels(bottomString, bounds.bottom);
+ var left = common.cssValueToDevicePixels(leftString, bounds.right);
+
+ path = UIBezierPath.bezierPathWithRect(CGRectMake(left, top, right - left, bottom - top)).CGPath;
+ }
+ else if (functionName === "circle") {
var arr = value.split(/[\s]+/);
var radius = common.cssValueToDevicePixels(arr[0], (bounds.right > bounds.bottom ? bounds.bottom : bounds.right) / 2);
@@ -270,7 +303,8 @@ function drawClipPath(nativeView: UIView, background: common.Background) {
path = UIBezierPath.bezierPathWithArcCenterRadiusStartAngleEndAngleClockwise(CGPointMake(x, y), radius, 0, 360, true).CGPath;
- } else if (functionName === "ellipse") {
+ }
+ else if (functionName === "ellipse") {
var arr = value.split(/[\s]+/);
var rX = common.cssValueToDevicePixels(arr[0], bounds.right);
@@ -285,7 +319,8 @@ function drawClipPath(nativeView: UIView, background: common.Background) {
path = UIBezierPath.bezierPathWithOvalInRect(CGRectMake(left, top, width, height)).CGPath;
- } else if (functionName === "polygon") {
+ }
+ else if (functionName === "polygon") {
path = CGPathCreateMutable()
diff --git a/tns-core-modules/ui/styling/style.ts b/tns-core-modules/ui/styling/style.ts
index 6b4751415..d4ba5e119 100644
--- a/tns-core-modules/ui/styling/style.ts
+++ b/tns-core-modules/ui/styling/style.ts
@@ -300,7 +300,7 @@ function isNonNegativeFiniteNumber(value: number): boolean {
return isFinite(value) && !isNaN(value) && value >= 0;
}
-var supportedPaths = ["rect", "circle", "ellipse", "polygon"];
+var supportedPaths = ["rect", "circle", "ellipse", "polygon", "inset"];
function isClipPathValid(value: string): boolean {
if (!value) {
return true;