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

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

Issue 23717008: Remove useless null checks from Node::document() call sites (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/EventPathWalker.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 IntRect pixelSnappedRenderRect(bool* isReplaced) { return pixelSnappedIntRec t(renderRect(isReplaced)); } 474 IntRect pixelSnappedRenderRect(bool* isReplaced) { return pixelSnappedIntRec t(renderRect(isReplaced)); }
475 475
476 // Returns true if the node has a non-empty bounding box in layout. 476 // Returns true if the node has a non-empty bounding box in layout.
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 (1) a Document node or (2) a DocumentType node that is not used with a ny Document yet. 484 // of a Document node.
485 Document* ownerDocument() const; 485 Document* ownerDocument() const;
486 486
487 // Returns the document associated with this node. This method never returns NULL, except in the case 487 // FIXME: This should return a reference.
488 // of a DocumentType node that is not used with any Document yet. A Document node returns itself. 488 // Returns the document associated with this node. This method never returns 0.
489 // A Document node returns itself.
489 Document* document() const 490 Document* document() const
490 { 491 {
491 ASSERT(this); 492 ASSERT(this);
492 // FIXME: below ASSERT is useful, but prevents the use of document() in the constructor or destructor 493 ASSERT(documentInternal());
493 // due to the virtual function call to nodeType().
494 ASSERT(documentInternal() || (nodeType() == DOCUMENT_TYPE_NODE && !inDoc ument()));
495 return documentInternal(); 494 return documentInternal();
496 } 495 }
497 496
498 TreeScope* treeScope() const { return m_treeScope; } 497 TreeScope* treeScope() const { return m_treeScope; }
499 498
500 // Returns true if this node is associated with a document and is in its ass ociated document's 499 // Returns true if this node is associated with a document and is in its ass ociated document's
501 // node tree, false otherwise. 500 // node tree, false otherwise.
502 bool inDocument() const 501 bool inDocument() const
503 { 502 {
504 ASSERT(documentInternal() || !getFlag(InDocumentFlag)); 503 ASSERT(documentInternal() || !getFlag(InDocumentFlag));
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 943
945 } //namespace 944 } //namespace
946 945
947 #ifndef NDEBUG 946 #ifndef NDEBUG
948 // Outside the WebCore namespace for ease of invocation from gdb. 947 // Outside the WebCore namespace for ease of invocation from gdb.
949 void showTree(const WebCore::Node*); 948 void showTree(const WebCore::Node*);
950 void showNodePath(const WebCore::Node*); 949 void showNodePath(const WebCore::Node*);
951 #endif 950 #endif
952 951
953 #endif 952 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/EventPathWalker.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698