OLD | NEW |
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // so this function is not suitable for non-style uses. | 168 // so this function is not suitable for non-style uses. |
169 const AtomicString& idForStyleResolution() const; | 169 const AtomicString& idForStyleResolution() const; |
170 | 170 |
171 // Internal methods that assume the existence of attribute storage, one shou
ld use hasAttributes() | 171 // Internal methods that assume the existence of attribute storage, one shou
ld use hasAttributes() |
172 // before calling them. This is not a trivial getter and its return value sh
ould be cached for | 172 // before calling them. This is not a trivial getter and its return value sh
ould be cached for |
173 // performance. | 173 // performance. |
174 AttributeCollection attributes() const { return elementData()->attributes();
} | 174 AttributeCollection attributes() const { return elementData()->attributes();
} |
175 size_t attributeCount() const; | 175 size_t attributeCount() const; |
176 const Attribute& attributeAt(unsigned index) const; | 176 const Attribute& attributeAt(unsigned index) const; |
177 const Attribute* findAttributeByName(const QualifiedName&) const; | 177 const Attribute* findAttributeByName(const QualifiedName&) const; |
178 size_t findAttributeIndexByName(const QualifiedName& name) const { return el
ementData()->findAttributeIndexByName(name); } | 178 size_t findAttributeIndexByName(const QualifiedName& name) const { return el
ementData()->attributes().findIndex(name); } |
179 size_t findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreA
ttributeCase) const { return elementData()->findAttributeIndexByName(name, shoul
dIgnoreAttributeCase); } | 179 size_t findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreA
ttributeCase) const { return elementData()->attributes().findIndex(name, shouldI
gnoreAttributeCase); } |
180 | 180 |
181 void scrollIntoView(bool alignToTop = true); | 181 void scrollIntoView(bool alignToTop = true); |
182 void scrollIntoViewIfNeeded(bool centerIfNeeded = true); | 182 void scrollIntoViewIfNeeded(bool centerIfNeeded = true); |
183 | 183 |
184 void scrollByLines(int lines); | 184 void scrollByLines(int lines); |
185 void scrollByPages(int pages); | 185 void scrollByPages(int pages); |
186 | 186 |
187 int offsetLeft(); | 187 int offsetLeft(); |
188 int offsetTop(); | 188 int offsetTop(); |
189 int offsetWidth(); | 189 int offsetWidth(); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 ASSERT(fastAttributeLookupAllowed(name)); | 710 ASSERT(fastAttributeLookupAllowed(name)); |
711 if (elementData()) { | 711 if (elementData()) { |
712 if (const Attribute* attribute = findAttributeByName(name)) | 712 if (const Attribute* attribute = findAttributeByName(name)) |
713 return attribute->value(); | 713 return attribute->value(); |
714 } | 714 } |
715 return nullAtom; | 715 return nullAtom; |
716 } | 716 } |
717 | 717 |
718 inline bool Element::hasAttributesWithoutUpdate() const | 718 inline bool Element::hasAttributesWithoutUpdate() const |
719 { | 719 { |
720 return elementData() && elementData()->hasAttributes(); | 720 return elementData() && !elementData()->attributes().isEmpty(); |
721 } | 721 } |
722 | 722 |
723 inline const AtomicString& Element::idForStyleResolution() const | 723 inline const AtomicString& Element::idForStyleResolution() const |
724 { | 724 { |
725 ASSERT(hasID()); | 725 ASSERT(hasID()); |
726 return elementData()->idForStyleResolution(); | 726 return elementData()->idForStyleResolution(); |
727 } | 727 } |
728 | 728 |
729 inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const | 729 inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const |
730 { | 730 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 inline const SpaceSplitString& Element::classNames() const | 762 inline const SpaceSplitString& Element::classNames() const |
763 { | 763 { |
764 ASSERT(hasClass()); | 764 ASSERT(hasClass()); |
765 ASSERT(elementData()); | 765 ASSERT(elementData()); |
766 return elementData()->classNames(); | 766 return elementData()->classNames(); |
767 } | 767 } |
768 | 768 |
769 inline size_t Element::attributeCount() const | 769 inline size_t Element::attributeCount() const |
770 { | 770 { |
771 ASSERT(elementData()); | 771 ASSERT(elementData()); |
772 return elementData()->attributeCount(); | 772 return elementData()->attributes().size(); |
773 } | 773 } |
774 | 774 |
775 inline const Attribute& Element::attributeAt(unsigned index) const | 775 inline const Attribute& Element::attributeAt(unsigned index) const |
776 { | 776 { |
777 ASSERT(elementData()); | 777 ASSERT(elementData()); |
778 return elementData()->attributeAt(index); | 778 return elementData()->attributes()[index]; |
779 } | 779 } |
780 | 780 |
781 inline const Attribute* Element::findAttributeByName(const QualifiedName& name)
const | 781 inline const Attribute* Element::findAttributeByName(const QualifiedName& name)
const |
782 { | 782 { |
783 ASSERT(elementData()); | 783 ASSERT(elementData()); |
784 return elementData()->findAttributeByName(name); | 784 return elementData()->attributes().find(name); |
785 } | 785 } |
786 | 786 |
787 inline bool Element::hasID() const | 787 inline bool Element::hasID() const |
788 { | 788 { |
789 return elementData() && elementData()->hasID(); | 789 return elementData() && elementData()->hasID(); |
790 } | 790 } |
791 | 791 |
792 inline bool Element::hasClass() const | 792 inline bool Element::hasClass() const |
793 { | 793 { |
794 return elementData() && elementData()->hasClass(); | 794 return elementData() && elementData()->hasClass(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) | 884 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) |
885 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 885 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
886 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document&
document) \ | 886 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document&
document) \ |
887 { \ | 887 { \ |
888 return adoptRefWillBeNoop(new T(tagName, document)); \ | 888 return adoptRefWillBeNoop(new T(tagName, document)); \ |
889 } | 889 } |
890 | 890 |
891 } // namespace | 891 } // namespace |
892 | 892 |
893 #endif | 893 #endif |
OLD | NEW |