Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: Source/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp

Issue 19555002: Translate viewport related meta tags into @viewport descriptors as suggested by the CSS Device Adap… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 unsigned length = propertyName.length(); 110 unsigned length = propertyName.length();
111 bool hadPixelOrPosPrefix = false; 111 bool hadPixelOrPosPrefix = false;
112 if (!length) 112 if (!length)
113 return 0; 113 return 0;
114 114
115 StringBuilder builder; 115 StringBuilder builder;
116 builder.reserveCapacity(length); 116 builder.reserveCapacity(length);
117 117
118 unsigned i = 0; 118 unsigned i = 0;
119 119
120 if (hasCSSPropertyNamePrefix(propertyName, "css")) 120 if (hasCSSPropertyNamePrefix(propertyName, "css")) {
121 i += 3; 121 i += 3;
122 else if (hasCSSPropertyNamePrefix(propertyName, "pixel")) { 122 } else if (hasCSSPropertyNamePrefix(propertyName, "pixel")) {
123 i += 5; 123 i += 5;
124 hadPixelOrPosPrefix = true; 124 hadPixelOrPosPrefix = true;
125 } else if (hasCSSPropertyNamePrefix(propertyName, "pos")) { 125 } else if (hasCSSPropertyNamePrefix(propertyName, "pos")) {
126 i += 3; 126 i += 3;
127 hadPixelOrPosPrefix = true; 127 hadPixelOrPosPrefix = true;
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 (hasCSSPropertyNamePrefix(propertyName, "internal") || isASCII Upper(propertyName[0])) {
131 return 0; 131 return 0;
132 }
132 133
133 builder.append(toASCIILower(propertyName[i++])); 134 builder.append(toASCIILower(propertyName[i++]));
134 135
135 for (; i < length; ++i) { 136 for (; i < length; ++i) {
136 UChar c = propertyName[i]; 137 UChar c = propertyName[i];
137 if (!isASCIIUpper(c)) 138 if (!isASCIIUpper(c))
138 builder.append(c); 139 builder.append(c);
139 else { 140 else {
140 builder.append('-'); 141 builder.append('-');
141 builder.append(toASCIILower(c)); 142 builder.append(toASCIILower(c));
(...skipping 14 matching lines...) Expand all
156 157
157 void V8CSSStyleDeclaration::namedPropertyEnumeratorCustom(const v8::PropertyCall backInfo<v8::Array>& info) 158 void V8CSSStyleDeclaration::namedPropertyEnumeratorCustom(const v8::PropertyCall backInfo<v8::Array>& info)
158 { 159 {
159 typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector; 160 typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector;
160 DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, propertyNames, ()); 161 DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, propertyNames, ());
161 static unsigned propertyNamesLength = 0; 162 static unsigned propertyNamesLength = 0;
162 163
163 if (propertyNames.isEmpty()) { 164 if (propertyNames.isEmpty()) {
164 for (int id = firstCSSProperty; id <= lastCSSProperty; ++id) { 165 for (int id = firstCSSProperty; id <= lastCSSProperty; ++id) {
165 CSSPropertyID propertyId = static_cast<CSSPropertyID>(id); 166 CSSPropertyID propertyId = static_cast<CSSPropertyID>(id);
166 if (RuntimeCSSEnabled::isCSSPropertyEnabled(propertyId)) 167 if (RuntimeCSSEnabled::isCSSPropertyEnabled(propertyId)) {
167 propertyNames.append(getJSPropertyName(propertyId)); 168 String propertyName = getJSPropertyName(propertyId);
169 if (!hasCSSPropertyNamePrefix(propertyName, "internal"))
170 propertyNames.append(propertyName);
171 }
168 } 172 }
169 sort(propertyNames.begin(), propertyNames.end(), codePointCompareLessTha n); 173 sort(propertyNames.begin(), propertyNames.end(), codePointCompareLessTha n);
170 propertyNamesLength = propertyNames.size(); 174 propertyNamesLength = propertyNames.size();
171 } 175 }
172 176
173 v8::Handle<v8::Array> properties = v8::Array::New(propertyNamesLength); 177 v8::Handle<v8::Array> properties = v8::Array::New(propertyNamesLength);
174 for (unsigned i = 0; i < propertyNamesLength; ++i) { 178 for (unsigned i = 0; i < propertyNamesLength; ++i) {
175 String key = propertyNames.at(i); 179 String key = propertyNames.at(i);
176 ASSERT(!key.isNull()); 180 ASSERT(!key.isNull());
177 properties->Set(v8::Integer::New(i, info.GetIsolate()), v8String(key, in fo.GetIsolate())); 181 properties->Set(v8::Integer::New(i, info.GetIsolate()), v8String(key, in fo.GetIsolate()));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 243
240 if (ec) { 244 if (ec) {
241 setDOMException(ec, info.GetIsolate()); 245 setDOMException(ec, info.GetIsolate());
242 return; 246 return;
243 } 247 }
244 248
245 v8SetReturnValue(info, value); 249 v8SetReturnValue(info, value);
246 } 250 }
247 251
248 } // namespace WebCore 252 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698