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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // In either of those cases, we'll just stop. | 151 // In either of those cases, we'll just stop. |
152 if (next->parentNode() != this) | 152 if (next->parentNode() != this) |
153 break; | 153 break; |
154 if (child->parentNode()) | 154 if (child->parentNode()) |
155 break; | 155 break; |
156 | 156 |
157 #if ENABLE(INSPECTOR) | 157 #if ENABLE(INSPECTOR) |
158 InspectorInstrumentation::willInsertDOMNode(document(), child, this); | 158 InspectorInstrumentation::willInsertDOMNode(document(), child, this); |
159 #endif | 159 #endif |
160 | 160 |
| 161 child->setDocumentRecursively(document()); |
161 insertBeforeCommon(next.get(), child); | 162 insertBeforeCommon(next.get(), child); |
162 | 163 |
163 // Send notification about the children change. | 164 // Send notification about the children change. |
164 childrenChanged(false, refChildPreviousSibling.get(), next.get(), 1); | 165 childrenChanged(false, refChildPreviousSibling.get(), next.get(), 1); |
165 notifyChildInserted(child); | 166 notifyChildInserted(child); |
166 | 167 |
167 // Add child to the rendering tree. | 168 // Add child to the rendering tree. |
168 if (attached() && !child->attached() && child->parentNode() == this) { | 169 if (attached() && !child->attached() && child->parentNode() == this) { |
169 if (shouldLazyAttach) | 170 if (shouldLazyAttach) |
170 child->lazyAttach(); | 171 child->lazyAttach(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (child->parentNode()) | 300 if (child->parentNode()) |
300 break; | 301 break; |
301 | 302 |
302 ASSERT(!child->nextSibling()); | 303 ASSERT(!child->nextSibling()); |
303 ASSERT(!child->previousSibling()); | 304 ASSERT(!child->previousSibling()); |
304 | 305 |
305 #if ENABLE(INSPECTOR) | 306 #if ENABLE(INSPECTOR) |
306 InspectorInstrumentation::willInsertDOMNode(document(), child.get(), thi
s); | 307 InspectorInstrumentation::willInsertDOMNode(document(), child.get(), thi
s); |
307 #endif | 308 #endif |
308 | 309 |
| 310 child->setDocumentRecursively(document()); |
| 311 |
309 // Add child after "prev". | 312 // Add child after "prev". |
310 forbidEventDispatch(); | 313 forbidEventDispatch(); |
311 Node* next; | 314 Node* next; |
312 if (prev) { | 315 if (prev) { |
313 next = prev->nextSibling(); | 316 next = prev->nextSibling(); |
314 ASSERT(m_firstChild != next); | 317 ASSERT(m_firstChild != next); |
315 prev->setNextSibling(child.get()); | 318 prev->setNextSibling(child.get()); |
316 } else { | 319 } else { |
317 next = m_firstChild; | 320 next = m_firstChild; |
318 m_firstChild = child.get(); | 321 m_firstChild = child.get(); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 // that means someone is doing something with DOM mutation -- can't
re-parent | 588 // that means someone is doing something with DOM mutation -- can't
re-parent |
586 // a child that already has a parent. | 589 // a child that already has a parent. |
587 if (child->parentNode()) | 590 if (child->parentNode()) |
588 break; | 591 break; |
589 } | 592 } |
590 | 593 |
591 #if ENABLE(INSPECTOR) | 594 #if ENABLE(INSPECTOR) |
592 InspectorInstrumentation::willInsertDOMNode(document(), child, this); | 595 InspectorInstrumentation::willInsertDOMNode(document(), child, this); |
593 #endif | 596 #endif |
594 | 597 |
| 598 child->setDocumentRecursively(document()); |
| 599 |
595 // Append child to the end of the list | 600 // Append child to the end of the list |
596 forbidEventDispatch(); | 601 forbidEventDispatch(); |
597 child->setParent(this); | 602 child->setParent(this); |
598 if (m_lastChild) { | 603 if (m_lastChild) { |
599 child->setPreviousSibling(m_lastChild); | 604 child->setPreviousSibling(m_lastChild); |
600 m_lastChild->setNextSibling(child); | 605 m_lastChild->setNextSibling(child); |
601 } else | 606 } else |
602 m_firstChild = child; | 607 m_firstChild = child; |
603 m_lastChild = child; | 608 m_lastChild = child; |
604 allowEventDispatch(); | 609 allowEventDispatch(); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 if (!document()->hasListenerType(Document::BEFORELOAD_LISTENER)) | 1072 if (!document()->hasListenerType(Document::BEFORELOAD_LISTENER)) |
1068 return true; | 1073 return true; |
1069 | 1074 |
1070 RefPtr<ContainerNode> protector(this); | 1075 RefPtr<ContainerNode> protector(this); |
1071 RefPtr<BeforeLoadEvent> beforeLoadEvent = BeforeLoadEvent::create(sourceURL)
; | 1076 RefPtr<BeforeLoadEvent> beforeLoadEvent = BeforeLoadEvent::create(sourceURL)
; |
1072 dispatchEvent(beforeLoadEvent.get()); | 1077 dispatchEvent(beforeLoadEvent.get()); |
1073 return !beforeLoadEvent->defaultPrevented(); | 1078 return !beforeLoadEvent->defaultPrevented(); |
1074 } | 1079 } |
1075 | 1080 |
1076 } // namespace WebCore | 1081 } // namespace WebCore |
OLD | NEW |