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

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

Issue 15159008: Node::lazyAttach shouldn't lie about being attached (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase again Created 7 years, 7 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/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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); } 386 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); }
387 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); } 387 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); }
388 388
389 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } 389 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); }
390 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); } 390 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); }
391 391
392 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); } 392 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); }
393 void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableD uringMinorGCFlag); } 393 void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableD uringMinorGCFlag); }
394 394
395 enum ShouldSetAttached { 395 void lazyAttach();
396 SetAttached, 396 void lazyReattach();
397 DoNotSetAttached
398 };
399 void lazyAttach(ShouldSetAttached = SetAttached);
400 void lazyReattach(ShouldSetAttached = SetAttached);
401 397
402 virtual void setFocus(bool flag); 398 virtual void setFocus(bool flag);
403 virtual void setActive(bool flag = true, bool pause = false); 399 virtual void setActive(bool flag = true, bool pause = false);
404 virtual void setHovered(bool flag = true); 400 virtual void setHovered(bool flag = true);
405 401
406 virtual short tabIndex() const; 402 virtual short tabIndex() const;
407 403
408 // Whether this kind of node can receive focus by default. Most nodes are 404 // Whether this kind of node can receive focus by default. Most nodes are
409 // not focusable but some elements, such as form controls and links, are. 405 // not focusable but some elements, such as form controls and links, are.
410 virtual bool supportsFocus() const; 406 virtual bool supportsFocus() const;
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 detach(); 864 detach();
869 attach(); 865 attach();
870 } 866 }
871 867
872 inline void Node::lazyReattachIfAttached() 868 inline void Node::lazyReattachIfAttached()
873 { 869 {
874 if (attached()) 870 if (attached())
875 lazyReattach(); 871 lazyReattach();
876 } 872 }
877 873
878 inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached) 874 inline void Node::lazyReattach()
879 { 875 {
880 if (attached()) 876 if (attached())
881 detach(); 877 detach();
882 lazyAttach(shouldSetAttached); 878 lazyAttach();
883 } 879 }
884 880
885 // Need a template since ElementShadow is not a Node, but has the style recalc m ethods. 881 // Need a template since ElementShadow is not a Node, but has the style recalc m ethods.
886 template<class T> 882 template<class T>
887 inline bool shouldRecalcStyle(Node::StyleChange change, const T* node) 883 inline bool shouldRecalcStyle(Node::StyleChange change, const T* node)
888 { 884 {
889 return change >= Node::Inherit || node->childNeedsStyleRecalc() || node->nee dsStyleRecalc(); 885 return change >= Node::Inherit || node->childNeedsStyleRecalc() || node->nee dsStyleRecalc();
890 } 886 }
891 887
892 } //namespace 888 } //namespace
893 889
894 #ifndef NDEBUG 890 #ifndef NDEBUG
895 // Outside the WebCore namespace for ease of invocation from gdb. 891 // Outside the WebCore namespace for ease of invocation from gdb.
896 void showTree(const WebCore::Node*); 892 void showTree(const WebCore::Node*);
897 void showNodePath(const WebCore::Node*); 893 void showNodePath(const WebCore::Node*);
898 #endif 894 #endif
899 895
900 #endif 896 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698