Skip to content

Commit

Permalink
Merge pull request #1755 from mgreter/bugfix/static-colors
Browse files Browse the repository at this point in the history
Remove `sixtuplet` flag on Colors and fix edge case
  • Loading branch information
mgreter committed Nov 25, 2015
2 parents 459aefe + f856559 commit a276e52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,12 +1267,11 @@ namespace Sass {
ADD_HASHED(double, g)
ADD_HASHED(double, b)
ADD_HASHED(double, a)
ADD_PROPERTY(bool, sixtuplet)
ADD_PROPERTY(std::string, disp)
size_t hash_;
public:
Color(ParserState pstate, double r, double g, double b, double a = 1, bool sixtuplet = true, const std::string disp = "")
: Value(pstate), r_(r), g_(g), b_(b), a_(a), sixtuplet_(sixtuplet), disp_(disp),
Color(ParserState pstate, double r, double g, double b, double a = 1, const std::string disp = "")
: Value(pstate), r_(r), g_(g), b_(b), a_(a), disp_(disp),
hash_(0)
{ concrete_type(COLOR); }
std::string type() { return "color"; }
Expand Down
7 changes: 3 additions & 4 deletions src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ namespace Sass {
static_cast<double>(strtol(r.c_str(), NULL, 16)),
static_cast<double>(strtol(g.c_str(), NULL, 16)),
static_cast<double>(strtol(b.c_str(), NULL, 16)),
1, true,
1, // alpha channel
t->value());
}
else {
Expand All @@ -880,7 +880,7 @@ namespace Sass {
static_cast<double>(strtol(std::string(2,hext[0]).c_str(), NULL, 16)),
static_cast<double>(strtol(std::string(2,hext[1]).c_str(), NULL, 16)),
static_cast<double>(strtol(std::string(2,hext[2]).c_str(), NULL, 16)),
1, false,
1, // alpha channel
t->value());
}
} break;
Expand Down Expand Up @@ -1271,7 +1271,6 @@ namespace Sass {
Value* Eval::op_number_color(Memory_Manager& mem, enum Sass_OP op, const Number& l, const Color& rh, bool compressed, int precision, ParserState* pstate)
{
Color r(rh);
r.disp("");
double lv = l.value();
switch (op) {
case Sass_OP::ADD:
Expand All @@ -1286,7 +1285,7 @@ namespace Sass {
case Sass_OP::SUB:
case Sass_OP::DIV: {
std::string sep(op == Sass_OP::SUB ? "-" : "/");
std::string color(r.to_string(compressed||!r.sixtuplet(), precision));
std::string color(r.to_string(compressed, precision));
return SASS_MEMORY_NEW(mem, String_Quoted,
pstate ? *pstate : l.pstate(),
l.to_string(compressed, precision)
Expand Down

0 comments on commit a276e52

Please sign in to comment.