| 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, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/dom/ContainerNode.h" | 24 #include "core/dom/ContainerNode.h" |
| 25 | 25 |
| 26 #include "bindings/core/v8/ExceptionState.h" | 26 #include "bindings/core/v8/ExceptionState.h" |
| 27 #include "core/dom/ChildFrameDisconnector.h" | 27 #include "core/dom/ChildFrameDisconnector.h" |
| 28 #include "core/dom/ChildListMutationScope.h" | 28 #include "core/dom/ChildListMutationScope.h" |
| 29 #include "core/dom/ClassCollection.h" | 29 #include "core/dom/ClassCollection.h" |
| 30 #include "core/dom/ElementTraversal.h" | 30 #include "core/dom/ElementTraversal.h" |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/FullscreenElementStack.h" | |
| 33 #include "core/dom/NameNodeList.h" | 32 #include "core/dom/NameNodeList.h" |
| 34 #include "core/dom/NoEventDispatchAssertion.h" | 33 #include "core/dom/NoEventDispatchAssertion.h" |
| 35 #include "core/dom/NodeChildRemovalTracker.h" | 34 #include "core/dom/NodeChildRemovalTracker.h" |
| 36 #include "core/dom/NodeRareData.h" | 35 #include "core/dom/NodeRareData.h" |
| 37 #include "core/dom/NodeRenderStyle.h" | 36 #include "core/dom/NodeRenderStyle.h" |
| 38 #include "core/dom/NodeTraversal.h" | 37 #include "core/dom/NodeTraversal.h" |
| 39 #include "core/dom/SelectorQuery.h" | 38 #include "core/dom/SelectorQuery.h" |
| 40 #include "core/dom/StaticNodeList.h" | 39 #include "core/dom/StaticNodeList.h" |
| 41 #include "core/dom/StyleEngine.h" | 40 #include "core/dom/StyleEngine.h" |
| 42 #include "core/dom/shadow/ElementShadow.h" | 41 #include "core/dom/shadow/ElementShadow.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // ASSERT(!oldChild->isPseudoElement()) | 536 // ASSERT(!oldChild->isPseudoElement()) |
| 538 if (!oldChild || oldChild->parentNode() != this || oldChild->isPseudoElement
()) { | 537 if (!oldChild || oldChild->parentNode() != this || oldChild->isPseudoElement
()) { |
| 539 exceptionState.throwDOMException(NotFoundError, "The node to be removed
is not a child of this node."); | 538 exceptionState.throwDOMException(NotFoundError, "The node to be removed
is not a child of this node."); |
| 540 return nullptr; | 539 return nullptr; |
| 541 } | 540 } |
| 542 | 541 |
| 543 RefPtrWillBeRawPtr<Node> child = oldChild; | 542 RefPtrWillBeRawPtr<Node> child = oldChild; |
| 544 | 543 |
| 545 document().removeFocusedElementOfSubtree(child.get()); | 544 document().removeFocusedElementOfSubtree(child.get()); |
| 546 | 545 |
| 547 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(document())) | |
| 548 fullscreen->removeFullScreenElementOfSubtree(child.get()); | |
| 549 | |
| 550 // Events fired when blurring currently focused node might have moved this | 546 // Events fired when blurring currently focused node might have moved this |
| 551 // child into a different parent. | 547 // child into a different parent. |
| 552 if (child->parentNode() != this) { | 548 if (child->parentNode() != this) { |
| 553 exceptionState.throwDOMException(NotFoundError, "The node to be removed
is no longer a child of this node. Perhaps it was moved in a 'blur' event handle
r?"); | 549 exceptionState.throwDOMException(NotFoundError, "The node to be removed
is no longer a child of this node. Perhaps it was moved in a 'blur' event handle
r?"); |
| 554 return nullptr; | 550 return nullptr; |
| 555 } | 551 } |
| 556 | 552 |
| 557 willRemoveChild(*child); | 553 willRemoveChild(*child); |
| 558 | 554 |
| 559 // Mutation events might have moved this child into a different parent. | 555 // Mutation events might have moved this child into a different parent. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 // this differs from other remove functions because it forcibly removes all the
children, | 618 // this differs from other remove functions because it forcibly removes all the
children, |
| 623 // regardless of read-only status or event exceptions, e.g. | 619 // regardless of read-only status or event exceptions, e.g. |
| 624 void ContainerNode::removeChildren() | 620 void ContainerNode::removeChildren() |
| 625 { | 621 { |
| 626 if (!m_firstChild) | 622 if (!m_firstChild) |
| 627 return; | 623 return; |
| 628 | 624 |
| 629 // The container node can be removed from event handlers. | 625 // The container node can be removed from event handlers. |
| 630 RefPtrWillBeRawPtr<ContainerNode> protect(this); | 626 RefPtrWillBeRawPtr<ContainerNode> protect(this); |
| 631 | 627 |
| 632 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist
s(document())) | |
| 633 fullscreen->removeFullScreenElementOfSubtree(this, true); | |
| 634 | |
| 635 // Do any prep work needed before actually starting to detach | 628 // Do any prep work needed before actually starting to detach |
| 636 // and remove... e.g. stop loading frames, fire unload events. | 629 // and remove... e.g. stop loading frames, fire unload events. |
| 637 willRemoveChildren(); | 630 willRemoveChildren(); |
| 638 | 631 |
| 639 { | 632 { |
| 640 // Removing focus can cause frames to load, either via events (focusout,
blur) | 633 // Removing focus can cause frames to load, either via events (focusout,
blur) |
| 641 // or widget updates (e.g., for <embed>). | 634 // or widget updates (e.g., for <embed>). |
| 642 SubframeLoadingDisabler disabler(*this); | 635 SubframeLoadingDisabler disabler(*this); |
| 643 | 636 |
| 644 // Exclude this node when looking for removed focusedElement since only | 637 // Exclude this node when looking for removed focusedElement since only |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 return true; | 1406 return true; |
| 1414 | 1407 |
| 1415 if (node->isElementNode() && toElement(node)->shadow()) | 1408 if (node->isElementNode() && toElement(node)->shadow()) |
| 1416 return true; | 1409 return true; |
| 1417 | 1410 |
| 1418 return false; | 1411 return false; |
| 1419 } | 1412 } |
| 1420 #endif | 1413 #endif |
| 1421 | 1414 |
| 1422 } // namespace blink | 1415 } // namespace blink |
| OLD | NEW |