Changeset 102570 in webkit
- Timestamp:
- Dec 12, 2011 5:23:54 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102567 r102570 1 2011-11-30 Alexander Pavlov <apavlov@chromium.org> 2 3 WebKit does not enumerate over CSS properties in HTMLElement.style 4 https://bugs.webkit.org/show_bug.cgi?id=23946 5 6 Reviewed by Darin Adler. 7 8 * fast/css/style-enumerate-properties-expected.txt: Added. 9 * fast/css/style-enumerate-properties.html: Added. 10 * fast/dom/domListEnumeration-expected.txt: 11 * fast/dom/script-tests/domListEnumeration.js: 12 1 13 2011-12-12 Philippe Normand <pnormand@igalia.com> 2 14 -
trunk/LayoutTests/fast/dom/domListEnumeration-expected.txt
r97925 r102570 67 67 68 68 [object CSSStyleDeclaration] 69 PASS resultArray.length is 1470 69 PASS resultArray[0].i is '0' 71 70 PASS resultArray[0].item is cssStyleDeclaration.item(0) -
trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js
r100369 r102570 174 174 var cssStyleDeclaration = document.styleSheets[2].cssRules[0].style; 175 175 resultArray = iterateList(cssStyleDeclaration); 176 shouldBe("resultArray.length", "14");177 176 shouldBe("resultArray[0].i", "'0'"); 178 177 shouldBe("resultArray[0].item", "cssStyleDeclaration.item(0)"); -
trunk/Source/JavaScriptCore/ChangeLog
r102564 r102570 1 2011-12-09 Alexander Pavlov <apavlov@chromium.org> 2 3 WebKit does not enumerate over CSS properties in HTMLElement.style 4 https://bugs.webkit.org/show_bug.cgi?id=23946 5 6 Reviewed by Darin Adler. 7 8 Add a few exports to follow the JSCSSStyleDeclaration.cpp changes, 9 introduce an std::sort() comparator function. 10 11 * JavaScriptCore.exp: 12 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 13 * wtf/text/WTFString.h: 14 (WTF::codePointCompareLessThan): Used by std::sort() to sort properties. 15 1 16 2011-12-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 17 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r102534 r102570 156 156 __ZN3JSC12SamplingTool5setupEv 157 157 __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE 158 __ZN3JSC12SmallStrings24singleCharacterStringRepEh 158 159 __ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh 159 160 __ZN3JSC12StringObject14finishCreationERNS_12JSGlobalDataEPNS_8JSStringE -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r102534 r102570 54 54 ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z 55 55 ?add@Identifier@JSC@@SA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PBD@Z 56 ?add@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z 56 57 ?add@PropertyNameArray@JSC@@QAEXPAVStringImpl@WTF@@@Z 57 58 ?addBytes@MD5@WTF@@QAEXPBEI@Z … … 63 64 ?addPropertyWithoutTransition@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@IPAVJSCell@2@@Z 64 65 ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z 66 ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z 65 67 ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z 66 68 ?allocatePropertyStorage@JSObject@JSC@@QAEXAAVJSGlobalData@2@II@Z … … 132 134 ?currentThreadIsHoldingLock@JSLock@JSC@@SA_NXZ 133 135 ?currentTime@WTF@@YANXZ 134 136 ?execute@ParallelEnvironment@WTF@@QAEXPAX@Z 135 137 ?data@CString@WTF@@QBEPBDXZ 136 138 ?dateToDaysFrom1970@WTF@@YANHHH@Z … … 314 316 ?shrinkToFit@StringBuilder@WTF@@QAEXXZ 315 317 ?signal@ThreadCondition@WTF@@QAEXXZ 318 ?singleCharacterStringRep@SmallStrings@JSC@@QAEPAVStringImpl@WTF@@E@Z 316 319 ?size@Heap@JSC@@QAEIXZ 317 320 ?slowAppend@MarkedArgumentBuffer@JSC@@AAEXVJSValue@2@@Z -
trunk/Source/JavaScriptCore/wtf/text/WTFString.h
r102059 r102570 506 506 507 507 WTF_EXPORT_PRIVATE int codePointCompare(const String&, const String&); 508 509 inline bool codePointCompareLessThan(const String& a, const String& b) 510 { 511 return codePointCompare(a.impl(), b.impl()) < 0; 512 } 508 513 509 514 inline size_t find(const LChar* characters, unsigned length, LChar matchCharacter, unsigned index = 0) -
trunk/Source/WebCore/ChangeLog
r102569 r102570 1 2011-11-25 Alexander Pavlov <apavlov@chromium.org> 2 3 WebKit does not enumerate over CSS properties in HTMLElement.style 4 https://bugs.webkit.org/show_bug.cgi?id=23946 5 6 Reviewed by Darin Adler. 7 8 This change generates a list of JavaScript mirrors of the CSS properties and allows to enumerate them 9 using the "in" operator on the CSSStyleDeclaration object. 10 11 Test: fast/css/style-enumerate-properties.html 12 13 * bindings/js/JSCSSStyleDeclarationCustom.cpp: 14 (WebCore::JSCSSStyleDeclaration::getOwnPropertyNames): Added. 15 * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp: 16 (WebCore::V8CSSStyleDeclaration::namedPropertyEnumerator): Added. 17 (WebCore::V8CSSStyleDeclaration::namedPropertyQuery): Added. 18 (WebCore::V8CSSStyleDeclaration::namedPropertyGetter): A small drive-by optimization (local initialization moved down). 19 * css/CSSStyleDeclaration.idl: Use a custom property enumerator. 20 * css/makeprop.pl: Add a function to convert CSS property names into JS ones, and a string comparator. 21 1 22 2011-12-09 Yury Semikhatsky <yurys@chromium.org> 2 23 -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r102262 r102570 29 29 #include "CSSMutableStyleDeclaration.h" 30 30 #include "CSSPrimitiveValue.h" 31 #include "CSSPropertyNames.h" 31 32 #include "CSSValue.h" 32 33 #include "JSCSSValue.h" … … 38 39 #include <wtf/text/StringBuilder.h> 39 40 #include <wtf/text/StringConcatenate.h> 41 #include <wtf/text/WTFString.h> 40 42 41 43 using namespace JSC; 42 44 using namespace WTF; 45 using namespace std; 43 46 44 47 namespace WebCore { … … 140 143 } 141 144 142 // FIXME: You can get these properties, and set them (see putDelegate below),143 // but you should also be able to enumerate them.144 145 JSValue JSCSSStyleDeclaration::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName) 145 146 { … … 196 197 } 197 198 199 void JSCSSStyleDeclaration::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) 200 { 201 JSCSSStyleDeclaration* thisObject = jsCast<JSCSSStyleDeclaration*>(object); 202 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); 203 204 unsigned length = thisObject->impl()->length(); 205 for (unsigned i = 0; i < length; ++i) 206 propertyNames.add(Identifier::from(exec, i)); 207 208 static Identifier* propertyIdentifiers = 0; 209 if (!propertyIdentifiers) { 210 Vector<String, numCSSProperties> jsPropertyNames; 211 for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id) 212 jsPropertyNames.append(getJSPropertyName(static_cast<CSSPropertyID>(id))); 213 sort(jsPropertyNames.begin(), jsPropertyNames.end(), WTF::codePointCompareLessThan); 214 215 propertyIdentifiers = new Identifier[numCSSProperties]; 216 for (int i = 0; i < numCSSProperties; ++i) 217 propertyIdentifiers[i] = Identifier(exec, jsPropertyNames[i].impl()); 218 } 219 220 for (int i = 0; i < numCSSProperties; ++i) 221 propertyNames.add(propertyIdentifiers[i]); 222 223 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); 224 } 225 198 226 } // namespace WebCore -
trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
r102262 r102570 33 33 34 34 #include "CSSParser.h" 35 #include "CSSPropertyNames.h" 35 36 #include "CSSStyleDeclaration.h" 36 37 #include "CSSValue.h" … … 48 49 #include <wtf/StdLibExtras.h> 49 50 #include <wtf/Vector.h> 51 52 using namespace WTF; 53 using namespace std; 50 54 51 55 namespace WebCore { … … 153 157 } 154 158 159 v8::Handle<v8::Array> V8CSSStyleDeclaration::namedPropertyEnumerator(const v8::AccessorInfo& info) 160 { 161 typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector; 162 DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, propertyNames, ()); 163 DEFINE_STATIC_LOCAL(String, filterString, ("filter")); 164 static unsigned propertyNamesLength = 0; 165 166 if (propertyNames.isEmpty()) { 167 for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id) { 168 String jsPropertyName = getJSPropertyName(static_cast<CSSPropertyID>(id)); 169 // The "filter" property is present in the list but should not be provided in the enumeration. 170 // See a comment in the V8CSSStyleDeclaration::namedPropertyGetter() implementation. 171 // FIXME: this should be removed (see bug 73426). 172 if (jsPropertyName != filterString) 173 propertyNames.append(jsPropertyName); 174 } 175 sort(propertyNames.begin(), propertyNames.end(), codePointCompareLessThan); 176 propertyNamesLength = propertyNames.size(); 177 } 178 179 v8::Handle<v8::Array> properties = v8::Array::New(propertyNamesLength); 180 for (unsigned i = 0; i < propertyNamesLength; ++i) { 181 String key = propertyNames.at(i); 182 ASSERT(!key.isNull()); 183 properties->Set(v8::Integer::New(i), v8String(key)); 184 } 185 186 return properties; 187 } 188 189 v8::Handle<v8::Integer> V8CSSStyleDeclaration::namedPropertyQuery(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info) 190 { 191 INC_STATS("DOM.CSSStyleDeclaration.NamedPropertyQuery"); 192 return v8::Integer::New(v8::None); 193 } 194 155 195 v8::Handle<v8::Value> V8CSSStyleDeclaration::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 156 196 { … … 161 201 162 202 // Search the style declaration. 163 CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder());164 203 CSSPropertyInfo* propInfo = cssPropertyInfo(name); 165 204 … … 168 207 return notHandledByInterceptor(); 169 208 170 209 CSSStyleDeclaration* imp = V8CSSStyleDeclaration::toNative(info.Holder()); 171 210 RefPtr<CSSValue> cssValue = imp->getPropertyCSSValue(propInfo->propID); 172 211 if (cssValue) { -
trunk/Source/WebCore/css/CSSStyleDeclaration.idl
r92236 r102570 28 28 HasNameGetter, 29 29 HasIndexGetter, 30 CustomGetPropertyNames, 30 31 V8DependentLifetime 31 32 ] CSSStyleDeclaration { -
trunk/Source/WebCore/css/makeprop.pl
r89362 r102570 63 63 %{ 64 64 /* This file is automatically generated from CSSPropertyNames.in by makeprop, do not edit */ 65 #include "config.h" 65 66 #include \"CSSPropertyNames.h\" 66 67 #include \"HashTools.h\" 67 68 #include <string.h> 69 70 #include <wtf/ASCIICType.h> 71 #include <wtf/text/WTFString.h> 68 72 69 73 namespace WebCore { … … 115 119 } 116 120 121 WTF::String getJSPropertyName(CSSPropertyID id) 122 { 123 char result[maxCSSPropertyNameLength + 1]; 124 const char* cssPropertyName = getPropertyName(id); 125 const char* propertyNamePointer = cssPropertyName; 126 if (!propertyNamePointer) 127 return emptyString(); 128 129 char* resultPointer = result; 130 while (char character = *propertyNamePointer++) { 131 if (character == '-') { 132 char nextCharacter = *propertyNamePointer++; 133 if (!nextCharacter) 134 break; 135 character = (propertyNamePointer - 2 != cssPropertyName) ? toASCIIUpper(nextCharacter) : nextCharacter; 136 } 137 *resultPointer++ = character; 138 } 139 *resultPointer = '\\0'; 140 return WTF::String(result); 141 } 142 117 143 } // namespace WebCore 118 144 EOF … … 126 152 127 153 #include <string.h> 154 155 namespace WTF { 156 class String; 157 } 128 158 129 159 namespace WebCore { … … 161 191 162 192 const char* getPropertyName(CSSPropertyID); 193 WTF::String getJSPropertyName(CSSPropertyID); 163 194 164 195 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.