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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool shouldIgnoreAttributeCase() const; | 164 bool shouldIgnoreAttributeCase() const; |
165 | 165 |
166 // Call this to get the value of the id attribute for style resolution purpo
ses. | 166 // Call this to get the value of the id attribute for style resolution purpo
ses. |
167 // The value will already be lowercased if the document is in compatibility
mode, | 167 // The value will already be lowercased if the document is in compatibility
mode, |
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; |
175 size_t attributeCount() const; | |
176 const Attribute& attributeAt(unsigned index) const; | |
177 const Attribute* findAttributeByName(const QualifiedName&) const; | 175 const Attribute* findAttributeByName(const QualifiedName&) const; |
178 size_t findAttributeIndexByName(const QualifiedName& name) const { return el
ementData()->attributes().findIndex(name); } | 176 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()->attributes().findIndex(name, shouldI
gnoreAttributeCase); } | 177 size_t findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreA
ttributeCase) const { return elementData()->attributes().findIndex(name, shouldI
gnoreAttributeCase); } |
180 | 178 |
181 void scrollIntoView(bool alignToTop = true); | 179 void scrollIntoView(bool alignToTop = true); |
182 void scrollIntoViewIfNeeded(bool centerIfNeeded = true); | 180 void scrollIntoViewIfNeeded(bool centerIfNeeded = true); |
183 | 181 |
184 void scrollByLines(int lines); | 182 void scrollByLines(int lines); |
185 void scrollByPages(int pages); | 183 void scrollByPages(int pages); |
186 | 184 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name)
const | 704 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name)
const |
707 { | 705 { |
708 ASSERT(fastAttributeLookupAllowed(name)); | 706 ASSERT(fastAttributeLookupAllowed(name)); |
709 if (elementData()) { | 707 if (elementData()) { |
710 if (const Attribute* attribute = findAttributeByName(name)) | 708 if (const Attribute* attribute = findAttributeByName(name)) |
711 return attribute->value(); | 709 return attribute->value(); |
712 } | 710 } |
713 return nullAtom; | 711 return nullAtom; |
714 } | 712 } |
715 | 713 |
| 714 inline AttributeCollection Element::attributes() const |
| 715 { |
| 716 ASSERT(elementData()); |
| 717 return elementData()->attributes(); |
| 718 } |
| 719 |
716 inline bool Element::hasAttributesWithoutUpdate() const | 720 inline bool Element::hasAttributesWithoutUpdate() const |
717 { | 721 { |
718 return elementData() && !elementData()->attributes().isEmpty(); | 722 return elementData() && !elementData()->attributes().isEmpty(); |
719 } | 723 } |
720 | 724 |
721 inline const AtomicString& Element::idForStyleResolution() const | 725 inline const AtomicString& Element::idForStyleResolution() const |
722 { | 726 { |
723 ASSERT(hasID()); | 727 ASSERT(hasID()); |
724 return elementData()->idForStyleResolution(); | 728 return elementData()->idForStyleResolution(); |
725 } | 729 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 setAttribute(HTMLNames::idAttr, value); | 761 setAttribute(HTMLNames::idAttr, value); |
758 } | 762 } |
759 | 763 |
760 inline const SpaceSplitString& Element::classNames() const | 764 inline const SpaceSplitString& Element::classNames() const |
761 { | 765 { |
762 ASSERT(hasClass()); | 766 ASSERT(hasClass()); |
763 ASSERT(elementData()); | 767 ASSERT(elementData()); |
764 return elementData()->classNames(); | 768 return elementData()->classNames(); |
765 } | 769 } |
766 | 770 |
767 inline size_t Element::attributeCount() const | |
768 { | |
769 ASSERT(elementData()); | |
770 return elementData()->attributes().size(); | |
771 } | |
772 | |
773 inline const Attribute& Element::attributeAt(unsigned index) const | |
774 { | |
775 ASSERT(elementData()); | |
776 return elementData()->attributes()[index]; | |
777 } | |
778 | |
779 inline const Attribute* Element::findAttributeByName(const QualifiedName& name)
const | 771 inline const Attribute* Element::findAttributeByName(const QualifiedName& name)
const |
780 { | 772 { |
781 ASSERT(elementData()); | 773 ASSERT(elementData()); |
782 return elementData()->attributes().find(name); | 774 return elementData()->attributes().find(name); |
783 } | 775 } |
784 | 776 |
785 inline bool Element::hasID() const | 777 inline bool Element::hasID() const |
786 { | 778 { |
787 return elementData() && elementData()->hasID(); | 779 return elementData() && elementData()->hasID(); |
788 } | 780 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) | 874 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) |
883 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 875 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
884 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document&
document) \ | 876 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document&
document) \ |
885 { \ | 877 { \ |
886 return adoptRefWillBeNoop(new T(tagName, document)); \ | 878 return adoptRefWillBeNoop(new T(tagName, document)); \ |
887 } | 879 } |
888 | 880 |
889 } // namespace | 881 } // namespace |
890 | 882 |
891 #endif | 883 #endif |
OLD | NEW |