| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "core/layout/HitTestRequest.h" | 33 #include "core/layout/HitTestRequest.h" |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "wtf/text/AtomicString.h" | 35 #include "wtf/text/AtomicString.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class ContainerNode; | 39 class ContainerNode; |
| 40 class DOMSelection; | 40 class DOMSelection; |
| 41 class Document; | 41 class Document; |
| 42 class Element; | 42 class Element; |
| 43 class HTMLLabelElement; | |
| 44 class HTMLMapElement; | 43 class HTMLMapElement; |
| 45 class HitTestResult; | 44 class HitTestResult; |
| 46 class IdTargetObserverRegistry; | 45 class IdTargetObserverRegistry; |
| 47 class ScopedStyleResolver; | 46 class ScopedStyleResolver; |
| 48 class Node; | 47 class Node; |
| 49 | 48 |
| 50 // A class which inherits both Node and TreeScope must call clearRareData() in i
ts destructor | 49 // A class which inherits both Node and TreeScope must call clearRareData() in i
ts destructor |
| 51 // so that the Node destructor no longer does problematic NodeList cache manipul
ation in | 50 // so that the Node destructor no longer does problematic NodeList cache manipul
ation in |
| 52 // the destructor. | 51 // the destructor. |
| 53 class CORE_EXPORT TreeScope : public GarbageCollectedMixin { | 52 class CORE_EXPORT TreeScope : public GarbageCollectedMixin { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 75 | 74 |
| 76 void addImageMap(HTMLMapElement*); | 75 void addImageMap(HTMLMapElement*); |
| 77 void removeImageMap(HTMLMapElement*); | 76 void removeImageMap(HTMLMapElement*); |
| 78 HTMLMapElement* getImageMap(const String& url) const; | 77 HTMLMapElement* getImageMap(const String& url) const; |
| 79 | 78 |
| 80 Element* elementFromPoint(int x, int y) const; | 79 Element* elementFromPoint(int x, int y) const; |
| 81 Element* hitTestPoint(int x, int y, const HitTestRequest&) const; | 80 Element* hitTestPoint(int x, int y, const HitTestRequest&) const; |
| 82 HeapVector<Member<Element>> elementsFromPoint(int x, int y) const; | 81 HeapVector<Member<Element>> elementsFromPoint(int x, int y) const; |
| 83 HeapVector<Member<Element>> elementsFromHitTestResult(HitTestResult&) const; | 82 HeapVector<Member<Element>> elementsFromHitTestResult(HitTestResult&) const; |
| 84 | 83 |
| 85 // For accessibility. | |
| 86 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute
; } | |
| 87 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); | |
| 88 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); | |
| 89 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue); | |
| 90 | |
| 91 DOMSelection* getSelection() const; | 84 DOMSelection* getSelection() const; |
| 92 | 85 |
| 93 Element* retarget(const Element& target) const; | 86 Element* retarget(const Element& target) const; |
| 94 | 87 |
| 95 // Find first anchor with the given name. | 88 // Find first anchor with the given name. |
| 96 // First searches for an element with the given ID, but if that fails, then
looks | 89 // First searches for an element with the given ID, but if that fails, then
looks |
| 97 // for an anchor with the given name. ID matching is always case sensitive,
but | 90 // for an anchor with the given name. ID matching is always case sensitive,
but |
| 98 // Anchor name matching is case sensitive in strict mode and not case sensit
ive in | 91 // Anchor name matching is case sensitive in strict mode and not case sensit
ive in |
| 99 // quirks mode for historical compatibility reasons. | 92 // quirks mode for historical compatibility reasons. |
| 100 Element* findAnchor(const String& name); | 93 Element* findAnchor(const String& name); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 131 void setParentTreeScope(TreeScope&); | 124 void setParentTreeScope(TreeScope&); |
| 132 void setNeedsStyleRecalcForViewportUnits(); | 125 void setNeedsStyleRecalcForViewportUnits(); |
| 133 | 126 |
| 134 private: | 127 private: |
| 135 Member<ContainerNode> m_rootNode; | 128 Member<ContainerNode> m_rootNode; |
| 136 Member<Document> m_document; | 129 Member<Document> m_document; |
| 137 Member<TreeScope> m_parentTreeScope; | 130 Member<TreeScope> m_parentTreeScope; |
| 138 | 131 |
| 139 Member<DocumentOrderedMap> m_elementsById; | 132 Member<DocumentOrderedMap> m_elementsById; |
| 140 Member<DocumentOrderedMap> m_imageMapsByName; | 133 Member<DocumentOrderedMap> m_imageMapsByName; |
| 141 Member<DocumentOrderedMap> m_labelsByForAttribute; | |
| 142 | 134 |
| 143 Member<IdTargetObserverRegistry> m_idTargetObserverRegistry; | 135 Member<IdTargetObserverRegistry> m_idTargetObserverRegistry; |
| 144 | 136 |
| 145 Member<ScopedStyleResolver> m_scopedStyleResolver; | 137 Member<ScopedStyleResolver> m_scopedStyleResolver; |
| 146 | 138 |
| 147 mutable Member<DOMSelection> m_selection; | 139 mutable Member<DOMSelection> m_selection; |
| 148 | 140 |
| 149 RadioButtonGroupScope m_radioButtonGroupScope; | 141 RadioButtonGroupScope m_radioButtonGroupScope; |
| 150 }; | 142 }; |
| 151 | 143 |
| 152 inline bool TreeScope::hasElementWithId(const AtomicString& id) const | 144 inline bool TreeScope::hasElementWithId(const AtomicString& id) const |
| 153 { | 145 { |
| 154 DCHECK(!id.isNull()); | 146 DCHECK(!id.isNull()); |
| 155 return m_elementsById && m_elementsById->contains(id); | 147 return m_elementsById && m_elementsById->contains(id); |
| 156 } | 148 } |
| 157 | 149 |
| 158 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst | 150 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst |
| 159 { | 151 { |
| 160 return m_elementsById && m_elementsById->containsMultiple(id); | 152 return m_elementsById && m_elementsById->containsMultiple(id); |
| 161 } | 153 } |
| 162 | 154 |
| 163 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) | 155 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) |
| 164 | 156 |
| 165 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ
est& = HitTestRequest::ReadOnly | HitTestRequest::Active); | 157 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ
est& = HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 166 | 158 |
| 167 } // namespace blink | 159 } // namespace blink |
| 168 | 160 |
| 169 #endif // TreeScope_h | 161 #endif // TreeScope_h |
| OLD | NEW |