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

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

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/Element.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 static bool parseAttributeName(QualifiedName&, const AtomicString& namespace URI, const AtomicString& qualifiedName, ExceptionState&); 280 static bool parseAttributeName(QualifiedName&, const AtomicString& namespace URI, const AtomicString& qualifiedName, ExceptionState&);
281 void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qu alifiedName, const AtomicString& value, ExceptionState&); 281 void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qu alifiedName, const AtomicString& value, ExceptionState&);
282 282
283 bool isIdAttributeName(const QualifiedName&) const; 283 bool isIdAttributeName(const QualifiedName&) const;
284 const AtomicString& getIdAttribute() const; 284 const AtomicString& getIdAttribute() const;
285 void setIdAttribute(const AtomicString&); 285 void setIdAttribute(const AtomicString&);
286 286
287 const AtomicString& getNameAttribute() const; 287 const AtomicString& getNameAttribute() const;
288 const AtomicString& getClassAttribute() const; 288 const AtomicString& getClassAttribute() const;
289 289
290 bool shouldIgnoreAttributeCase() const;
291
290 // Call this to get the value of the id attribute for style resolution purpo ses. 292 // Call this to get the value of the id attribute for style resolution purpo ses.
291 // The value will already be lowercased if the document is in compatibility mode, 293 // The value will already be lowercased if the document is in compatibility mode,
292 // so this function is not suitable for non-style uses. 294 // so this function is not suitable for non-style uses.
293 const AtomicString& idForStyleResolution() const; 295 const AtomicString& idForStyleResolution() const;
294 296
295 // Internal methods that assume the existence of attribute storage, one shou ld use hasAttributes() 297 // Internal methods that assume the existence of attribute storage, one shou ld use hasAttributes()
296 // before calling them. 298 // before calling them.
297 size_t attributeCount() const; 299 size_t attributeCount() const;
298 const Attribute* attributeItem(unsigned index) const; 300 const Attribute* attributeItem(unsigned index) const;
299 const Attribute* getAttributeItem(const QualifiedName&) const; 301 const Attribute* getAttributeItem(const QualifiedName&) const;
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 877
876 inline const AtomicString& Element::getClassAttribute() const 878 inline const AtomicString& Element::getClassAttribute() const
877 { 879 {
878 if (!hasClass()) 880 if (!hasClass())
879 return nullAtom; 881 return nullAtom;
880 if (isSVGElement()) 882 if (isSVGElement())
881 return getAttribute(HTMLNames::classAttr); 883 return getAttribute(HTMLNames::classAttr);
882 return fastGetAttribute(HTMLNames::classAttr); 884 return fastGetAttribute(HTMLNames::classAttr);
883 } 885 }
884 886
887 inline bool Element::shouldIgnoreAttributeCase() const
888 {
889 return isHTMLElement() && document().isHTMLDocument();
890 }
891
885 inline void Element::setIdAttribute(const AtomicString& value) 892 inline void Element::setIdAttribute(const AtomicString& value)
886 { 893 {
887 setAttribute(document().idAttributeName(), value); 894 setAttribute(document().idAttributeName(), value);
888 } 895 }
889 896
890 inline const SpaceSplitString& Element::classNames() const 897 inline const SpaceSplitString& Element::classNames() const
891 { 898 {
892 ASSERT(hasClass()); 899 ASSERT(hasClass());
893 ASSERT(elementData()); 900 ASSERT(elementData());
894 return elementData()->classNames(); 901 return elementData()->classNames();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1069
1063 inline const Attribute* ElementData::attributeItem(unsigned index) const 1070 inline const Attribute* ElementData::attributeItem(unsigned index) const
1064 { 1071 {
1065 RELEASE_ASSERT(index < length()); 1072 RELEASE_ASSERT(index < length());
1066 return attributeBase() + index; 1073 return attributeBase() + index;
1067 } 1074 }
1068 1075
1069 } // namespace 1076 } // namespace
1070 1077
1071 #endif 1078 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698