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

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: Missing commit 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
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); } 387 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); }
388 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); } 388 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); }
389 389
390 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } 390 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); }
391 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); } 391 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); }
392 392
393 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); } 393 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); }
394 void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableD uringMinorGCFlag); } 394 void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableD uringMinorGCFlag); }
395 395
396 enum ShouldSetAttached { 396 void lazyAttach();
397 SetAttached, 397 void lazyReattach();
398 DoNotSetAttached
399 };
400 void lazyAttach(ShouldSetAttached = SetAttached);
401 void lazyReattach(ShouldSetAttached = SetAttached);
402 398
403 virtual void setFocus(bool flag); 399 virtual void setFocus(bool flag);
404 virtual void setActive(bool flag = true, bool pause = false); 400 virtual void setActive(bool flag = true, bool pause = false);
405 virtual void setHovered(bool flag = true); 401 virtual void setHovered(bool flag = true);
406 402
407 virtual short tabIndex() const; 403 virtual short tabIndex() const;
408 404
409 // Whether this kind of node can receive focus by default. Most nodes are 405 // Whether this kind of node can receive focus by default. Most nodes are
410 // not focusable but some elements, such as form controls and links, are. 406 // not focusable but some elements, such as form controls and links, are.
411 virtual bool supportsFocus() const; 407 virtual bool supportsFocus() const;
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 detach(); 872 detach();
877 attach(); 873 attach();
878 } 874 }
879 875
880 inline void Node::reattachIfAttached() 876 inline void Node::reattachIfAttached()
881 { 877 {
882 if (attached()) 878 if (attached())
883 reattach(); 879 reattach();
884 } 880 }
885 881
886 inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached) 882 inline void Node::lazyReattach()
887 { 883 {
888 if (attached()) 884 if (attached())
889 detach(); 885 detach();
890 lazyAttach(shouldSetAttached); 886 lazyAttach();
891 } 887 }
892 888
893 // Need a template since ElementShadow is not a Node, but has the style recalc m ethods. 889 // Need a template since ElementShadow is not a Node, but has the style recalc m ethods.
894 template<class T> 890 template<class T>
895 inline bool shouldRecalcStyle(Node::StyleChange change, const T* node) 891 inline bool shouldRecalcStyle(Node::StyleChange change, const T* node)
896 { 892 {
897 return change >= Node::Inherit || node->childNeedsStyleRecalc() || node->nee dsStyleRecalc(); 893 return change >= Node::Inherit || node->childNeedsStyleRecalc() || node->nee dsStyleRecalc();
898 } 894 }
899 895
900 } //namespace 896 } //namespace
901 897
902 #ifndef NDEBUG 898 #ifndef NDEBUG
903 // Outside the WebCore namespace for ease of invocation from gdb. 899 // Outside the WebCore namespace for ease of invocation from gdb.
904 void showTree(const WebCore::Node*); 900 void showTree(const WebCore::Node*);
905 void showNodePath(const WebCore::Node*); 901 void showNodePath(const WebCore::Node*);
906 #endif 902 #endif
907 903
908 #endif 904 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698