| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual void reportMemoryUsage(MemoryObjectInfo*) const; | 98 virtual void reportMemoryUsage(MemoryObjectInfo*) const; |
| 99 | 99 |
| 100 static TreeScope* noDocumentInstance() | 100 static TreeScope* noDocumentInstance() |
| 101 { | 101 { |
| 102 DEFINE_STATIC_LOCAL(Persistent<TreeScope>, instance, (create())); | 102 DEFINE_STATIC_LOCAL(Persistent<TreeScope>, instance, (create())); |
| 103 return instance; | 103 return instance; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void trace(Visitor*); | 106 void trace(Visitor*); |
| 107 | 107 |
| 108 // We can't pass TreeScope pointer into Visitor::visit function directly bec
ause it does not coincide with the actual start of the object and | 108 // We can't pass TreeScope pointer into Visitor::mark function |
| 109 // visitor has to access object header. Thus we need a helper method that wo
uld correctly adjust the pointer before passing it into the visitor. | 109 // directly because it does not coincide with the actual start of |
| 110 virtual void visitWith(Visitor*) const; | 110 // the object and visitor has to access object header. Thus we |
| 111 // need a helper method that correctly adjusts the pointer |
| 112 // before passing it into the visitor. |
| 113 virtual void adjustAndMark(Visitor*) const; |
| 111 | 114 |
| 112 protected: | 115 protected: |
| 113 static TreeScope* create() | 116 static TreeScope* create() |
| 114 { | 117 { |
| 115 // This is only used by noDocumentInstance(), which is a singleton objec
t of TreeScope. | 118 // This is only used by noDocumentInstance(), which is a singleton objec
t of TreeScope. |
| 116 return new(Heap::allocate<void>(sizeof(TreeScope))) TreeScope; | 119 return new(Heap::allocate<void>(sizeof(TreeScope))) TreeScope; |
| 117 } | 120 } |
| 118 | 121 |
| 119 TreeScope(ContainerNode*, Document*); | 122 TreeScope(ContainerNode*, Document*); |
| 120 TreeScope(Document*); | 123 TreeScope(Document*); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst | 157 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst |
| 155 { | 158 { |
| 156 return m_elementsById && m_elementsById->containsMultiple(id.impl()); | 159 return m_elementsById && m_elementsById->containsMultiple(id.impl()); |
| 157 } | 160 } |
| 158 | 161 |
| 159 Node* nodeFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0); | 162 Node* nodeFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0); |
| 160 TreeScope* commonTreeScope(Node*, Node*); | 163 TreeScope* commonTreeScope(Node*, Node*); |
| 161 | 164 |
| 162 template<> class TraceTrait<TreeScope> { | 165 template<> class TraceTrait<TreeScope> { |
| 163 public: | 166 public: |
| 164 static void visit(Visitor* v, const TreeScope* self) { self->visitWith(v); } | 167 static void mark(Visitor* v, const TreeScope* self) { self->adjustAndMark(v)
; } |
| 165 static intptr_t getTypeMarker() { return 0; } | 168 static intptr_t getTypeMarker() { return 0; } |
| 166 static void checkTypeMarker(Visitor* visitor, const TreeScope* t) { } | 169 static void checkTypeMarker(Visitor* visitor, const TreeScope* t) { } |
| 167 static void trace(Visitor* visitor, void* self) | 170 static void trace(Visitor* visitor, void* self) |
| 168 { | 171 { |
| 169 static_cast<TreeScope*>(self)->trace(visitor); | 172 static_cast<TreeScope*>(self)->trace(visitor); |
| 170 } | 173 } |
| 171 }; | 174 }; |
| 172 | 175 |
| 173 } // namespace WebCore | 176 } // namespace WebCore |
| 174 | 177 |
| 175 #endif // TreeScope_h | 178 #endif // TreeScope_h |
| OLD | NEW |