| 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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 } | 2481 } |
| 2482 } | 2482 } |
| 2483 } | 2483 } |
| 2484 | 2484 |
| 2485 styleEngine().didDetach(); | 2485 styleEngine().didDetach(); |
| 2486 | 2486 |
| 2487 frameHost()->eventHandlerRegistry().documentDetached(*this); | 2487 frameHost()->eventHandlerRegistry().documentDetached(*this); |
| 2488 | 2488 |
| 2489 // Signal destruction to mutation observers. | 2489 // Signal destruction to mutation observers. |
| 2490 SynchronousMutationNotifier::notifyContextDestroyed(); | 2490 SynchronousMutationNotifier::notifyContextDestroyed(); |
| 2491 m_frame->selection().documentDetached(*this); | |
| 2492 | 2491 |
| 2493 // If this Document is associated with a live DocumentLoader, the | 2492 // If this Document is associated with a live DocumentLoader, the |
| 2494 // DocumentLoader will take care of clearing the FetchContext. Deferring | 2493 // DocumentLoader will take care of clearing the FetchContext. Deferring |
| 2495 // to the DocumentLoader when possible also prevents prematurely clearing | 2494 // to the DocumentLoader when possible also prevents prematurely clearing |
| 2496 // the context in the case where multiple Documents end up associated with | 2495 // the context in the case where multiple Documents end up associated with |
| 2497 // a single DocumentLoader (e.g., navigating to a javascript: url). | 2496 // a single DocumentLoader (e.g., navigating to a javascript: url). |
| 2498 if (!loader()) | 2497 if (!loader()) |
| 2499 m_fetcher->clearContext(); | 2498 m_fetcher->clearContext(); |
| 2500 // If this document is the master for an HTMLImportsController, sever that | 2499 // If this document is the master for an HTMLImportsController, sever that |
| 2501 // relationship. This ensures that we don't leave import loads in flight, | 2500 // relationship. This ensures that we don't leave import loads in flight, |
| (...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4210 EventDispatchForbiddenScope assertNoEventDispatch; | 4209 EventDispatchForbiddenScope assertNoEventDispatch; |
| 4211 for (Range* range : m_ranges) | 4210 for (Range* range : m_ranges) |
| 4212 range->nodeChildrenWillBeRemoved(container); | 4211 range->nodeChildrenWillBeRemoved(container); |
| 4213 | 4212 |
| 4214 for (NodeIterator* ni : m_nodeIterators) { | 4213 for (NodeIterator* ni : m_nodeIterators) { |
| 4215 for (Node& n : NodeTraversal::childrenOf(container)) | 4214 for (Node& n : NodeTraversal::childrenOf(container)) |
| 4216 ni->nodeWillBeRemoved(n); | 4215 ni->nodeWillBeRemoved(n); |
| 4217 } | 4216 } |
| 4218 | 4217 |
| 4219 notifyNodeChildrenWillBeRemoved(container); | 4218 notifyNodeChildrenWillBeRemoved(container); |
| 4220 if (LocalFrame* frame = this->frame()) | |
| 4221 frame->selection().nodeChildrenWillBeRemoved(container); | |
| 4222 | 4219 |
| 4223 if (containsV1ShadowTree()) { | 4220 if (containsV1ShadowTree()) { |
| 4224 for (Node& n : NodeTraversal::childrenOf(container)) | 4221 for (Node& n : NodeTraversal::childrenOf(container)) |
| 4225 n.checkSlotChangeBeforeRemoved(); | 4222 n.checkSlotChangeBeforeRemoved(); |
| 4226 } | 4223 } |
| 4227 } | 4224 } |
| 4228 | 4225 |
| 4229 void Document::nodeWillBeRemoved(Node& n) { | 4226 void Document::nodeWillBeRemoved(Node& n) { |
| 4230 for (NodeIterator* ni : m_nodeIterators) | 4227 for (NodeIterator* ni : m_nodeIterators) |
| 4231 ni->nodeWillBeRemoved(n); | 4228 ni->nodeWillBeRemoved(n); |
| 4232 | 4229 |
| 4233 for (Range* range : m_ranges) | 4230 for (Range* range : m_ranges) |
| 4234 range->nodeWillBeRemoved(n); | 4231 range->nodeWillBeRemoved(n); |
| 4235 | 4232 |
| 4236 notifyNodeWillBeRemoved(n); | 4233 notifyNodeWillBeRemoved(n); |
| 4237 | 4234 |
| 4238 if (LocalFrame* frame = this->frame()) { | |
| 4239 frame->selection().nodeWillBeRemoved(n); | |
| 4240 } | |
| 4241 | |
| 4242 if (containsV1ShadowTree()) | 4235 if (containsV1ShadowTree()) |
| 4243 n.checkSlotChangeBeforeRemoved(); | 4236 n.checkSlotChangeBeforeRemoved(); |
| 4244 | 4237 |
| 4245 if (n.inActiveDocument() && n.isElementNode()) | 4238 if (n.inActiveDocument() && n.isElementNode()) |
| 4246 styleEngine().elementWillBeRemoved(toElement(n)); | 4239 styleEngine().elementWillBeRemoved(toElement(n)); |
| 4247 } | 4240 } |
| 4248 | 4241 |
| 4249 void Document::dataWillChange(const CharacterData& characterData) { | 4242 void Document::dataWillChange(const CharacterData& characterData) { |
| 4250 if (LocalFrame* frame = this->frame()) | 4243 if (LocalFrame* frame = this->frame()) |
| 4251 frame->selection().dataWillChange(characterData); | 4244 frame->selection().dataWillChange(characterData); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4269 void Document::didMergeTextNodes(const Text& mergedNode, | 4262 void Document::didMergeTextNodes(const Text& mergedNode, |
| 4270 const Text& nodeToBeRemoved, | 4263 const Text& nodeToBeRemoved, |
| 4271 unsigned oldLength) { | 4264 unsigned oldLength) { |
| 4272 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved)); | 4265 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved)); |
| 4273 if (!m_ranges.isEmpty()) { | 4266 if (!m_ranges.isEmpty()) { |
| 4274 for (Range* range : m_ranges) | 4267 for (Range* range : m_ranges) |
| 4275 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength); | 4268 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength); |
| 4276 } | 4269 } |
| 4277 | 4270 |
| 4278 notifyMergeTextNodes(mergedNode, nodeToBeRemovedWithIndex, oldLength); | 4271 notifyMergeTextNodes(mergedNode, nodeToBeRemovedWithIndex, oldLength); |
| 4279 if (m_frame) | |
| 4280 m_frame->selection().didMergeTextNodes(nodeToBeRemoved, oldLength); | |
| 4281 | 4272 |
| 4282 // FIXME: This should update markers for spelling and grammar checking. | 4273 // FIXME: This should update markers for spelling and grammar checking. |
| 4283 } | 4274 } |
| 4284 | 4275 |
| 4285 void Document::didSplitTextNode(const Text& oldNode) { | 4276 void Document::didSplitTextNode(const Text& oldNode) { |
| 4286 for (Range* range : m_ranges) | 4277 for (Range* range : m_ranges) |
| 4287 range->didSplitTextNode(oldNode); | 4278 range->didSplitTextNode(oldNode); |
| 4288 | 4279 |
| 4289 notifySplitTextNode(oldNode); | 4280 notifySplitTextNode(oldNode); |
| 4290 if (m_frame) | |
| 4291 m_frame->selection().didSplitTextNode(oldNode); | |
| 4292 | 4281 |
| 4293 // FIXME: This should update markers for spelling and grammar checking. | 4282 // FIXME: This should update markers for spelling and grammar checking. |
| 4294 } | 4283 } |
| 4295 | 4284 |
| 4296 void Document::setWindowAttributeEventListener(const AtomicString& eventType, | 4285 void Document::setWindowAttributeEventListener(const AtomicString& eventType, |
| 4297 EventListener* listener) { | 4286 EventListener* listener) { |
| 4298 LocalDOMWindow* domWindow = this->domWindow(); | 4287 LocalDOMWindow* domWindow = this->domWindow(); |
| 4299 if (!domWindow) | 4288 if (!domWindow) |
| 4300 return; | 4289 return; |
| 4301 domWindow->setAttributeEventListener(eventType, listener); | 4290 domWindow->setAttributeEventListener(eventType, listener); |
| (...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6518 } | 6507 } |
| 6519 | 6508 |
| 6520 void showLiveDocumentInstances() { | 6509 void showLiveDocumentInstances() { |
| 6521 WeakDocumentSet& set = liveDocumentSet(); | 6510 WeakDocumentSet& set = liveDocumentSet(); |
| 6522 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6511 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6523 for (Document* document : set) | 6512 for (Document* document : set) |
| 6524 fprintf(stderr, "- Document %p URL: %s\n", document, | 6513 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6525 document->url().getString().utf8().data()); | 6514 document->url().getString().utf8().data()); |
| 6526 } | 6515 } |
| 6527 #endif | 6516 #endif |
| OLD | NEW |