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
08ca7622
Commit
08ca7622
authored
Sep 06, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding bounds-checking to the hsl built-in.
parent
9dc4a0d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
functions.cpp
functions.cpp
+9
-4
No files found.
functions.cpp
View file @
08ca7622
...
...
@@ -229,10 +229,15 @@ namespace Sass {
bindings
[
parameter_names
[
1
].
token
()].
is_numeric
()
&&
bindings
[
parameter_names
[
2
].
token
()].
is_numeric
()))
{
throw_eval_error
(
"arguments to hsl must be numeric"
,
bindings
[
parameter_names
[
0
].
token
()].
path
(),
bindings
[
parameter_names
[
0
].
token
()].
line
());
}
double
h
=
bindings
[
parameter_names
[
0
].
token
()].
numeric_value
();
double
s
=
bindings
[
parameter_names
[
1
].
token
()].
numeric_value
();
double
l
=
bindings
[
parameter_names
[
2
].
token
()].
numeric_value
();
}
Node
hn
(
bindings
[
parameter_names
[
0
].
token
()]);
Node
sn
(
bindings
[
parameter_names
[
1
].
token
()]);
Node
ln
(
bindings
[
parameter_names
[
2
].
token
()]);
double
h
=
hn
.
numeric_value
();
double
s
=
sn
.
numeric_value
();
double
l
=
ln
.
numeric_value
();
if
(
s
<
0
||
100
<
s
)
throw_eval_error
(
"saturation must be between 0% and 100% for 'hsl'"
,
sn
.
path
(),
sn
.
line
());
if
(
l
<
0
||
100
<
l
)
throw_eval_error
(
"lightness must be between 0% and 100% for 'hsl'"
,
ln
.
path
(),
ln
.
line
());
Node
color
(
hsla_impl
(
h
,
s
,
l
,
1
,
new_Node
));
return
color
;
}
...
...
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