| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 StyleColor() : m_currentColor(true) { } | 43 StyleColor() : m_currentColor(true) { } |
| 44 StyleColor(Color color) : m_color(color), m_currentColor(false) { } | 44 StyleColor(Color color) : m_color(color), m_currentColor(false) { } |
| 45 static StyleColor currentColor() { return StyleColor(); } | 45 static StyleColor currentColor() { return StyleColor(); } |
| 46 | 46 |
| 47 bool isCurrentColor() const { return m_currentColor; } | 47 bool isCurrentColor() const { return m_currentColor; } |
| 48 Color getColor() const { ASSERT(!isCurrentColor()); return m_color; } | 48 Color getColor() const { ASSERT(!isCurrentColor()); return m_color; } |
| 49 | 49 |
| 50 Color resolve(Color currentColor) const { return m_currentColor ? currentCol
or : m_color; } | 50 Color resolve(Color currentColor) const { return m_currentColor ? currentCol
or : m_color; } |
| 51 | 51 |
| 52 static Color colorFromKeyword(CSSValueID); | 52 static Color colorFromKeyword(CSSValueID); |
| 53 static bool isColorKeyword(CSSValueID); |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 Color m_color; | 56 Color m_color; |
| 56 bool m_currentColor; | 57 bool m_currentColor; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 inline bool operator==(const StyleColor& a, const StyleColor& b) | 60 inline bool operator==(const StyleColor& a, const StyleColor& b) |
| 60 { | 61 { |
| 61 if (a.isCurrentColor() || b.isCurrentColor()) | 62 if (a.isCurrentColor() || b.isCurrentColor()) |
| 62 return a.isCurrentColor() && b.isCurrentColor(); | 63 return a.isCurrentColor() && b.isCurrentColor(); |
| 63 return a.getColor() == b.getColor(); | 64 return a.getColor() == b.getColor(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 inline bool operator!=(const StyleColor& a, const StyleColor& b) | 67 inline bool operator!=(const StyleColor& a, const StyleColor& b) |
| 67 { | 68 { |
| 68 return !(a == b); | 69 return !(a == b); |
| 69 } | 70 } |
| 70 | 71 |
| 71 | 72 |
| 72 } // namespace blink | 73 } // namespace blink |
| 73 | 74 |
| 74 #endif // StyleColor_h | 75 #endif // StyleColor_h |
| OLD | NEW |