Changeset 35931 in webkit
- Timestamp:
- Aug 26, 2008 3:27:33 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r35928 r35931 1 2008-08-25 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Darin. 4 5 Test case for Bug 20247: setAttributeNode() does not work when attribute name 6 has a capital letter in it 7 https://bugs.webkit.org/show_bug.cgi?id=20247 8 9 <rdar://problem/6118218> 10 11 Most of this test case was done by Eric Roman <minatoar@gmail.com>, the rest by ap and was 12 tweaked by me. 13 14 * fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt: Added. 15 * fast/dom/Element/getAttribute-check-case-sensitivity.html: Added. 16 * fast/dom/Element/resources/getAttribute-check-case-sensitivity.js: Added. 17 1 18 2008-08-25 Sam Weinig <sam@webkit.org> 2 19 -
trunk/WebCore/ChangeLog
r35928 r35931 1 2008-08-25 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Darin. 4 5 Bug 20247: setAttributeNode() does not work when attribute name has a capital letter in it 6 https://bugs.webkit.org/show_bug.cgi?id=20247 7 8 <rdar://problem/6118218> 9 10 Add a boolean parameter to getAttributeItem to choose between case sensitive and case insensitive 11 check. This keeps the behaviour for setAttribute / hasAttribute (case sensitive) and getAttribute 12 (case insensitive for HTML elements). 13 14 Test: fast/dom/Element/getAttribute-check-case-sensitivity.html 15 16 * dom/Element.cpp: 17 (WebCore::Element::getAttribute): 18 * dom/NamedAttrMap.cpp: 19 (WebCore::NamedAttrMap::getNamedItem): 20 (WebCore::NamedAttrMap::getAttributeItem): 21 * dom/NamedAttrMap.h: 22 1 23 2008-08-25 Sam Weinig <sam@webkit.org> 2 24 -
trunk/WebCore/dom/Element.cpp
r35648 r35931 491 491 492 492 if (namedAttrMap) 493 if (Attribute* a = namedAttrMap->getAttributeItem( localName))493 if (Attribute* a = namedAttrMap->getAttributeItem(name, shouldIgnoreAttributeCase(this))) 494 494 return a->value(); 495 495 … … 512 512 513 513 // allocate attributemap if necessary 514 Attribute* old = attributes(false)->getAttributeItem(localName );514 Attribute* old = attributes(false)->getAttributeItem(localName, false); 515 515 516 516 document()->incDOMTreeVersion(); … … 1121 1121 if (!attrs) 1122 1122 return false; 1123 1124 // This call to String::lower() seems to be required but 1125 // there may be a way to remove it. 1123 1126 String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name; 1124 return attrs->getAttributeItem(localName );1127 return attrs->getAttributeItem(localName, false); 1125 1128 } 1126 1129 -
trunk/WebCore/dom/NamedAttrMap.cpp
r34138 r35931 52 52 PassRefPtr<Node> NamedAttrMap::getNamedItem(const String& name) const 53 53 { 54 String localName = shouldIgnoreAttributeCase(m_element) ? name.lower() : name; 55 Attribute* a = getAttributeItem(localName); 54 Attribute* a = getAttributeItem(name, shouldIgnoreAttributeCase(m_element)); 56 55 if (!a) 57 56 return 0; … … 67 66 PassRefPtr<Node> NamedAttrMap::removeNamedItem(const String& name, ExceptionCode& ec) 68 67 { 69 String localName = shouldIgnoreAttributeCase(m_element) ? name.lower() : name; 70 Attribute* a = getAttributeItem(localName); 68 Attribute* a = getAttributeItem(name, shouldIgnoreAttributeCase(m_element)); 71 69 if (!a) { 72 70 ec = NOT_FOUND_ERR; … … 165 163 } 166 164 167 Attribute* NamedAttrMap::getAttributeItem(const String& name) const 165 // We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller 166 // can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not). 167 Attribute* NamedAttrMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const 168 168 { 169 169 unsigned len = length(); … … 172 172 m_attributes[i]->name().localName() == name) 173 173 return m_attributes[i].get(); 174 175 if ( m_attributes[i]->name().toString() == name)174 175 if (shouldIgnoreAttributeCase ? equalIgnoringCase(m_attributes[i]->name().toString(), name) : name == m_attributes[i]->name().toString()) 176 176 return m_attributes[i].get(); 177 177 } -
trunk/WebCore/dom/NamedAttrMap.h
r35035 r35931 69 69 Attribute* attributeItem(unsigned index) const { return m_attributes[index].get(); } 70 70 Attribute* getAttributeItem(const QualifiedName& name) const; 71 Attribute* getAttributeItem(const String& name ) const;71 Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const; 72 72 73 73 void shrinkToLength() { m_attributes.shrinkCapacity(length()); } -
trunk/WebCore/dom/NamedMappedAttrMap.h
r31435 r35931 58 58 { return static_cast<MappedAttribute*>(NamedAttrMap::getAttributeItem(name)); } 59 59 MappedAttribute* getAttributeItem(const String& name) const 60 { return static_cast<MappedAttribute*>(NamedAttrMap::getAttributeItem(name )); }60 { return static_cast<MappedAttribute*>(NamedAttrMap::getAttributeItem(name, false)); } 61 61 62 62 private:
Note: See TracChangeset
for help on using the changeset viewer.