Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
835c9c76
Commit
835c9c76
authored
Sep 06, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding bounds-checking for lighten, darken, saturate, and desaturate.
parent
86872644
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
functions.cpp
functions.cpp
+8
-0
No files found.
functions.cpp
View file @
835c9c76
...
...
@@ -321,6 +321,8 @@ namespace Sass {
Node
amount
(
bindings
[
parameter_names
[
1
].
token
()]);
if
(
rgb_col
.
type
()
!=
Node
::
numeric_color
)
throw_eval_error
(
"first argument to lighten must be a color"
,
rgb_col
.
path
(),
rgb_col
.
line
());
if
(
!
amount
.
is_numeric
())
throw_eval_error
(
"second argument to lighten must be numeric"
,
amount
.
path
(),
amount
.
line
());
double
amt
=
amount
.
numeric_value
();
if
(
amt
<
0
||
100
<
amt
)
throw_eval_error
(
"amount must be between 0% and 100% for 'lighten'"
,
amount
.
path
(),
amount
.
line
());
Node
hsl_col
(
rgb_to_hsl
(
rgb_col
[
0
].
numeric_value
(),
rgb_col
[
1
].
numeric_value
(),
rgb_col
[
2
].
numeric_value
(),
...
...
@@ -338,6 +340,8 @@ namespace Sass {
Node
amount
(
bindings
[
parameter_names
[
1
].
token
()]);
if
(
rgb_col
.
type
()
!=
Node
::
numeric_color
)
throw_eval_error
(
"first argument to darken must be a color"
,
rgb_col
.
path
(),
rgb_col
.
line
());
if
(
!
amount
.
is_numeric
())
throw_eval_error
(
"second argument to darken must be numeric"
,
amount
.
path
(),
amount
.
line
());
double
amt
=
amount
.
numeric_value
();
if
(
amt
<
0
||
100
<
amt
)
throw_eval_error
(
"amount must be between 0% and 100% for 'darken'"
,
amount
.
path
(),
amount
.
line
());
Node
hsl_col
(
rgb_to_hsl
(
rgb_col
[
0
].
numeric_value
(),
rgb_col
[
1
].
numeric_value
(),
rgb_col
[
2
].
numeric_value
(),
...
...
@@ -355,6 +359,8 @@ namespace Sass {
Node
amount
(
bindings
[
parameter_names
[
1
].
token
()]);
if
(
rgb_col
.
type
()
!=
Node
::
numeric_color
)
throw_eval_error
(
"first argument to saturate must be a color"
,
rgb_col
.
path
(),
rgb_col
.
line
());
if
(
!
amount
.
is_numeric
())
throw_eval_error
(
"second argument to saturate must be numeric"
,
amount
.
path
(),
amount
.
line
());
double
amt
=
amount
.
numeric_value
();
if
(
amt
<
0
||
100
<
amt
)
throw_eval_error
(
"amount must be between 0% and 100% for 'saturate'"
,
amount
.
path
(),
amount
.
line
());
Node
hsl_col
(
rgb_to_hsl
(
rgb_col
[
0
].
numeric_value
(),
rgb_col
[
1
].
numeric_value
(),
rgb_col
[
2
].
numeric_value
(),
...
...
@@ -372,6 +378,8 @@ namespace Sass {
Node
amount
(
bindings
[
parameter_names
[
1
].
token
()]);
if
(
rgb_col
.
type
()
!=
Node
::
numeric_color
)
throw_eval_error
(
"first argument to desaturate must be a color"
,
rgb_col
.
path
(),
rgb_col
.
line
());
if
(
!
amount
.
is_numeric
())
throw_eval_error
(
"second argument to desaturate must be numeric"
,
amount
.
path
(),
amount
.
line
());
double
amt
=
amount
.
numeric_value
();
if
(
amt
<
0
||
100
<
amt
)
throw_eval_error
(
"amount must be between 0% and 100% for 'desaturate'"
,
amount
.
path
(),
amount
.
line
());
Node
hsl_col
(
rgb_to_hsl
(
rgb_col
[
0
].
numeric_value
(),
rgb_col
[
1
].
numeric_value
(),
rgb_col
[
2
].
numeric_value
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment