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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 Color resolve(Color currentColor) const { | 54 Color resolve(Color currentColor) const { |
55 return m_currentColor ? currentColor : m_color; | 55 return m_currentColor ? currentColor : m_color; |
56 } | 56 } |
57 | 57 |
58 static Color colorFromKeyword(CSSValueID); | 58 static Color colorFromKeyword(CSSValueID); |
59 static bool isColorKeyword(CSSValueID); | 59 static bool isColorKeyword(CSSValueID); |
60 static bool isSystemColor(CSSValueID); | 60 static bool isSystemColor(CSSValueID); |
61 | 61 |
| 62 protected: |
| 63 Color color() const { return m_color; } |
| 64 void setCurrentColor(bool currentColor) { m_currentColor = currentColor; } |
| 65 |
62 private: | 66 private: |
63 Color m_color; | 67 Color m_color; |
64 bool m_currentColor; | 68 bool m_currentColor; |
65 }; | 69 }; |
66 | 70 |
67 inline bool operator==(const StyleColor& a, const StyleColor& b) { | 71 inline bool operator==(const StyleColor& a, const StyleColor& b) { |
68 if (a.isCurrentColor() || b.isCurrentColor()) | 72 if (a.isCurrentColor() || b.isCurrentColor()) |
69 return a.isCurrentColor() && b.isCurrentColor(); | 73 return a.isCurrentColor() && b.isCurrentColor(); |
70 return a.getColor() == b.getColor(); | 74 return a.getColor() == b.getColor(); |
71 } | 75 } |
72 | 76 |
73 inline bool operator!=(const StyleColor& a, const StyleColor& b) { | 77 inline bool operator!=(const StyleColor& a, const StyleColor& b) { |
74 return !(a == b); | 78 return !(a == b); |
75 } | 79 } |
76 | 80 |
77 } // namespace blink | 81 } // namespace blink |
78 | 82 |
79 #endif // StyleColor_h | 83 #endif // StyleColor_h |
OLD | NEW |