OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2011 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 if (hasCSSPropertyNamePrefix(propertyName, "css")) { | 125 if (hasCSSPropertyNamePrefix(propertyName, "css")) { |
126 hasSeenCssPrefix = true; | 126 hasSeenCssPrefix = true; |
127 i += 3; | 127 i += 3; |
128 } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")) { | 128 } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")) { |
129 builder.append('-'); | 129 builder.append('-'); |
130 } else if (isASCIIUpper(propertyName[0])) { | 130 } else if (isASCIIUpper(propertyName[0])) { |
131 return 0; | 131 return 0; |
132 } | 132 } |
133 | 133 |
| 134 bool hasSeenUpper = isASCIIUpper(propertyName[i]); |
| 135 |
134 builder.append(toASCIILower(propertyName[i++])); | 136 builder.append(toASCIILower(propertyName[i++])); |
135 | 137 |
136 for (; i < length; ++i) { | 138 for (; i < length; ++i) { |
137 UChar c = propertyName[i]; | 139 UChar c = propertyName[i]; |
138 if (!isASCIIUpper(c)) { | 140 if (!isASCIIUpper(c)) { |
139 if (c == '-') | 141 if (c == '-') |
140 hasSeenDash = true; | 142 hasSeenDash = true; |
141 builder.append(c); | 143 builder.append(c); |
142 } | 144 } |
143 else { | 145 else { |
| 146 hasSeenUpper = true; |
144 builder.append('-'); | 147 builder.append('-'); |
145 builder.append(toASCIILower(c)); | 148 builder.append(toASCIILower(c)); |
146 } | 149 } |
147 } | 150 } |
148 | 151 |
| 152 // Reject names containing both dashes and upper-case characters, such a
s "border-rightColor". |
| 153 if (hasSeenDash && hasSeenUpper) |
| 154 return 0; |
| 155 |
149 String propName = builder.toString(); | 156 String propName = builder.toString(); |
150 CSSPropertyID propertyID = cssPropertyID(propName); | 157 CSSPropertyID propertyID = cssPropertyID(propName); |
151 if (propertyID && RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)) { | 158 if (propertyID && RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID)) { |
152 propInfo = new CSSPropertyInfo(); | 159 propInfo = new CSSPropertyInfo(); |
153 propInfo->propID = propertyID; | 160 propInfo->propID = propertyID; |
154 propInfo->nameWithDash = hasSeenDash; | 161 propInfo->nameWithDash = hasSeenDash; |
155 propInfo->nameWithCssPrefix = hasSeenCssPrefix; | 162 propInfo->nameWithCssPrefix = hasSeenCssPrefix; |
156 map.add(propertyName, propInfo); | 163 map.add(propertyName, propInfo); |
157 } | 164 } |
158 } | 165 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 ExceptionState exceptionState(ExceptionState::SetterContext, getPropertyName
(static_cast<CSSPropertyID>(propInfo->propID)), "CSSStyleDeclaration", info.Hold
er(), info.GetIsolate()); | 243 ExceptionState exceptionState(ExceptionState::SetterContext, getPropertyName
(static_cast<CSSPropertyID>(propInfo->propID)), "CSSStyleDeclaration", info.Hold
er(), info.GetIsolate()); |
237 imp->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), prope
rtyValue, false, exceptionState); | 244 imp->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), prope
rtyValue, false, exceptionState); |
238 | 245 |
239 if (exceptionState.throwIfNeeded()) | 246 if (exceptionState.throwIfNeeded()) |
240 return; | 247 return; |
241 | 248 |
242 v8SetReturnValue(info, value); | 249 v8SetReturnValue(info, value); |
243 } | 250 } |
244 | 251 |
245 } // namespace WebCore | 252 } // namespace WebCore |
OLD | NEW |