| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 void removedLastRefToScope(); | 122 void removedLastRefToScope(); |
| 123 | 123 |
| 124 bool isInclusiveAncestorOf(const TreeScope&) const; | 124 bool isInclusiveAncestorOf(const TreeScope&) const; |
| 125 unsigned short comparePosition(const TreeScope&) const; | 125 unsigned short comparePosition(const TreeScope&) const; |
| 126 | 126 |
| 127 Element* getElementByAccessKey(const String& key) const; | 127 Element* getElementByAccessKey(const String& key) const; |
| 128 | 128 |
| 129 const KURL& baseURL() const { return m_baseURL; } | 129 virtual const KURL& baseURL() const = 0; |
| 130 KURL completeURL(const String&) const; | 130 KURL completeURL(const String&) const; |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 TreeScope(ContainerNode*, Document*); | 133 TreeScope(ContainerNode*, Document*); |
| 134 TreeScope(Document*); | 134 TreeScope(Document*); |
| 135 virtual ~TreeScope(); | 135 virtual ~TreeScope(); |
| 136 | 136 |
| 137 void destroyTreeScopeData(); | 137 void destroyTreeScopeData(); |
| 138 void setDocument(Document& document) { m_document = &document; } | 138 void setDocument(Document& document) { m_document = &document; } |
| 139 void setParentTreeScope(TreeScope&); | 139 void setParentTreeScope(TreeScope&); |
| 140 | 140 |
| 141 bool hasGuardRefCount() const { return m_guardRefCount; } | 141 bool hasGuardRefCount() const { return m_guardRefCount; } |
| 142 | 142 |
| 143 void setNeedsStyleRecalcForViewportUnits(); | 143 void setNeedsStyleRecalcForViewportUnits(); |
| 144 | 144 |
| 145 void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; } | |
| 146 | |
| 147 private: | 145 private: |
| 148 virtual void dispose() { } | 146 virtual void dispose() { } |
| 149 | 147 |
| 150 int refCount() const; | 148 int refCount() const; |
| 151 #if SECURITY_ASSERT_ENABLED | 149 #if SECURITY_ASSERT_ENABLED |
| 152 bool deletionHasBegun(); | 150 bool deletionHasBegun(); |
| 153 void beginDeletion(); | 151 void beginDeletion(); |
| 154 #else | 152 #else |
| 155 bool deletionHasBegun() { return false; } | 153 bool deletionHasBegun() { return false; } |
| 156 void beginDeletion() { } | 154 void beginDeletion() { } |
| 157 #endif | 155 #endif |
| 158 | 156 |
| 159 bool rootNodeHasTreeSharedParent() const; | 157 bool rootNodeHasTreeSharedParent() const; |
| 160 | 158 |
| 161 Node* m_rootNode; | 159 Node* m_rootNode; |
| 162 Document* m_document; | 160 Document* m_document; |
| 163 TreeScope* m_parentTreeScope; | 161 TreeScope* m_parentTreeScope; |
| 164 int m_guardRefCount; | 162 int m_guardRefCount; |
| 165 | 163 |
| 166 OwnPtr<DocumentOrderedMap> m_elementsById; | 164 OwnPtr<DocumentOrderedMap> m_elementsById; |
| 167 OwnPtr<DocumentOrderedMap> m_imageMapsByName; | 165 OwnPtr<DocumentOrderedMap> m_imageMapsByName; |
| 168 OwnPtr<DocumentOrderedMap> m_labelsByForAttribute; | 166 OwnPtr<DocumentOrderedMap> m_labelsByForAttribute; |
| 169 | 167 |
| 170 OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry; | 168 OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry; |
| 171 | 169 |
| 172 mutable RefPtr<DOMSelection> m_selection; | 170 mutable RefPtr<DOMSelection> m_selection; |
| 173 | |
| 174 KURL m_baseURL; | |
| 175 }; | 171 }; |
| 176 | 172 |
| 177 inline bool TreeScope::hasElementWithId(StringImpl* id) const | 173 inline bool TreeScope::hasElementWithId(StringImpl* id) const |
| 178 { | 174 { |
| 179 ASSERT(id); | 175 ASSERT(id); |
| 180 return m_elementsById && m_elementsById->contains(id); | 176 return m_elementsById && m_elementsById->contains(id); |
| 181 } | 177 } |
| 182 | 178 |
| 183 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst | 179 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst |
| 184 { | 180 { |
| 185 return m_elementsById && m_elementsById->containsMultiple(id.impl()); | 181 return m_elementsById && m_elementsById->containsMultiple(id.impl()); |
| 186 } | 182 } |
| 187 | 183 |
| 188 inline bool operator==(const TreeScope& a, const TreeScope& b) { return &a == &b
; } | 184 inline bool operator==(const TreeScope& a, const TreeScope& b) { return &a == &b
; } |
| 189 inline bool operator==(const TreeScope& a, const TreeScope* b) { return &a == b;
} | 185 inline bool operator==(const TreeScope& a, const TreeScope* b) { return &a == b;
} |
| 190 inline bool operator==(const TreeScope* a, const TreeScope& b) { return a == &b;
} | 186 inline bool operator==(const TreeScope* a, const TreeScope& b) { return a == &b;
} |
| 191 inline bool operator!=(const TreeScope& a, const TreeScope& b) { return !(a == b
); } | 187 inline bool operator!=(const TreeScope& a, const TreeScope& b) { return !(a == b
); } |
| 192 inline bool operator!=(const TreeScope& a, const TreeScope* b) { return !(a == b
); } | 188 inline bool operator!=(const TreeScope& a, const TreeScope* b) { return !(a == b
); } |
| 193 inline bool operator!=(const TreeScope* a, const TreeScope& b) { return !(a == b
); } | 189 inline bool operator!=(const TreeScope* a, const TreeScope& b) { return !(a == b
); } |
| 194 | 190 |
| 195 RenderObject* rendererFromPoint(Document*, int x, int y, LayoutPoint* localPoint
= 0); | 191 RenderObject* rendererFromPoint(Document*, int x, int y, LayoutPoint* localPoint
= 0); |
| 196 TreeScope* commonTreeScope(Node*, Node*); | 192 TreeScope* commonTreeScope(Node*, Node*); |
| 197 | 193 |
| 198 } // namespace WebCore | 194 } // namespace WebCore |
| 199 | 195 |
| 200 #endif // TreeScope_h | 196 #endif // TreeScope_h |
| OLD | NEW |