| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "modules/canvas2d/CanvasStyle.h" | 29 #include "modules/canvas2d/CanvasStyle.h" |
| 30 | 30 |
| 31 #include "core/CSSPropertyNames.h" | 31 #include "core/CSSPropertyNames.h" |
| 32 #include "core/css/StylePropertySet.h" | 32 #include "core/css/StylePropertySet.h" |
| 33 #include "core/css/parser/CSSParser.h" | 33 #include "core/css/parser/CSSParser.h" |
| 34 #include "core/html/HTMLCanvasElement.h" | 34 #include "core/html/HTMLCanvasElement.h" |
| 35 #include "core/html/parser/HTMLParserIdioms.h" |
| 35 #include "modules/canvas2d/CanvasGradient.h" | 36 #include "modules/canvas2d/CanvasGradient.h" |
| 36 #include "modules/canvas2d/CanvasPattern.h" | 37 #include "modules/canvas2d/CanvasPattern.h" |
| 37 #include "platform/graphics/skia/SkiaUtils.h" | 38 #include "platform/graphics/skia/SkiaUtils.h" |
| 38 #include "third_party/skia/include/core/SkShader.h" | 39 #include "third_party/skia/include/core/SkShader.h" |
| 39 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 enum ColorParseResult { | 44 enum ColorParseResult { |
| 44 ParsedRGBA, | 45 ParsedRGBA, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 64 return Color::black; | 65 return Color::black; |
| 65 Color color = Color::black; | 66 Color color = Color::black; |
| 66 CSSParser::parseColor( | 67 CSSParser::parseColor( |
| 67 color, canvas->inlineStyle()->getPropertyValue(CSSPropertyColor)); | 68 color, canvas->inlineStyle()->getPropertyValue(CSSPropertyColor)); |
| 68 return color; | 69 return color; |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool parseColorOrCurrentColor(Color& parsedColor, | 72 bool parseColorOrCurrentColor(Color& parsedColor, |
| 72 const String& colorString, | 73 const String& colorString, |
| 73 HTMLCanvasElement* canvas) { | 74 HTMLCanvasElement* canvas) { |
| 74 ColorParseResult parseResult = parseColor(parsedColor, colorString); | 75 ColorParseResult parseResult = |
| 76 parseColor(parsedColor, colorString.stripWhiteSpace(isHTMLSpace<UChar>)); |
| 75 switch (parseResult) { | 77 switch (parseResult) { |
| 76 case ParsedRGBA: | 78 case ParsedRGBA: |
| 77 case ParsedSystemColor: | 79 case ParsedSystemColor: |
| 78 return true; | 80 return true; |
| 79 case ParsedCurrentColor: | 81 case ParsedCurrentColor: |
| 80 parsedColor = canvas ? currentColor(canvas) : Color::black; | 82 parsedColor = canvas ? currentColor(canvas) : Color::black; |
| 81 return true; | 83 return true; |
| 82 case ParseFailed: | 84 case ParseFailed: |
| 83 return false; | 85 return false; |
| 84 default: | 86 default: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 ASSERT(m_type == Gradient || m_type == ImagePattern); | 130 ASSERT(m_type == Gradient || m_type == ImagePattern); |
| 129 return Color::black; | 131 return Color::black; |
| 130 } | 132 } |
| 131 | 133 |
| 132 DEFINE_TRACE(CanvasStyle) { | 134 DEFINE_TRACE(CanvasStyle) { |
| 133 visitor->trace(m_gradient); | 135 visitor->trace(m_gradient); |
| 134 visitor->trace(m_pattern); | 136 visitor->trace(m_pattern); |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace blink | 139 } // namespace blink |
| OLD | NEW |