Changeset 82332 in webkit
- Timestamp:
- Mar 29, 2011 3:10:11 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r82331 r82332 1 2011-03-29 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 DatasetDOMStringMap::item and ::contains copies attribute name string 6 https://bugs.webkit.org/show_bug.cgi?id=55645 7 8 * fast/dom/script-tests/dataset-expected.txt: 9 * fast/dom/script-tests/dataset.js: 10 Added extra test cases for getting fields by property name. 11 1 12 2011-03-29 Adam Barth <abarth@webkit.org> 2 13 -
trunk/LayoutTests/fast/dom/dataset-expected.txt
r62215 r82332 9 9 PASS testGet('data--foo', 'Foo') is true 10 10 PASS testGet('data---foo', '-Foo') is true 11 PASS testGet('data---foo--bar', '-Foo-Bar') is true 12 PASS testGet('data---foo---bar', '-Foo--Bar') is true 13 PASS testGet('data-foo-', 'foo-') is true 14 PASS testGet('data-foo--', 'foo--') is true 11 15 PASS testGet('data-Foo', 'foo') is true 12 16 PASS testGet('data-', '') is true -
trunk/LayoutTests/fast/dom/script-tests/dataset.js
r62215 r82332 13 13 shouldBeTrue("testGet('data--foo', 'Foo')"); 14 14 shouldBeTrue("testGet('data---foo', '-Foo')"); 15 shouldBeTrue("testGet('data---foo--bar', '-Foo-Bar')"); 16 shouldBeTrue("testGet('data---foo---bar', '-Foo--Bar')"); 17 shouldBeTrue("testGet('data-foo-', 'foo-')"); 18 shouldBeTrue("testGet('data-foo--', 'foo--')"); 15 19 shouldBeTrue("testGet('data-Foo', 'foo')"); // HTML lowercases all attributes. 16 20 shouldBeTrue("testGet('data-', '')"); -
trunk/Source/WebCore/ChangeLog
r82315 r82332 1 2011-03-29 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 DatasetDOMStringMap::item and ::contains copies attribute name string 6 https://bugs.webkit.org/show_bug.cgi?id=55645 7 8 Change propertyNameMatchesAttributeName to match without creating a copy 9 of the string. 10 11 * dom/DatasetDOMStringMap.cpp: 12 (WebCore::propertyNameMatchesAttributeName): 13 1 14 2011-03-29 Csaba Osztrogonác <ossy@webkit.org> 2 15 -
trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp
r62215 r82332 73 73 static bool propertyNameMatchesAttributeName(const String& propertyName, const String& attributeName) 74 74 { 75 // FIXME: This should be able to match without creating a new string. 76 77 if (!isValidAttributeName(attributeName)) 75 if (!attributeName.startsWith("data-")) 78 76 return false; 79 77 80 String convertedName = convertAttributeNameToPropertyName(attributeName); 81 return (convertedName == propertyName); 78 const UChar* property = propertyName.characters(); 79 const UChar* attribute = attributeName.characters(); 80 unsigned propertyLength = propertyName.length(); 81 unsigned attributeLength = attributeName.length(); 82 83 unsigned a = 5; 84 unsigned p = 0; 85 bool wordBoundary = false; 86 while (a < attributeLength && p < propertyLength) { 87 if (attribute[a] == '-' && a + 1 < attributeLength && attribute[a + 1] != '-') 88 wordBoundary = true; 89 else { 90 if ((wordBoundary ? toASCIIUpper(attribute[a]) : attribute[a]) != property[p]) 91 return false; 92 p++; 93 wordBoundary = false; 94 } 95 a++; 96 } 97 98 return (a == attributeLength && p == propertyLength); 82 99 } 83 100
Note: See TracChangeset
for help on using the changeset viewer.