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 | |
166 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) | 154 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) |
167 { | 155 { |
168 // Search the style declaration. | 156 // Search the style declaration. |
169 CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>(), in
fo.GetIsolate()); | 157 CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>(), in
fo.GetIsolate()); |
170 | 158 |
171 // Do not handle non-property names. | 159 // Do not handle non-property names. |
172 if (!unresolvedProperty) | 160 if (!unresolvedProperty) |
173 return; | 161 return; |
174 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); | 162 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); |
175 | 163 |
176 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder()); | 164 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder()); |
177 RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(re
solvedProperty); | 165 RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(re
solvedProperty); |
178 if (cssValue) { | 166 if (cssValue) { |
179 v8SetReturnValueStringOrNull(info, cssValue->cssText(), info.GetIsolate(
)); | 167 v8SetReturnValueStringOrNull(info, cssValue->cssText(), info.GetIsolate(
)); |
180 return; | 168 return; |
181 } | 169 } |
182 | 170 |
183 String result = impl->getPropertyValueInternal(resolvedProperty); | 171 String result = impl->getPropertyValueInternal(resolvedProperty); |
184 v8SetReturnValueString(info, result, info.GetIsolate()); | 172 v8SetReturnValueString(info, result, info.GetIsolate()); |
185 } | 173 } |
186 | 174 |
187 } // namespace blink | 175 } // namespace blink |
OLD | NEW |