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

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

Issue 23890025: WIP (Introduce WTF::NonNullPtr<T>.) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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/LiveNodeList.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 21 matching lines...) Expand all
32 #include "core/dom/SimulatedClickOptions.h" 32 #include "core/dom/SimulatedClickOptions.h"
33 #include "core/dom/TreeScope.h" 33 #include "core/dom/TreeScope.h"
34 #include "core/editing/EditingBoundary.h" 34 #include "core/editing/EditingBoundary.h"
35 #include "core/inspector/InspectorCounters.h" 35 #include "core/inspector/InspectorCounters.h"
36 #include "core/platform/TreeShared.h" 36 #include "core/platform/TreeShared.h"
37 #include "core/platform/graphics/LayoutRect.h" 37 #include "core/platform/graphics/LayoutRect.h"
38 #include "core/rendering/style/RenderStyleConstants.h" 38 #include "core/rendering/style/RenderStyleConstants.h"
39 #include "weborigin/KURLHash.h" 39 #include "weborigin/KURLHash.h"
40 #include "wtf/Forward.h" 40 #include "wtf/Forward.h"
41 #include "wtf/ListHashSet.h" 41 #include "wtf/ListHashSet.h"
42 #include "wtf/NonNullPtr.h"
42 #include "wtf/text/AtomicString.h" 43 #include "wtf/text/AtomicString.h"
43 44
44 // This needs to be here because Document.h also depends on it. 45 // This needs to be here because Document.h also depends on it.
45 #define DUMP_NODE_STATISTICS 0 46 #define DUMP_NODE_STATISTICS 0
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
49 class Attribute; 50 class Attribute;
50 class ClassNodeList; 51 class ClassNodeList;
51 class ContainerNode; 52 class ContainerNode;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // class names (ex. class="foo bar") and other non-basic styling features. T hey and also control 259 // class names (ex. class="foo bar") and other non-basic styling features. T hey and also control
259 // if this element can participate in style sharing. 260 // if this element can participate in style sharing.
260 // 261 //
261 // FIXME: The only things that ever go through StyleResolver that aren't Sty ledElements are 262 // FIXME: The only things that ever go through StyleResolver that aren't Sty ledElements are
262 // PseudoElements and WebVTTElements. It's possible we can just eliminate al l the checks 263 // PseudoElements and WebVTTElements. It's possible we can just eliminate al l the checks
263 // since those elements will never have class names, inline style, or other things that 264 // since those elements will never have class names, inline style, or other things that
264 // this apparently guards against. 265 // this apparently guards against.
265 bool isStyledElement() const { return isHTMLElement() || isSVGElement(); } 266 bool isStyledElement() const { return isHTMLElement() || isSVGElement(); }
266 267
267 bool isDocumentNode() const; 268 bool isDocumentNode() const;
268 bool isTreeScope() const { return treeScope().rootNode() == this; } 269 bool isTreeScope() const { return treeScope()->rootNode() == this; }
269 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } 270 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
270 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } 271 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); }
271 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } 272 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); }
272 273
273 bool inNamedFlow() const { return getFlag(InNamedFlowFlag); } 274 bool inNamedFlow() const { return getFlag(InNamedFlowFlag); }
274 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback sFlag); } 275 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback sFlag); }
275 276
276 bool isRegisteredWithNamedFlow() const; 277 bool isRegisteredWithNamedFlow() const;
277 278
278 bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChi ldNodesFlag); } 279 bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChi ldNodesFlag); }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 Document* ownerDocument() const; 474 Document* ownerDocument() const;
474 475
475 // Returns the document associated with this node. A Document node returns i tself. 476 // Returns the document associated with this node. A Document node returns i tself.
476 Document& document() const 477 Document& document() const
477 { 478 {
478 ASSERT(this); 479 ASSERT(this);
479 ASSERT(documentInternal()); 480 ASSERT(documentInternal());
480 return *documentInternal(); 481 return *documentInternal();
481 } 482 }
482 483
483 TreeScope& treeScope() const { return *m_treeScope; } 484 NonNullPtr<TreeScope> treeScope() const { return m_treeScope; }
484 485
485 // Returns true if this node is associated with a document and is in its ass ociated document's 486 // Returns true if this node is associated with a document and is in its ass ociated document's
486 // node tree, false otherwise. 487 // node tree, false otherwise.
487 bool inDocument() const 488 bool inDocument() const
488 { 489 {
489 ASSERT(documentInternal() || !getFlag(InDocumentFlag)); 490 ASSERT(documentInternal() || !getFlag(InDocumentFlag));
490 return getFlag(InDocumentFlag); 491 return getFlag(InDocumentFlag);
491 } 492 }
492 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } 493 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); }
493 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); } 494 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 bool hasRareData() const { return getFlag(HasRareDataFlag); } 799 bool hasRareData() const { return getFlag(HasRareDataFlag); }
799 800
800 NodeRareData* rareData() const; 801 NodeRareData* rareData() const;
801 NodeRareData* ensureRareData(); 802 NodeRareData* ensureRareData();
802 void clearRareData(); 803 void clearRareData();
803 804
804 void clearEventTargetData(); 805 void clearEventTargetData();
805 806
806 void setHasCustomStyleCallbacks() { setFlag(true, HasCustomStyleCallbacksFla g); } 807 void setHasCustomStyleCallbacks() { setFlag(true, HasCustomStyleCallbacksFla g); }
807 808
808 Document* documentInternal() const { return treeScope().documentScope(); } 809 Document* documentInternal() const { return treeScope()->documentScope(); }
809 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } 810 void setTreeScope(TreeScope* scope) { m_treeScope = scope; }
810 811
811 private: 812 private:
812 friend class TreeShared<Node>; 813 friend class TreeShared<Node>;
813 814
814 virtual PseudoId customPseudoId() const 815 virtual PseudoId customPseudoId() const
815 { 816 {
816 ASSERT(hasCustomStyleCallbacks()); 817 ASSERT(hasCustomStyleCallbacks());
817 return NOPSEUDO; 818 return NOPSEUDO;
818 } 819 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 930
930 } //namespace 931 } //namespace
931 932
932 #ifndef NDEBUG 933 #ifndef NDEBUG
933 // Outside the WebCore namespace for ease of invocation from gdb. 934 // Outside the WebCore namespace for ease of invocation from gdb.
934 void showTree(const WebCore::Node*); 935 void showTree(const WebCore::Node*);
935 void showNodePath(const WebCore::Node*); 936 void showNodePath(const WebCore::Node*);
936 #endif 937 #endif
937 938
938 #endif 939 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/LiveNodeList.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698