| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 CSSPropertyIDMap::iterator iter = map.find(propertyName); | 144 CSSPropertyIDMap::iterator iter = map.find(propertyName); |
| 145 if (iter != map.end()) | 145 if (iter != map.end()) |
| 146 return iter->value; | 146 return iter->value; |
| 147 | 147 |
| 148 CSSPropertyID unresolvedProperty = parseCSSPropertyID(isolate, propertyName)
; | 148 CSSPropertyID unresolvedProperty = parseCSSPropertyID(isolate, propertyName)
; |
| 149 map.add(propertyName, unresolvedProperty); | 149 map.add(propertyName, unresolvedProperty); |
| 150 ASSERT(!unresolvedProperty || CSSPropertyMetadata::isEnabledProperty(unresol
vedProperty)); | 150 ASSERT(!unresolvedProperty || CSSPropertyMetadata::isEnabledProperty(unresol
vedProperty)); |
| 151 return unresolvedProperty; | 151 return unresolvedProperty; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::Name> v8Name,
const v8::PropertyCallbackInfo<v8::Integer>& info) |
| 155 { |
| 156 if (!v8Name->IsString()) |
| 157 return; |
| 158 // NOTE: cssPropertyInfo lookups incur several mallocs. |
| 159 // Successful lookups have the same cost the first time, but are cached. |
| 160 if (cssPropertyInfo(v8Name.As<v8::String>(), info.GetIsolate())) { |
| 161 v8SetReturnValueInt(info, 0); |
| 162 return; |
| 163 } |
| 164 } |
| 165 |
| 154 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) | 166 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 155 { | 167 { |
| 156 // Search the style declaration. | 168 // Search the style declaration. |
| 157 CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>(), in
fo.GetIsolate()); | 169 CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>(), in
fo.GetIsolate()); |
| 158 | 170 |
| 159 // Do not handle non-property names. | 171 // Do not handle non-property names. |
| 160 if (!unresolvedProperty) | 172 if (!unresolvedProperty) |
| 161 return; | 173 return; |
| 162 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); | 174 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); |
| 163 | 175 |
| 164 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder()); | 176 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder()); |
| 165 RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(re
solvedProperty); | 177 RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(re
solvedProperty); |
| 166 if (cssValue) { | 178 if (cssValue) { |
| 167 v8SetReturnValueStringOrNull(info, cssValue->cssText(), info.GetIsolate(
)); | 179 v8SetReturnValueStringOrNull(info, cssValue->cssText(), info.GetIsolate(
)); |
| 168 return; | 180 return; |
| 169 } | 181 } |
| 170 | 182 |
| 171 String result = impl->getPropertyValueInternal(resolvedProperty); | 183 String result = impl->getPropertyValueInternal(resolvedProperty); |
| 172 v8SetReturnValueString(info, result, info.GetIsolate()); | 184 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 173 } | 185 } |
| 174 | 186 |
| 175 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |