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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 1173283002: Move some Element specific code from Node::detach to Element::detach. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/UserActionElementSet.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, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 clearChildNeedsDistributionRecalc(); 691 clearChildNeedsDistributionRecalc();
692 } 692 }
693 693
694 void Node::setIsLink(bool isLink) 694 void Node::setIsLink(bool isLink)
695 { 695 {
696 setFlag(isLink && !SVGImage::isInSVGImage(toElement(this)), IsLinkFlag); 696 setFlag(isLink && !SVGImage::isInSVGImage(toElement(this)), IsLinkFlag);
697 } 697 }
698 698
699 void Node::setNeedsStyleInvalidation() 699 void Node::setNeedsStyleInvalidation()
700 { 700 {
701 ASSERT(isElementNode());
701 setFlag(NeedsStyleInvalidationFlag); 702 setFlag(NeedsStyleInvalidationFlag);
702 markAncestorsWithChildNeedsStyleInvalidation(); 703 markAncestorsWithChildNeedsStyleInvalidation();
703 } 704 }
704 705
705 void Node::markAncestorsWithChildNeedsStyleInvalidation() 706 void Node::markAncestorsWithChildNeedsStyleInvalidation()
706 { 707 {
707 for (Node* node = parentOrShadowHostNode(); node && !node->childNeedsStyleIn validation(); node = node->parentOrShadowHostNode()) 708 for (Node* node = parentOrShadowHostNode(); node && !node->childNeedsStyleIn validation(); node = node->parentOrShadowHostNode())
708 node->setChildNeedsStyleInvalidation(); 709 node->setChildNeedsStyleInvalidation();
709 document().scheduleLayoutTreeUpdateIfNeeded(); 710 document().scheduleLayoutTreeUpdateIfNeeded();
710 } 711 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 // don't assert for these, but do set detachingNode to the most recent 951 // don't assert for these, but do set detachingNode to the most recent
951 // Node being detached. 952 // Node being detached.
952 ASSERT(!detachingNode || detachingNode->document() != document()); 953 ASSERT(!detachingNode || detachingNode->document() != document());
953 detachingNode = this; 954 detachingNode = this;
954 #endif 955 #endif
955 956
956 if (layoutObject()) 957 if (layoutObject())
957 layoutObject()->destroyAndCleanupAnonymousWrappers(); 958 layoutObject()->destroyAndCleanupAnonymousWrappers();
958 setLayoutObject(nullptr); 959 setLayoutObject(nullptr);
959 960
960 // Do not remove the element's hovered and active status
961 // if performing a reattach.
962 if (!context.performingReattach) {
963 Document& doc = document();
964 if (isUserActionElement()) {
965 if (hovered())
966 doc.hoveredNodeDetached(this);
967 if (inActiveChain())
968 doc.activeChainNodeDetached(this);
969 doc.userActionElements().didDetach(this);
970 }
971 }
972
973 setStyleChange(NeedsReattachStyleChange); 961 setStyleChange(NeedsReattachStyleChange);
974
975 document().styleEngine().styleInvalidator().clearInvalidation(*this);
976 clearChildNeedsStyleInvalidation(); 962 clearChildNeedsStyleInvalidation();
977 clearNeedsStyleInvalidation();
978 963
979 #if ENABLE(ASSERT) 964 #if ENABLE(ASSERT)
980 detachingNode = nullptr; 965 detachingNode = nullptr;
981 #endif 966 #endif
982 } 967 }
983 968
984 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) 969 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start)
985 { 970 {
986 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { 971 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) {
987 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) { 972 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) {
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 2481
2497 void showNodePath(const blink::Node* node) 2482 void showNodePath(const blink::Node* node)
2498 { 2483 {
2499 if (node) 2484 if (node)
2500 node->showNodePathForThis(); 2485 node->showNodePathForThis();
2501 else 2486 else
2502 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2487 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2503 } 2488 }
2504 2489
2505 #endif 2490 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/UserActionElementSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698