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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master 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/NamedNodeMap.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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 // This does not 100% guarantee the user can see it, but is pretty close. 477 // This does not 100% guarantee the user can see it, but is pretty close.
478 // Note: This method only works properly after layout has occurred. 478 // Note: This method only works properly after layout has occurred.
479 bool hasNonEmptyBoundingBox() const; 479 bool hasNonEmptyBoundingBox() const;
480 480
481 unsigned nodeIndex() const; 481 unsigned nodeIndex() const;
482 482
483 // Returns the DOM ownerDocument attribute. This method never returns NULL, except in the case 483 // Returns the DOM ownerDocument attribute. This method never returns NULL, except in the case
484 // of a Document node. 484 // of a Document node.
485 Document* ownerDocument() const; 485 Document* ownerDocument() const;
486 486
487 // FIXME: This should return a reference. 487 // Returns the document associated with this node. A Document node returns i tself.
488 // Returns the document associated with this node. This method never returns 0. 488 Document& document() const
489 // A Document node returns itself.
490 Document* document() const
491 { 489 {
492 ASSERT(this); 490 ASSERT(this);
493 ASSERT(documentInternal()); 491 ASSERT(documentInternal());
494 return documentInternal(); 492 return *documentInternal();
495 } 493 }
496 494
497 TreeScope* treeScope() const { return m_treeScope; } 495 TreeScope* treeScope() const { return m_treeScope; }
498 496
499 // Returns true if this node is associated with a document and is in its ass ociated document's 497 // Returns true if this node is associated with a document and is in its ass ociated document's
500 // node tree, false otherwise. 498 // node tree, false otherwise.
501 bool inDocument() const 499 bool inDocument() const
502 { 500 {
503 ASSERT(documentInternal() || !getFlag(InDocumentFlag)); 501 ASSERT(documentInternal() || !getFlag(InDocumentFlag));
504 return getFlag(InDocumentFlag); 502 return getFlag(InDocumentFlag);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 941
944 } //namespace 942 } //namespace
945 943
946 #ifndef NDEBUG 944 #ifndef NDEBUG
947 // Outside the WebCore namespace for ease of invocation from gdb. 945 // Outside the WebCore namespace for ease of invocation from gdb.
948 void showTree(const WebCore::Node*); 946 void showTree(const WebCore::Node*);
949 void showNodePath(const WebCore::Node*); 947 void showNodePath(const WebCore::Node*);
950 #endif 948 #endif
951 949
952 #endif 950 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/NamedNodeMap.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698