From d972c5064efea8297a1cae05b603f3b7a26809c6 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Thu, 18 Jul 2019 00:36:14 -0400 Subject: [PATCH] fix: throw on weitht passed to CSS3 invert() See https://github.com/sass/sass-spec/pull/1444 Closes #2899 --- src/fn_colors.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fn_colors.cpp b/src/fn_colors.cpp index 64ce38048..e59b23319 100644 --- a/src/fn_colors.cpp +++ b/src/fn_colors.cpp @@ -361,12 +361,16 @@ namespace Sass { { // CSS3 filter function overload: pass literal through directly Number* amount = Cast(env["$color"]); + double weight = DARG_U_PRCT("$weight"); if (amount) { + // TODO: does not throw on 100% manually passed as value + if (weight < 100.0) { + error("Only one argument may be passed to the plain-CSS invert() function.", pstate, traces); + } return SASS_MEMORY_NEW(String_Quoted, pstate, "invert(" + amount->to_string(ctx.c_options) + ")"); } Color* col = ARG("$color", Color); - double weight = DARG_U_PRCT("$weight"); Color_RGBA_Obj inv = col->copyAsRGBA(); inv->r(clip(255.0 - inv->r(), 0.0, 255.0)); inv->g(clip(255.0 - inv->g(), 0.0, 255.0));