| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (propertyName[i] != prefix[i]) | 77 if (propertyName[i] != prefix[i]) |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 struct CSSPropertyInfo { | 83 struct CSSPropertyInfo { |
| 84 CSSPropertyID propID; | 84 CSSPropertyID propID; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 static CSSPropertyID parseCSSPropertyID(const String& propertyName, v8::Isolate*
isolate) | 87 static CSSPropertyID parseCSSPropertyID(v8::Isolate* isolate, const String& prop
ertyName) |
| 88 { | 88 { |
| 89 unsigned length = propertyName.length(); | 89 unsigned length = propertyName.length(); |
| 90 if (!length) | 90 if (!length) |
| 91 return CSSPropertyInvalid; | 91 return CSSPropertyInvalid; |
| 92 | 92 |
| 93 StringBuilder builder; | 93 StringBuilder builder; |
| 94 builder.reserveCapacity(length); | 94 builder.reserveCapacity(length); |
| 95 | 95 |
| 96 unsigned i = 0; | 96 unsigned i = 0; |
| 97 bool hasSeenDash = false; | 97 bool hasSeenDash = false; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // | 141 // |
| 142 // Also, certain prefixes such as 'css-' are stripped. | 142 // Also, certain prefixes such as 'css-' are stripped. |
| 143 static CSSPropertyInfo* cssPropertyInfo(v8::Local<v8::String> v8PropertyName, v8
::Isolate* isolate) | 143 static CSSPropertyInfo* cssPropertyInfo(v8::Local<v8::String> v8PropertyName, v8
::Isolate* isolate) |
| 144 { | 144 { |
| 145 String propertyName = toCoreString(v8PropertyName); | 145 String propertyName = toCoreString(v8PropertyName); |
| 146 typedef HashMap<String, CSSPropertyInfo*> CSSPropertyInfoMap; | 146 typedef HashMap<String, CSSPropertyInfo*> CSSPropertyInfoMap; |
| 147 DEFINE_STATIC_LOCAL(CSSPropertyInfoMap, map, ()); | 147 DEFINE_STATIC_LOCAL(CSSPropertyInfoMap, map, ()); |
| 148 CSSPropertyInfo* propInfo = map.get(propertyName); | 148 CSSPropertyInfo* propInfo = map.get(propertyName); |
| 149 if (!propInfo) { | 149 if (!propInfo) { |
| 150 propInfo = new CSSPropertyInfo(); | 150 propInfo = new CSSPropertyInfo(); |
| 151 propInfo->propID = parseCSSPropertyID(propertyName, isolate); | 151 propInfo->propID = parseCSSPropertyID(isolate, propertyName); |
| 152 map.add(propertyName, propInfo); | 152 map.add(propertyName, propInfo); |
| 153 } | 153 } |
| 154 if (!propInfo->propID) | 154 if (!propInfo->propID) |
| 155 return 0; | 155 return 0; |
| 156 ASSERT(CSSPropertyMetadata::isEnabledProperty(propInfo->propID)); | 156 ASSERT(CSSPropertyMetadata::isEnabledProperty(propInfo->propID)); |
| 157 return propInfo; | 157 return propInfo; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void V8CSSStyleDeclaration::namedPropertyEnumeratorCustom(const v8::PropertyCall
backInfo<v8::Array>& info) | 160 void V8CSSStyleDeclaration::namedPropertyEnumeratorCustom(const v8::PropertyCall
backInfo<v8::Array>& info) |
| 161 { | 161 { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 ExceptionState exceptionState(ExceptionState::SetterContext, getPropertyName
(resolveCSSPropertyID(propInfo->propID)), "CSSStyleDeclaration", info.Holder(),
info.GetIsolate()); | 229 ExceptionState exceptionState(ExceptionState::SetterContext, getPropertyName
(resolveCSSPropertyID(propInfo->propID)), "CSSStyleDeclaration", info.Holder(),
info.GetIsolate()); |
| 230 impl->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), prop
ertyValue, false, exceptionState); | 230 impl->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), prop
ertyValue, false, exceptionState); |
| 231 | 231 |
| 232 if (exceptionState.throwIfNeeded()) | 232 if (exceptionState.throwIfNeeded()) |
| 233 return; | 233 return; |
| 234 | 234 |
| 235 v8SetReturnValue(info, value); | 235 v8SetReturnValue(info, value); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |