| 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 5334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5345 if (!parseColorFromValue(value ? value : m_valueList->current(), c, acceptQu
irkyColors)) | 5345 if (!parseColorFromValue(value ? value : m_valueList->current(), c, acceptQu
irkyColors)) |
| 5346 return nullptr; | 5346 return nullptr; |
| 5347 return cssValuePool().createColorValue(c); | 5347 return cssValuePool().createColorValue(c); |
| 5348 } | 5348 } |
| 5349 | 5349 |
| 5350 bool CSSPropertyParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bo
ol acceptQuirkyColors) | 5350 bool CSSPropertyParser::parseColorFromValue(CSSParserValue* value, RGBA32& c, bo
ol acceptQuirkyColors) |
| 5351 { | 5351 { |
| 5352 if (acceptQuirkyColors && value->unit == CSSPrimitiveValue::CSS_NUMBER | 5352 if (acceptQuirkyColors && value->unit == CSSPrimitiveValue::CSS_NUMBER |
| 5353 && value->fValue >= 0. && value->fValue < 1000000.) { | 5353 && value->fValue >= 0. && value->fValue < 1000000.) { |
| 5354 String str = String::format("%06d", static_cast<int>((value->fValue+.5))
); | 5354 String str = String::format("%06d", static_cast<int>((value->fValue+.5))
); |
| 5355 // FIXME: This should be strict parsing for SVG as well. | |
| 5356 if (!fastParseColor(c, str, !acceptQuirkyColors)) | 5355 if (!fastParseColor(c, str, !acceptQuirkyColors)) |
| 5357 return false; | 5356 return false; |
| 5358 } else if (acceptQuirkyColors && value->unit == CSSParserValue::DimensionLis
t) { | 5357 } else if (acceptQuirkyColors && value->unit == CSSParserValue::DimensionLis
t) { |
| 5359 CSSParserValue* numberToken = value->valueList->valueAt(0); | 5358 CSSParserValue* numberToken = value->valueList->valueAt(0); |
| 5360 CSSParserValue* unitToken = value->valueList->valueAt(1); | 5359 CSSParserValue* unitToken = value->valueList->valueAt(1); |
| 5361 ASSERT(numberToken->unit == CSSPrimitiveValue::CSS_NUMBER); | 5360 ASSERT(numberToken->unit == CSSPrimitiveValue::CSS_NUMBER); |
| 5362 ASSERT(unitToken->unit == CSSPrimitiveValue::CSS_IDENT); | 5361 ASSERT(unitToken->unit == CSSPrimitiveValue::CSS_IDENT); |
| 5363 if (!numberToken->isInt || numberToken->fValue < 0) | 5362 if (!numberToken->isInt || numberToken->fValue < 0) |
| 5364 return false; | 5363 return false; |
| 5365 String color = String::number(numberToken->fValue) + String(unitToken->s
tring); | 5364 String color = String::number(numberToken->fValue) + String(unitToken->s
tring); |
| (...skipping 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8547 } | 8546 } |
| 8548 } | 8547 } |
| 8549 | 8548 |
| 8550 if (!list->length()) | 8549 if (!list->length()) |
| 8551 return nullptr; | 8550 return nullptr; |
| 8552 | 8551 |
| 8553 return list.release(); | 8552 return list.release(); |
| 8554 } | 8553 } |
| 8555 | 8554 |
| 8556 } // namespace blink | 8555 } // namespace blink |
| OLD | NEW |