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

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

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/FullscreenElementStack.cpp ('k') | Source/core/dom/Node.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, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 bool hasClass() const; 358 bool hasClass() const;
359 359
360 bool isUserActionElement() const { return getFlag(IsUserActionElement); } 360 bool isUserActionElement() const { return getFlag(IsUserActionElement); }
361 void setUserActionElement(bool flag) { setFlag(flag, IsUserActionElement); } 361 void setUserActionElement(bool flag) { setFlag(flag, IsUserActionElement); }
362 362
363 bool active() const { return isUserActionElement() && isUserActionElementAct ive(); } 363 bool active() const { return isUserActionElement() && isUserActionElementAct ive(); }
364 bool inActiveChain() const { return isUserActionElement() && isUserActionEle mentInActiveChain(); } 364 bool inActiveChain() const { return isUserActionElement() && isUserActionEle mentInActiveChain(); }
365 bool hovered() const { return isUserActionElement() && isUserActionElementHo vered(); } 365 bool hovered() const { return isUserActionElement() && isUserActionElementHo vered(); }
366 bool focused() const { return isUserActionElement() && isUserActionElementFo cused(); } 366 bool focused() const { return isUserActionElement() && isUserActionElementFo cused(); }
367 367
368 bool attached() const { return getFlag(IsAttachedFlag); } 368 bool confusingAndOftenMisusedAttached() const { return getFlag(IsAttachedFla g); }
369 void setAttached() { setFlag(IsAttachedFlag); } 369 void setAttached() { setFlag(IsAttachedFlag); }
370 bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; } 370 bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; }
371 StyleChangeType styleChangeType() const { return static_cast<StyleChangeType >(m_nodeFlags & StyleChangeMask); } 371 StyleChangeType styleChangeType() const { return static_cast<StyleChangeType >(m_nodeFlags & StyleChangeMask); }
372 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla g); } 372 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla g); }
373 bool isLink() const { return getFlag(IsLinkFlag); } 373 bool isLink() const { return getFlag(IsLinkFlag); }
374 bool isEditingText() const { return isTextNode() && getFlag(HasNameOrIsEditi ngTextFlag); } 374 bool isEditingText() const { return isTextNode() && getFlag(HasNameOrIsEditi ngTextFlag); }
375 375
376 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); } 376 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); }
377 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } 377 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
378 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } 378 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 } 898 }
899 899
900 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const 900 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const
901 { 901 {
902 ASSERT(!isShadowRoot()); 902 ASSERT(!isShadowRoot());
903 return parentOrShadowHostNode(); 903 return parentOrShadowHostNode();
904 } 904 }
905 905
906 inline void Node::lazyReattachIfAttached() 906 inline void Node::lazyReattachIfAttached()
907 { 907 {
908 if (attached()) 908 if (confusingAndOftenMisusedAttached())
909 lazyReattach(); 909 lazyReattach();
910 } 910 }
911 911
912 inline void Node::lazyReattach() 912 inline void Node::lazyReattach()
913 { 913 {
914 if (styleChangeType() == LazyAttachStyleChange) 914 if (styleChangeType() == LazyAttachStyleChange)
915 return; 915 return;
916 916
917 AttachContext context; 917 AttachContext context;
918 context.performingReattach = true; 918 context.performingReattach = true;
919 919
920 if (attached()) 920 if (confusingAndOftenMisusedAttached())
921 detach(context); 921 detach(context);
922 lazyAttach(); 922 lazyAttach();
923 } 923 }
924 924
925 inline bool shouldRecalcStyle(StyleRecalcChange change, const Node* node) 925 inline bool shouldRecalcStyle(StyleRecalcChange change, const Node* node)
926 { 926 {
927 return change >= Inherit || node->childNeedsStyleRecalc() || node->needsStyl eRecalc(); 927 return change >= Inherit || node->childNeedsStyleRecalc() || node->needsStyl eRecalc();
928 } 928 }
929 929
930 } //namespace 930 } //namespace
931 931
932 #ifndef NDEBUG 932 #ifndef NDEBUG
933 // Outside the WebCore namespace for ease of invocation from gdb. 933 // Outside the WebCore namespace for ease of invocation from gdb.
934 void showTree(const WebCore::Node*); 934 void showTree(const WebCore::Node*);
935 void showNodePath(const WebCore::Node*); 935 void showNodePath(const WebCore::Node*);
936 #endif 936 #endif
937 937
938 #endif 938 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/FullscreenElementStack.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698