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

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

Issue 24773003: Rename Node::attached() to confusingAndOftenMisusedAttached() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/Node.h ('k') | Source/core/dom/NodeRenderingContext.cpp » ('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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 723 }
724 724
725 void Node::derefEventTarget() 725 void Node::derefEventTarget()
726 { 726 {
727 deref(); 727 deref();
728 } 728 }
729 729
730 void Node::setNeedsStyleRecalc(StyleChangeType changeType, StyleChangeSource sou rce) 730 void Node::setNeedsStyleRecalc(StyleChangeType changeType, StyleChangeSource sou rce)
731 { 731 {
732 ASSERT(changeType != NoStyleChange); 732 ASSERT(changeType != NoStyleChange);
733 if (!attached()) // changed compared to what? 733 if (!confusingAndOftenMisusedAttached()) // changed compared to what?
734 return; 734 return;
735 735
736 if (source == StyleChangeFromRenderer) 736 if (source == StyleChangeFromRenderer)
737 setFlag(NotifyRendererWithIdenticalStyles); 737 setFlag(NotifyRendererWithIdenticalStyles);
738 738
739 StyleChangeType existingChangeType = styleChangeType(); 739 StyleChangeType existingChangeType = styleChangeType();
740 if (changeType > existingChangeType) 740 if (changeType > existingChangeType)
741 setStyleChange(changeType); 741 setStyleChange(changeType);
742 742
743 if (existingChangeType == NoStyleChange) 743 if (existingChangeType == NoStyleChange)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 node->clearAttached(); 953 node->clearAttached();
954 node->clearChildNeedsStyleRecalc(); 954 node->clearChildNeedsStyleRecalc();
955 955
956 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot ; shadowRoot = shadowRoot->olderShadowRoot()) 956 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot ; shadowRoot = shadowRoot->olderShadowRoot())
957 detachNode(shadowRoot, context); 957 detachNode(shadowRoot, context);
958 958
959 node = NodeTraversal::next(node, root); 959 node = NodeTraversal::next(node, root);
960 continue; 960 continue;
961 } 961 }
962 // Handle normal reattaches from style recalc (ex. display type changes) 962 // Handle normal reattaches from style recalc (ex. display type changes)
963 if (node->attached()) 963 if (node->confusingAndOftenMisusedAttached())
964 node->detach(context); 964 node->detach(context);
965 node = NodeTraversal::nextSkippingChildren(node, root); 965 node = NodeTraversal::nextSkippingChildren(node, root);
966 } 966 }
967 } 967 }
968 968
969 void Node::reattach(const AttachContext& context) 969 void Node::reattach(const AttachContext& context)
970 { 970 {
971 AttachContext reattachContext(context); 971 AttachContext reattachContext(context);
972 reattachContext.performingReattach = true; 972 reattachContext.performingReattach = true;
973 973
974 detachNode(this, reattachContext); 974 detachNode(this, reattachContext);
975 attach(reattachContext); 975 attach(reattachContext);
976 } 976 }
977 977
978 void Node::attach(const AttachContext&) 978 void Node::attach(const AttachContext&)
979 { 979 {
980 ASSERT(document().inStyleRecalc() || isDocumentNode()); 980 ASSERT(document().inStyleRecalc() || isDocumentNode());
981 ASSERT(!attached()); 981 ASSERT(!confusingAndOftenMisusedAttached());
982 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende rer()->isRenderView()))); 982 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende rer()->isRenderView())));
983 983
984 setAttached(); 984 setAttached();
985 clearNeedsStyleRecalc(); 985 clearNeedsStyleRecalc();
986 986
987 if (Document* doc = documentInternal()) { 987 if (Document* doc = documentInternal()) {
988 if (AXObjectCache* cache = doc->axObjectCache()) 988 if (AXObjectCache* cache = doc->axObjectCache())
989 cache->updateCacheAfterNodeIsAttached(this); 989 cache->updateCacheAfterNodeIsAttached(this);
990 } 990 }
991 } 991 }
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 node->showTreeForThis(); 2652 node->showTreeForThis();
2653 } 2653 }
2654 2654
2655 void showNodePath(const WebCore::Node* node) 2655 void showNodePath(const WebCore::Node* node)
2656 { 2656 {
2657 if (node) 2657 if (node)
2658 node->showNodePathForThis(); 2658 node->showNodePathForThis();
2659 } 2659 }
2660 2660
2661 #endif 2661 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/NodeRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698