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

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

Issue 176883005: Have Element::ensureUniqueElementData() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « Source/core/dom/Attr.cpp ('k') | 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 virtual void attributeChanged(const QualifiedName&, const AtomicString&, Att ributeModificationReason = ModifiedDirectly); 278 virtual void attributeChanged(const QualifiedName&, const AtomicString&, Att ributeModificationReason = ModifiedDirectly);
279 virtual void parseAttribute(const QualifiedName&, const AtomicString&) { } 279 virtual void parseAttribute(const QualifiedName&, const AtomicString&) { }
280 280
281 // Only called by the parser immediately after element construction. 281 // Only called by the parser immediately after element construction.
282 void parserSetAttributes(const Vector<Attribute>&); 282 void parserSetAttributes(const Vector<Attribute>&);
283 283
284 // Remove attributes that might introduce scripting from the vector leaving the element unchanged. 284 // Remove attributes that might introduce scripting from the vector leaving the element unchanged.
285 void stripScriptingAttributes(Vector<Attribute>&) const; 285 void stripScriptingAttributes(Vector<Attribute>&) const;
286 286
287 const ElementData* elementData() const { return m_elementData.get(); } 287 const ElementData* elementData() const { return m_elementData.get(); }
288 UniqueElementData* ensureUniqueElementData(); 288 UniqueElementData& ensureUniqueElementData();
289 289
290 void synchronizeAllAttributes() const; 290 void synchronizeAllAttributes() const;
291 291
292 // Clones attributes only. 292 // Clones attributes only.
293 void cloneAttributesFromElement(const Element&); 293 void cloneAttributesFromElement(const Element&);
294 294
295 // Clones all attribute-derived data, including subclass specifics (through copyNonAttributeProperties.) 295 // Clones all attribute-derived data, including subclass specifics (through copyNonAttributeProperties.)
296 void cloneDataFromElement(const Element&); 296 void cloneDataFromElement(const Element&);
297 297
298 bool hasEquivalentAttributes(const Element* other) const; 298 bool hasEquivalentAttributes(const Element* other) const;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 inline bool Element::hasID() const 782 inline bool Element::hasID() const
783 { 783 {
784 return elementData() && elementData()->hasID(); 784 return elementData() && elementData()->hasID();
785 } 785 }
786 786
787 inline bool Element::hasClass() const 787 inline bool Element::hasClass() const
788 { 788 {
789 return elementData() && elementData()->hasClass(); 789 return elementData() && elementData()->hasClass();
790 } 790 }
791 791
792 inline UniqueElementData* Element::ensureUniqueElementData() 792 inline UniqueElementData& Element::ensureUniqueElementData()
793 { 793 {
794 if (!elementData() || !elementData()->isUnique()) 794 if (!elementData() || !elementData()->isUnique())
795 createUniqueElementData(); 795 createUniqueElementData();
796 return static_cast<UniqueElementData*>(m_elementData.get()); 796 return static_cast<UniqueElementData&>(*m_elementData);
797 } 797 }
798 798
799 // Put here to make them inline. 799 // Put here to make them inline.
800 inline bool Node::hasID() const 800 inline bool Node::hasID() const
801 { 801 {
802 return isElementNode() && toElement(this)->hasID(); 802 return isElementNode() && toElement(this)->hasID();
803 } 803 }
804 804
805 inline bool Node::hasClass() const 805 inline bool Node::hasClass() const
806 { 806 {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 859 }
860 860
861 inline bool isShadowHost(const Element* element) 861 inline bool isShadowHost(const Element* element)
862 { 862 {
863 return element && element->shadow(); 863 return element && element->shadow();
864 } 864 }
865 865
866 } // namespace 866 } // namespace
867 867
868 #endif 868 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Attr.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698