OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 5271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5282 RGBA32 c = Color::transparent; | 5282 RGBA32 c = Color::transparent; |
5283 if (!parseColorFromValue(value ? value : m_valueList->current(), c, acceptQu
irkyColors)) | 5283 if (!parseColorFromValue(value ? value : m_valueList->current(), c, acceptQu
irkyColors)) |
5284 return nullptr; | 5284 return nullptr; |
5285 return cssValuePool().createColorValue(c); | 5285 return cssValuePool().createColorValue(c); |
5286 } | 5286 } |
5287 | 5287 |
5288 bool CSSPropertyParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bo
ol acceptQuirkyColors) | 5288 bool CSSPropertyParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bo
ol acceptQuirkyColors) |
5289 { | 5289 { |
5290 if (acceptQuirkyColors && value->unit == CSSPrimitiveValue::CSS_NUMBER | 5290 if (acceptQuirkyColors && value->unit == CSSPrimitiveValue::CSS_NUMBER |
5291 && value->fValue >= 0. && value->fValue < 1000000.) { | 5291 && value->fValue >= 0. && value->fValue < 1000000.) { |
| 5292 if (!value->isInt) |
| 5293 return false; |
5292 String str = String::format("%06d", static_cast<int>((value->fValue+.5))
); | 5294 String str = String::format("%06d", static_cast<int>((value->fValue+.5))
); |
5293 if (!fastParseColor(c, str, !acceptQuirkyColors)) | 5295 if (!fastParseColor(c, str, !acceptQuirkyColors)) |
5294 return false; | 5296 return false; |
5295 } else if (acceptQuirkyColors && value->unit == CSSParserValue::DimensionLis
t) { | 5297 } else if (acceptQuirkyColors && value->unit == CSSParserValue::DimensionLis
t) { |
5296 CSSParserValue* numberToken = value->valueList->valueAt(0); | 5298 CSSParserValue* numberToken = value->valueList->valueAt(0); |
5297 CSSParserValue* unitToken = value->valueList->valueAt(1); | 5299 CSSParserValue* unitToken = value->valueList->valueAt(1); |
5298 ASSERT(numberToken->unit == CSSPrimitiveValue::CSS_NUMBER); | 5300 ASSERT(numberToken->unit == CSSPrimitiveValue::CSS_NUMBER); |
5299 ASSERT(unitToken->unit == CSSPrimitiveValue::CSS_IDENT); | 5301 ASSERT(unitToken->unit == CSSPrimitiveValue::CSS_IDENT); |
5300 if (!numberToken->isInt || numberToken->fValue < 0) | 5302 if (!numberToken->isInt || numberToken->fValue < 0) |
5301 return false; | 5303 return false; |
(...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8462 } | 8464 } |
8463 } | 8465 } |
8464 | 8466 |
8465 if (!list->length()) | 8467 if (!list->length()) |
8466 return nullptr; | 8468 return nullptr; |
8467 | 8469 |
8468 return list.release(); | 8470 return list.release(); |
8469 } | 8471 } |
8470 | 8472 |
8471 } // namespace blink | 8473 } // namespace blink |
OLD | NEW |