OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool ColorInputType::supportsRequired() const | 82 bool ColorInputType::supportsRequired() const |
83 { | 83 { |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 String ColorInputType::fallbackValue() | 87 String ColorInputType::fallbackValue() |
88 { | 88 { |
89 return String("#000000"); | 89 return String("#000000"); |
90 } | 90 } |
91 | 91 |
92 String ColorInputType::sanitizeValue(const String& proposedValue) | 92 String ColorInputType::sanitizeValue(const String& proposedValue) const |
93 { | 93 { |
94 if (proposedValue.isNull()) | |
95 return proposedValue; | |
96 | |
97 if (!isValidColorString(proposedValue)) | 94 if (!isValidColorString(proposedValue)) |
98 return fallbackValue(); | 95 return fallbackValue(); |
99 | 96 |
100 return proposedValue.lower(); | 97 return proposedValue.lower(); |
101 } | 98 } |
102 | 99 |
103 Color ColorInputType::valueAsColor() const | 100 Color ColorInputType::valueAsColor() const |
104 { | 101 { |
105 return Color(element()->value()); | 102 return Color(element()->value()); |
106 } | 103 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 196 |
200 HTMLElement* ColorInputType::shadowColorSwatch() const | 197 HTMLElement* ColorInputType::shadowColorSwatch() const |
201 { | 198 { |
202 ShadowRoot* shadow = element()->shadowRoot(); | 199 ShadowRoot* shadow = element()->shadowRoot(); |
203 return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0; | 200 return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0; |
204 } | 201 } |
205 | 202 |
206 } // namespace WebCore | 203 } // namespace WebCore |
207 | 204 |
208 #endif // ENABLE(INPUT_COLOR) | 205 #endif // ENABLE(INPUT_COLOR) |
OLD | NEW |