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 // Call this to get the value of the id attribute for style resolution purpo
ses. | 164 // Call this to get the value of the id attribute for style resolution purpo
ses. |
165 // The value will already be lowercased if the document is in compatibility
mode, | 165 // The value will already be lowercased if the document is in compatibility
mode, |
166 // so this function is not suitable for non-style uses. | 166 // so this function is not suitable for non-style uses. |
167 const AtomicString& idForStyleResolution() const; | 167 const AtomicString& idForStyleResolution() const; |
168 | 168 |
169 // Internal methods that assume the existence of attribute storage, one shou
ld use hasAttributes() | 169 // Internal methods that assume the existence of attribute storage, one shou
ld use hasAttributes() |
170 // before calling them. This is not a trivial getter and its return value sh
ould be cached for | 170 // before calling them. This is not a trivial getter and its return value sh
ould be cached for |
171 // performance. | 171 // performance. |
172 AttributeIteratorAccessor attributesIterator() const { return elementData()-
>attributesIterator(); } | 172 AttributeIteratorAccessor attributesIterator() const { return elementData()-
>attributesIterator(); } |
173 size_t attributeCount() const; | 173 size_t attributeCount() const; |
174 const Attribute& attributeItem(unsigned index) const; | 174 const Attribute& attributeAt(unsigned index) const; |
175 const Attribute* getAttributeItem(const QualifiedName&) const; | 175 const Attribute* findAttributeByName(const QualifiedName&) const; |
176 size_t getAttributeItemIndex(const QualifiedName& name) const { return eleme
ntData()->getAttributeItemIndex(name); } | 176 size_t findAttributeIndexByName(const QualifiedName& name) const { return el
ementData()->findAttributeIndexByName(name); } |
177 size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttr
ibuteCase) const { return elementData()->getAttributeItemIndex(name, shouldIgnor
eAttributeCase); } | 177 size_t findAttributeIndexByName(const AtomicString& name, bool shouldIgnoreA
ttributeCase) const { return elementData()->findAttributeIndexByName(name, shoul
dIgnoreAttributeCase); } |
178 | 178 |
179 void scrollIntoView(bool alignToTop = true); | 179 void scrollIntoView(bool alignToTop = true); |
180 void scrollIntoViewIfNeeded(bool centerIfNeeded = true); | 180 void scrollIntoViewIfNeeded(bool centerIfNeeded = true); |
181 | 181 |
182 void scrollByLines(int lines); | 182 void scrollByLines(int lines); |
183 void scrollByPages(int pages); | 183 void scrollByPages(int pages); |
184 | 184 |
185 double offsetLeft(); | 185 double offsetLeft(); |
186 double offsetTop(); | 186 double offsetTop(); |
187 double offsetWidth(); | 187 double offsetWidth(); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 void updateId(TreeScope&, const AtomicString& oldId, const AtomicString& new
Id); | 595 void updateId(TreeScope&, const AtomicString& oldId, const AtomicString& new
Id); |
596 void updateName(const AtomicString& oldName, const AtomicString& newName); | 596 void updateName(const AtomicString& oldName, const AtomicString& newName); |
597 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const
AtomicString& newForAttributeValue); | 597 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const
AtomicString& newForAttributeValue); |
598 | 598 |
599 void scrollByUnits(int units, ScrollGranularity); | 599 void scrollByUnits(int units, ScrollGranularity); |
600 | 600 |
601 virtual NodeType nodeType() const OVERRIDE FINAL; | 601 virtual NodeType nodeType() const OVERRIDE FINAL; |
602 virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL; | 602 virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL; |
603 | 603 |
604 void setAttributeInternal(size_t index, const QualifiedName&, const AtomicSt
ring& value, SynchronizationOfLazyAttribute); | 604 void setAttributeInternal(size_t index, const QualifiedName&, const AtomicSt
ring& value, SynchronizationOfLazyAttribute); |
605 void addAttributeInternal(const QualifiedName&, const AtomicString& value, S
ynchronizationOfLazyAttribute); | 605 void appendAttributeInternal(const QualifiedName&, const AtomicString& value
, SynchronizationOfLazyAttribute); |
606 void removeAttributeInternal(size_t index, SynchronizationOfLazyAttribute); | 606 void removeAttributeInternal(size_t index, SynchronizationOfLazyAttribute); |
607 void attributeChangedFromParserOrByCloning(const QualifiedName&, const Atomi
cString&, AttributeModificationReason); | 607 void attributeChangedFromParserOrByCloning(const QualifiedName&, const Atomi
cString&, AttributeModificationReason); |
608 | 608 |
609 #ifndef NDEBUG | 609 #ifndef NDEBUG |
610 virtual void formatForDebugger(char* buffer, unsigned length) const OVERRIDE
; | 610 virtual void formatForDebugger(char* buffer, unsigned length) const OVERRIDE
; |
611 #endif | 611 #endif |
612 | 612 |
613 bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle*
newStyle); | 613 bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle*
newStyle); |
614 | 614 |
615 void cancelFocusAppearanceUpdate(); | 615 void cancelFocusAppearanceUpdate(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 inline Element* Node::parentElement() const | 689 inline Element* Node::parentElement() const |
690 { | 690 { |
691 ContainerNode* parent = parentNode(); | 691 ContainerNode* parent = parentNode(); |
692 return parent && parent->isElementNode() ? toElement(parent) : 0; | 692 return parent && parent->isElementNode() ? toElement(parent) : 0; |
693 } | 693 } |
694 | 694 |
695 inline bool Element::fastHasAttribute(const QualifiedName& name) const | 695 inline bool Element::fastHasAttribute(const QualifiedName& name) const |
696 { | 696 { |
697 ASSERT(fastAttributeLookupAllowed(name)); | 697 ASSERT(fastAttributeLookupAllowed(name)); |
698 return elementData() && getAttributeItem(name); | 698 return elementData() && findAttributeByName(name); |
699 } | 699 } |
700 | 700 |
701 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name)
const | 701 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name)
const |
702 { | 702 { |
703 ASSERT(fastAttributeLookupAllowed(name)); | 703 ASSERT(fastAttributeLookupAllowed(name)); |
704 if (elementData()) { | 704 if (elementData()) { |
705 if (const Attribute* attribute = getAttributeItem(name)) | 705 if (const Attribute* attribute = findAttributeByName(name)) |
706 return attribute->value(); | 706 return attribute->value(); |
707 } | 707 } |
708 return nullAtom; | 708 return nullAtom; |
709 } | 709 } |
710 | 710 |
711 inline bool Element::hasAttributesWithoutUpdate() const | 711 inline bool Element::hasAttributesWithoutUpdate() const |
712 { | 712 { |
713 return elementData() && !elementData()->isEmpty(); | 713 return elementData() && elementData()->hasAttributes(); |
714 } | 714 } |
715 | 715 |
716 inline const AtomicString& Element::idForStyleResolution() const | 716 inline const AtomicString& Element::idForStyleResolution() const |
717 { | 717 { |
718 ASSERT(hasID()); | 718 ASSERT(hasID()); |
719 return elementData()->idForStyleResolution(); | 719 return elementData()->idForStyleResolution(); |
720 } | 720 } |
721 | 721 |
722 inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const | 722 inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const |
723 { | 723 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 inline const SpaceSplitString& Element::classNames() const | 760 inline const SpaceSplitString& Element::classNames() const |
761 { | 761 { |
762 ASSERT(hasClass()); | 762 ASSERT(hasClass()); |
763 ASSERT(elementData()); | 763 ASSERT(elementData()); |
764 return elementData()->classNames(); | 764 return elementData()->classNames(); |
765 } | 765 } |
766 | 766 |
767 inline size_t Element::attributeCount() const | 767 inline size_t Element::attributeCount() const |
768 { | 768 { |
769 ASSERT(elementData()); | 769 ASSERT(elementData()); |
770 return elementData()->length(); | 770 return elementData()->attributeCount(); |
771 } | 771 } |
772 | 772 |
773 inline const Attribute& Element::attributeItem(unsigned index) const | 773 inline const Attribute& Element::attributeAt(unsigned index) const |
774 { | 774 { |
775 ASSERT(elementData()); | 775 ASSERT(elementData()); |
776 return elementData()->attributeItem(index); | 776 return elementData()->attributeAt(index); |
777 } | 777 } |
778 | 778 |
779 inline const Attribute* Element::getAttributeItem(const QualifiedName& name) con
st | 779 inline const Attribute* Element::findAttributeByName(const QualifiedName& name)
const |
780 { | 780 { |
781 ASSERT(elementData()); | 781 ASSERT(elementData()); |
782 return elementData()->getAttributeItem(name); | 782 return elementData()->findAttributeByName(name); |
783 } | 783 } |
784 | 784 |
785 inline bool Element::hasID() const | 785 inline bool Element::hasID() const |
786 { | 786 { |
787 return elementData() && elementData()->hasID(); | 787 return elementData() && elementData()->hasID(); |
788 } | 788 } |
789 | 789 |
790 inline bool Element::hasClass() const | 790 inline bool Element::hasClass() const |
791 { | 791 { |
792 return elementData() && elementData()->hasClass(); | 792 return elementData() && elementData()->hasClass(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return element.predicate; } \ | 874 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return element.predicate; } \ |
875 DEFINE_NODE_TYPE_CASTS(thisType, predicate) | 875 DEFINE_NODE_TYPE_CASTS(thisType, predicate) |
876 | 876 |
877 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ | 877 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
878 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return is##thisType(element); } \ | 878 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return is##thisType(element); } \ |
879 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) | 879 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) |
880 | 880 |
881 } // namespace | 881 } // namespace |
882 | 882 |
883 #endif | 883 #endif |
OLD | NEW |