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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "core/events/EventTarget.h" | 42 #include "core/events/EventTarget.h" |
43 #include "core/html/custom/CEReactionsScope.h" | 43 #include "core/html/custom/CEReactionsScope.h" |
44 #include "platform/wtf/ASCIICType.h" | 44 #include "platform/wtf/ASCIICType.h" |
45 #include "platform/wtf/PassRefPtr.h" | 45 #include "platform/wtf/PassRefPtr.h" |
46 #include "platform/wtf/RefPtr.h" | 46 #include "platform/wtf/RefPtr.h" |
47 #include "platform/wtf/StdLibExtras.h" | 47 #include "platform/wtf/StdLibExtras.h" |
48 #include "platform/wtf/Vector.h" | 48 #include "platform/wtf/Vector.h" |
49 #include "platform/wtf/text/StringBuilder.h" | 49 #include "platform/wtf/text/StringBuilder.h" |
50 #include "platform/wtf/text/StringConcatenate.h" | 50 #include "platform/wtf/text/StringConcatenate.h" |
51 | 51 |
52 using namespace WTF; | |
53 | |
54 namespace blink { | 52 namespace blink { |
55 | 53 |
56 // Check for a CSS prefix. | 54 // Check for a CSS prefix. |
57 // Passed prefix is all lowercase. | 55 // Passed prefix is all lowercase. |
58 // First character of the prefix within the property name may be upper or | 56 // First character of the prefix within the property name may be upper or |
59 // lowercase. | 57 // lowercase. |
60 // Other characters in the prefix within the property name must be lowercase. | 58 // Other characters in the prefix within the property name must be lowercase. |
61 // The prefix within the property name must be followed by a capital letter. | 59 // The prefix within the property name must be followed by a capital letter. |
62 static bool HasCSSPropertyNamePrefix(const String& property_name, | 60 static bool HasCSSPropertyNamePrefix(const String& property_name, |
63 const char* prefix) { | 61 const char* prefix) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, property_names, ()); | 152 DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, property_names, ()); |
155 static unsigned property_names_length = 0; | 153 static unsigned property_names_length = 0; |
156 | 154 |
157 if (property_names.IsEmpty()) { | 155 if (property_names.IsEmpty()) { |
158 for (int id = firstCSSProperty; id <= lastCSSProperty; ++id) { | 156 for (int id = firstCSSProperty; id <= lastCSSProperty; ++id) { |
159 CSSPropertyID property_id = static_cast<CSSPropertyID>(id); | 157 CSSPropertyID property_id = static_cast<CSSPropertyID>(id); |
160 if (CSSPropertyMetadata::IsEnabledProperty(property_id)) | 158 if (CSSPropertyMetadata::IsEnabledProperty(property_id)) |
161 property_names.push_back(getJSPropertyName(property_id)); | 159 property_names.push_back(getJSPropertyName(property_id)); |
162 } | 160 } |
163 std::sort(property_names.begin(), property_names.end(), | 161 std::sort(property_names.begin(), property_names.end(), |
164 CodePointCompareLessThan); | 162 WTF::CodePointCompareLessThan); |
165 property_names_length = property_names.size(); | 163 property_names_length = property_names.size(); |
166 } | 164 } |
167 | 165 |
168 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); | 166 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); |
169 v8::Local<v8::Array> properties = | 167 v8::Local<v8::Array> properties = |
170 v8::Array::New(info.GetIsolate(), property_names_length); | 168 v8::Array::New(info.GetIsolate(), property_names_length); |
171 for (unsigned i = 0; i < property_names_length; ++i) { | 169 for (unsigned i = 0; i < property_names_length; ++i) { |
172 String key = property_names.at(i); | 170 String key = property_names.at(i); |
173 DCHECK(!key.IsNull()); | 171 DCHECK(!key.IsNull()); |
174 if (!V8CallBoolean(properties->CreateDataProperty( | 172 if (!V8CallBoolean(properties->CreateDataProperty( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ExceptionState exception_state( | 227 ExceptionState exception_state( |
230 info.GetIsolate(), ExceptionState::kSetterContext, "CSSStyleDeclaration", | 228 info.GetIsolate(), ExceptionState::kSetterContext, "CSSStyleDeclaration", |
231 getPropertyName(resolveCSSPropertyID(unresolved_property))); | 229 getPropertyName(resolveCSSPropertyID(unresolved_property))); |
232 impl->SetPropertyInternal(unresolved_property, String(), property_value, | 230 impl->SetPropertyInternal(unresolved_property, String(), property_value, |
233 false, exception_state); | 231 false, exception_state); |
234 | 232 |
235 V8SetReturnValue(info, value); | 233 V8SetReturnValue(info, value); |
236 } | 234 } |
237 | 235 |
238 } // namespace blink | 236 } // namespace blink |
OLD | NEW |