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

Unified Diff: Source/core/dom/Element.cpp

Issue 26955005: Remove some useless null checks in Element/NamedNodeMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move shouldIgnoreAttributeCase to Element class Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/NamedNodeMap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 8be89e5475e8c58fca172a4f6a5670000592f8c5..8a08b782ce1e1bcf86283aae12d8d1e3dbf71b69 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -105,11 +105,6 @@ namespace WebCore {
using namespace HTMLNames;
using namespace XMLNames;
-static inline bool shouldIgnoreAttributeCase(const Element* e)
-{
- return e && e->document().isHTMLDocument() && e->isHTMLElement();
-}
-
class StyleResolverParentPusher {
public:
StyleResolverParentPusher(Element* parent)
@@ -459,7 +454,7 @@ inline void Element::synchronizeAttribute(const AtomicString& localName) const
// e.g when called from DOM API.
if (!elementData())
return;
- if (elementData()->m_styleAttributeIsDirty && equalPossiblyIgnoringCase(localName, styleAttr.localName(), shouldIgnoreAttributeCase(this))) {
+ if (elementData()->m_styleAttributeIsDirty && equalPossiblyIgnoringCase(localName, styleAttr.localName(), shouldIgnoreAttributeCase())) {
ASSERT(isStyledElement());
synchronizeStyleAttributeInternal();
return;
@@ -884,7 +879,7 @@ const AtomicString& Element::getAttribute(const AtomicString& localName) const
if (!elementData())
return nullAtom;
synchronizeAttribute(localName);
- if (const Attribute* attribute = elementData()->getAttributeItem(localName, shouldIgnoreAttributeCase(this)))
+ if (const Attribute* attribute = elementData()->getAttributeItem(localName, shouldIgnoreAttributeCase()))
return attribute->value();
return nullAtom;
}
@@ -902,7 +897,7 @@ void Element::setAttribute(const AtomicString& localName, const AtomicString& va
}
synchronizeAttribute(localName);
- const AtomicString& caseAdjustedLocalName = shouldIgnoreAttributeCase(this) ? localName.lower() : localName;
+ const AtomicString& caseAdjustedLocalName = shouldIgnoreAttributeCase() ? localName.lower() : localName;
size_t index = elementData() ? elementData()->getAttributeItemIndex(caseAdjustedLocalName, false) : kNotFound;
const QualifiedName& qName = index != kNotFound ? attributeItem(index)->name() : QualifiedName(nullAtom, caseAdjustedLocalName, nullAtom);
@@ -1927,7 +1922,7 @@ PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionState& es)
synchronizeAllAttributes();
UniqueElementData* elementData = ensureUniqueElementData();
- size_t index = elementData->getAttributeItemIndex(attrNode->qualifiedName(), shouldIgnoreAttributeCase(this));
+ size_t index = elementData->getAttributeItemIndex(attrNode->qualifiedName(), shouldIgnoreAttributeCase());
if (index != kNotFound) {
if (oldAttrNode)
detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->attributeItem(index)->value());
@@ -2038,7 +2033,7 @@ void Element::removeAttribute(const AtomicString& name)
if (!elementData())
return;
- AtomicString localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
+ AtomicString localName = shouldIgnoreAttributeCase() ? name.lower() : name;
size_t index = elementData()->getAttributeItemIndex(localName, false);
if (index == kNotFound) {
if (UNLIKELY(localName == styleAttr) && elementData()->m_styleAttributeIsDirty && isStyledElement())
@@ -2059,7 +2054,7 @@ PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& localName)
if (!elementData())
return 0;
synchronizeAttribute(localName);
- const Attribute* attribute = elementData()->getAttributeItem(localName, shouldIgnoreAttributeCase(this));
+ const Attribute* attribute = elementData()->getAttributeItem(localName, shouldIgnoreAttributeCase());
if (!attribute)
return 0;
return ensureAttr(attribute->name());
@@ -2082,7 +2077,7 @@ bool Element::hasAttribute(const AtomicString& localName) const
if (!elementData())
return false;
synchronizeAttribute(localName);
- return elementData()->getAttributeItem(shouldIgnoreAttributeCase(this) ? localName.lower() : localName, false);
+ return elementData()->getAttributeItem(shouldIgnoreAttributeCase() ? localName.lower() : localName, false);
}
bool Element::hasAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/NamedNodeMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698