| 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 25 matching lines...) Expand all Loading... |
| 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 HTMLMapElement; | 43 class HTMLMapElement; |
| 44 class HitTestResult; | 44 class HitTestResult; |
| 45 class IdTargetObserverRegistry; | 45 class IdTargetObserverRegistry; |
| 46 class SVGTreeScopeResources; |
| 46 class ScopedStyleResolver; | 47 class ScopedStyleResolver; |
| 47 class Node; | 48 class Node; |
| 48 | 49 |
| 49 // A class which inherits both Node and TreeScope must call clearRareData() in | 50 // A class which inherits both Node and TreeScope must call clearRareData() in |
| 50 // its destructor so that the Node destructor no longer does problematic | 51 // its destructor so that the Node destructor no longer does problematic |
| 51 // NodeList cache manipulation in the destructor. | 52 // NodeList cache manipulation in the destructor. |
| 52 class CORE_EXPORT TreeScope : public GarbageCollectedMixin { | 53 class CORE_EXPORT TreeScope : public GarbageCollectedMixin { |
| 53 public: | 54 public: |
| 54 TreeScope* parentTreeScope() const { return m_parentTreeScope; } | 55 TreeScope* parentTreeScope() const { return m_parentTreeScope; } |
| 55 | 56 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 Element* getElementByAccessKey(const String& key) const; | 121 Element* getElementByAccessKey(const String& key) const; |
| 121 | 122 |
| 122 DECLARE_VIRTUAL_TRACE(); | 123 DECLARE_VIRTUAL_TRACE(); |
| 123 | 124 |
| 124 ScopedStyleResolver* scopedStyleResolver() const { | 125 ScopedStyleResolver* scopedStyleResolver() const { |
| 125 return m_scopedStyleResolver.get(); | 126 return m_scopedStyleResolver.get(); |
| 126 } | 127 } |
| 127 ScopedStyleResolver& ensureScopedStyleResolver(); | 128 ScopedStyleResolver& ensureScopedStyleResolver(); |
| 128 void clearScopedStyleResolver(); | 129 void clearScopedStyleResolver(); |
| 129 | 130 |
| 131 SVGTreeScopeResources& ensureSVGTreeScopedResources(); |
| 132 |
| 130 protected: | 133 protected: |
| 131 TreeScope(ContainerNode&, Document&); | 134 TreeScope(ContainerNode&, Document&); |
| 132 TreeScope(Document&); | 135 TreeScope(Document&); |
| 133 virtual ~TreeScope(); | 136 virtual ~TreeScope(); |
| 134 | 137 |
| 135 void setDocument(Document& document) { m_document = &document; } | 138 void setDocument(Document& document) { m_document = &document; } |
| 136 void setParentTreeScope(TreeScope&); | 139 void setParentTreeScope(TreeScope&); |
| 137 void setNeedsStyleRecalcForViewportUnits(); | 140 void setNeedsStyleRecalcForViewportUnits(); |
| 138 | 141 |
| 139 private: | 142 private: |
| 140 Member<ContainerNode> m_rootNode; | 143 Member<ContainerNode> m_rootNode; |
| 141 Member<Document> m_document; | 144 Member<Document> m_document; |
| 142 Member<TreeScope> m_parentTreeScope; | 145 Member<TreeScope> m_parentTreeScope; |
| 143 | 146 |
| 144 Member<DocumentOrderedMap> m_elementsById; | 147 Member<DocumentOrderedMap> m_elementsById; |
| 145 Member<DocumentOrderedMap> m_imageMapsByName; | 148 Member<DocumentOrderedMap> m_imageMapsByName; |
| 146 | 149 |
| 147 Member<IdTargetObserverRegistry> m_idTargetObserverRegistry; | 150 Member<IdTargetObserverRegistry> m_idTargetObserverRegistry; |
| 148 | 151 |
| 149 Member<ScopedStyleResolver> m_scopedStyleResolver; | 152 Member<ScopedStyleResolver> m_scopedStyleResolver; |
| 150 | 153 |
| 151 mutable Member<DOMSelection> m_selection; | 154 mutable Member<DOMSelection> m_selection; |
| 152 | 155 |
| 153 RadioButtonGroupScope m_radioButtonGroupScope; | 156 RadioButtonGroupScope m_radioButtonGroupScope; |
| 157 |
| 158 Member<SVGTreeScopeResources> m_svgTreeScopedResources; |
| 154 }; | 159 }; |
| 155 | 160 |
| 156 inline bool TreeScope::hasElementWithId(const AtomicString& id) const { | 161 inline bool TreeScope::hasElementWithId(const AtomicString& id) const { |
| 157 DCHECK(!id.isNull()); | 162 DCHECK(!id.isNull()); |
| 158 return m_elementsById && m_elementsById->contains(id); | 163 return m_elementsById && m_elementsById->contains(id); |
| 159 } | 164 } |
| 160 | 165 |
| 161 inline bool TreeScope::containsMultipleElementsWithId( | 166 inline bool TreeScope::containsMultipleElementsWithId( |
| 162 const AtomicString& id) const { | 167 const AtomicString& id) const { |
| 163 return m_elementsById && m_elementsById->containsMultiple(id); | 168 return m_elementsById && m_elementsById->containsMultiple(id); |
| 164 } | 169 } |
| 165 | 170 |
| 166 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) | 171 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) |
| 167 | 172 |
| 168 HitTestResult hitTestInDocument( | 173 HitTestResult hitTestInDocument( |
| 169 const Document*, | 174 const Document*, |
| 170 int x, | 175 int x, |
| 171 int y, | 176 int y, |
| 172 const HitTestRequest& = HitTestRequest::ReadOnly | HitTestRequest::Active); | 177 const HitTestRequest& = HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 173 | 178 |
| 174 } // namespace blink | 179 } // namespace blink |
| 175 | 180 |
| 176 #endif // TreeScope_h | 181 #endif // TreeScope_h |
| OLD | NEW |