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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 1533683002: Persist invalidation sets on detach root (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid detaching when in inactive state Created 4 years, 12 months 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
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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 dispatchSubtreeModifiedEvent(); 597 dispatchSubtreeModifiedEvent();
598 return child; 598 return child;
599 } 599 }
600 600
601 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node& ol dChild) 601 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node& ol dChild)
602 { 602 {
603 EventDispatchForbiddenScope assertNoEventDispatch; 603 EventDispatchForbiddenScope assertNoEventDispatch;
604 604
605 ASSERT(oldChild.parentNode() == this); 605 ASSERT(oldChild.parentNode() == this);
606 606
607 if (!oldChild.needsAttach()) 607 AttachContext context;
608 oldChild.detach(); 608 context.clearInvalidation = true;
609 if (!needsAttach() || !oldChild.needsAttach())
610 oldChild.detach(context);
609 611
610 if (nextChild) 612 if (nextChild)
611 nextChild->setPreviousSibling(previousChild); 613 nextChild->setPreviousSibling(previousChild);
612 if (previousChild) 614 if (previousChild)
613 previousChild->setNextSibling(nextChild); 615 previousChild->setNextSibling(nextChild);
614 if (m_firstChild == &oldChild) 616 if (m_firstChild == &oldChild)
615 m_firstChild = nextChild; 617 m_firstChild = nextChild;
616 if (m_lastChild == &oldChild) 618 if (m_lastChild == &oldChild)
617 m_lastChild = previousChild; 619 m_lastChild = previousChild;
618 620
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 } 878 }
877 879
878 clearChildNeedsStyleRecalc(); 880 clearChildNeedsStyleRecalc();
879 Node::attach(context); 881 Node::attach(context);
880 } 882 }
881 883
882 void ContainerNode::detach(const AttachContext& context) 884 void ContainerNode::detach(const AttachContext& context)
883 { 885 {
884 AttachContext childrenContext(context); 886 AttachContext childrenContext(context);
885 childrenContext.resolvedStyle = nullptr; 887 childrenContext.resolvedStyle = nullptr;
888 childrenContext.clearInvalidation = true;
886 889
887 for (Node* child = firstChild(); child; child = child->nextSibling()) 890 for (Node* child = firstChild(); child; child = child->nextSibling())
888 child->detach(childrenContext); 891 child->detach(childrenContext);
889 892
890 setChildNeedsStyleRecalc(); 893 setChildNeedsStyleRecalc();
891 Node::detach(context); 894 Node::detach(context);
892 } 895 }
893 896
894 void ContainerNode::childrenChanged(const ChildrenChange& change) 897 void ContainerNode::childrenChanged(const ChildrenChange& change)
895 { 898 {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 return true; 1538 return true;
1536 1539
1537 if (node->isElementNode() && toElement(node)->shadow()) 1540 if (node->isElementNode() && toElement(node)->shadow())
1538 return true; 1541 return true;
1539 1542
1540 return false; 1543 return false;
1541 } 1544 }
1542 #endif 1545 #endif
1543 1546
1544 } // namespace blink 1547 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698