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

Side by Side Diff: Source/core/dom/Element.h

Issue 22803008: setAttributeNode() does not properly normalize case. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: submitting patch with small name changes. Created 7 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl e Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl e Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 const StylePropertySet* inlineStyle() const { return m_inlineStyle.get(); } 81 const StylePropertySet* inlineStyle() const { return m_inlineStyle.get(); }
82 82
83 const StylePropertySet* presentationAttributeStyle() const; 83 const StylePropertySet* presentationAttributeStyle() const;
84 84
85 size_t length() const; 85 size_t length() const;
86 bool isEmpty() const { return !length(); } 86 bool isEmpty() const { return !length(); }
87 87
88 const Attribute* attributeItem(unsigned index) const; 88 const Attribute* attributeItem(unsigned index) const;
89 const Attribute* getAttributeItem(const QualifiedName&) const; 89 const Attribute* getAttributeItem(const QualifiedName&) const;
90 size_t getAttributeItemIndex(const QualifiedName&) const; 90 size_t getAttributeItemIndex(const QualifiedName&, bool shouldIgnoreCase = f alse) const;
91 size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttr ibuteCase) const; 91 size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttr ibuteCase) const;
92 size_t getAttrIndex(Attr*) const; 92 size_t getAttrIndex(Attr*) const;
93 93
94 bool hasID() const { return !m_idForStyleResolution.isNull(); } 94 bool hasID() const { return !m_idForStyleResolution.isNull(); }
95 bool hasClass() const { return !m_classNames.isNull(); } 95 bool hasClass() const { return !m_classNames.isNull(); }
96 96
97 bool isEquivalent(const ElementData* other) const; 97 bool isEquivalent(const ElementData* other) const;
98 98
99 bool isUnique() const { return m_isUnique; } 99 bool isUnique() const { return m_isUnique; }
100 100
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 return 0; 1030 return 0;
1031 } 1031 }
1032 1032
1033 inline const Attribute* ElementData::attributeBase() const 1033 inline const Attribute* ElementData::attributeBase() const
1034 { 1034 {
1035 if (m_isUnique) 1035 if (m_isUnique)
1036 return static_cast<const UniqueElementData*>(this)->m_attributeVector.be gin(); 1036 return static_cast<const UniqueElementData*>(this)->m_attributeVector.be gin();
1037 return static_cast<const ShareableElementData*>(this)->m_attributeArray; 1037 return static_cast<const ShareableElementData*>(this)->m_attributeArray;
1038 } 1038 }
1039 1039
1040 inline size_t ElementData::getAttributeItemIndex(const QualifiedName& name) cons t 1040 inline size_t ElementData::getAttributeItemIndex(const QualifiedName& name, bool shouldIgnoreCase) const
1041 { 1041 {
1042 const Attribute* begin = attributeBase(); 1042 const Attribute* begin = attributeBase();
1043 for (unsigned i = 0; i < length(); ++i) { 1043 for (unsigned i = 0; i < length(); ++i) {
1044 const Attribute& attribute = begin[i]; 1044 const Attribute& attribute = begin[i];
1045 if (attribute.name().matches(name)) 1045 if (attribute.name().matchesPossiblyIgnoringCase(name, shouldIgnoreCase) )
1046 return i; 1046 return i;
1047 } 1047 }
1048 return notFound; 1048 return notFound;
1049 } 1049 }
1050 1050
1051 // We use a boolean parameter instead of calling shouldIgnoreAttributeCase so th at the caller 1051 // We use a boolean parameter instead of calling shouldIgnoreAttributeCase so th at the caller
1052 // can tune the behavior (hasAttribute is case sensitive whereas getAttribute is not). 1052 // can tune the behavior (hasAttribute is case sensitive whereas getAttribute is not).
1053 inline size_t ElementData::getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const 1053 inline size_t ElementData::getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const
1054 { 1054 {
1055 unsigned len = length(); 1055 unsigned len = length();
(...skipping 28 matching lines...) Expand all
1084 1084
1085 inline const Attribute* ElementData::attributeItem(unsigned index) const 1085 inline const Attribute* ElementData::attributeItem(unsigned index) const
1086 { 1086 {
1087 RELEASE_ASSERT(index < length()); 1087 RELEASE_ASSERT(index < length());
1088 return attributeBase() + index; 1088 return attributeBase() + index;
1089 } 1089 }
1090 1090
1091 } // namespace 1091 } // namespace
1092 1092
1093 #endif 1093 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity-xhtml-expected.txt ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698