Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 parsedColor = canvas ? currentColor(canvas) : Color::black; | 72 parsedColor = canvas ? currentColor(canvas) : Color::black; |
| 73 return true; | 73 return true; |
| 74 case ParseFailed: | 74 case ParseFailed: |
| 75 return false; | 75 return false; |
| 76 default: | 76 default: |
| 77 ASSERT_NOT_REACHED(); | 77 ASSERT_NOT_REACHED(); |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool parseColorOnly(Color& parsedColor, const String& colorString) | |
|
Justin Novosad
2016/03/17 18:46:10
You could have continued to used the old parseColo
ikilpatrick
2016/03/17 19:15:41
Ah. That's great. Thanks. Done.
| |
| 83 { | |
| 84 ColorParseResult parseResult = parseColor(parsedColor, colorString); | |
| 85 switch (parseResult) { | |
| 86 case ParsedRGBA: | |
| 87 case ParsedSystemColor: | |
| 88 return true; | |
| 89 case ParsedCurrentColor: | |
| 90 case ParseFailed: | |
| 91 return false; | |
| 92 default: | |
| 93 ASSERT_NOT_REACHED(); | |
| 94 return false; | |
| 95 } | |
| 96 } | |
| 97 | |
| 82 CanvasStyle::CanvasStyle(RGBA32 rgba) | 98 CanvasStyle::CanvasStyle(RGBA32 rgba) |
| 83 : m_type(ColorRGBA) | 99 : m_type(ColorRGBA) |
| 84 , m_rgba(rgba) | 100 , m_rgba(rgba) |
| 85 { | 101 { |
| 86 } | 102 } |
| 87 | 103 |
| 88 CanvasStyle::CanvasStyle(CanvasGradient* gradient) | 104 CanvasStyle::CanvasStyle(CanvasGradient* gradient) |
| 89 : m_type(Gradient) | 105 : m_type(Gradient) |
| 90 , m_gradient(gradient) | 106 , m_gradient(gradient) |
| 91 { | 107 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 return Color::black; | 150 return Color::black; |
| 135 } | 151 } |
| 136 | 152 |
| 137 DEFINE_TRACE(CanvasStyle) | 153 DEFINE_TRACE(CanvasStyle) |
| 138 { | 154 { |
| 139 visitor->trace(m_gradient); | 155 visitor->trace(m_gradient); |
| 140 visitor->trace(m_pattern); | 156 visitor->trace(m_pattern); |
| 141 } | 157 } |
| 142 | 158 |
| 143 } // namespace blink | 159 } // namespace blink |
| OLD | NEW |