Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: sky/engine/core/dom/ContainerNode.cpp

Issue 759663003: Only allow one shadowRoot. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: ojan review. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.cpp ('k') | sky/engine/core/dom/Element.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 { 610 {
611 EventDispatchForbiddenScope assertNoEventDispatch; 611 EventDispatchForbiddenScope assertNoEventDispatch;
612 ScriptForbiddenScope forbidScript; 612 ScriptForbiddenScope forbidScript;
613 613
614 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { 614 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) {
615 // As an optimization we don't notify leaf nodes when when inserting 615 // As an optimization we don't notify leaf nodes when when inserting
616 // into detached subtrees. 616 // into detached subtrees.
617 if (!inDocument() && !node->isContainerNode()) 617 if (!inDocument() && !node->isContainerNode())
618 continue; 618 continue;
619 node->insertedInto(this); 619 node->insertedInto(this);
620 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; sh adowRoot = shadowRoot->olderShadowRoot()) 620 if (ShadowRoot* shadowRoot = node->shadowRoot())
621 notifyNodeInsertedInternal(*shadowRoot); 621 notifyNodeInsertedInternal(*shadowRoot);
622 } 622 }
623 } 623 }
624 624
625 void ContainerNode::notifyNodeRemoved(Node& root) 625 void ContainerNode::notifyNodeRemoved(Node& root)
626 { 626 {
627 ScriptForbiddenScope forbidScript; 627 ScriptForbiddenScope forbidScript;
628 EventDispatchForbiddenScope assertNoEventDispatch; 628 EventDispatchForbiddenScope assertNoEventDispatch;
629 629
630 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { 630 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) {
631 // As an optimization we skip notifying Text nodes and other leaf nodes 631 // As an optimization we skip notifying Text nodes and other leaf nodes
632 // of removal when they're not in the Document tree since the virtual 632 // of removal when they're not in the Document tree since the virtual
633 // call to removedFrom is not needed. 633 // call to removedFrom is not needed.
634 if (!node->inDocument() && !node->isContainerNode()) 634 if (!node->inDocument() && !node->isContainerNode())
635 continue; 635 continue;
636 node->removedFrom(this); 636 node->removedFrom(this);
637 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; sh adowRoot = shadowRoot->olderShadowRoot()) 637 if (ShadowRoot* shadowRoot = node->shadowRoot())
638 notifyNodeRemoved(*shadowRoot); 638 notifyNodeRemoved(*shadowRoot);
639 } 639 }
640 } 640 }
641 641
642 void ContainerNode::attach(const AttachContext& context) 642 void ContainerNode::attach(const AttachContext& context)
643 { 643 {
644 attachChildren(context); 644 attachChildren(context);
645 clearChildNeedsStyleRecalc(); 645 clearChildNeedsStyleRecalc();
646 Node::attach(context); 646 Node::attach(context);
647 } 647 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 return true; 945 return true;
946 946
947 if (node->isElementNode() && toElement(node)->shadow()) 947 if (node->isElementNode() && toElement(node)->shadow())
948 return true; 948 return true;
949 949
950 return false; 950 return false;
951 } 951 }
952 #endif 952 #endif
953 953
954 } // namespace blink 954 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.cpp ('k') | sky/engine/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698