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

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

Issue 327633004: Apply DEFINE/DECLARE_NODE_FACTORY(T) macro to element factories with single Document& argument. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « no previous file | Source/core/html/HTMLAreaElement.h » ('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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 891
892 #define DEFINE_NODE_TYPE_CASTS(thisType, predicate) \ 892 #define DEFINE_NODE_TYPE_CASTS(thisType, predicate) \
893 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) { return to##thisType(node.get()); } \ 893 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) { return to##thisType(node.get()); } \
894 DEFINE_TYPE_CASTS(thisType, Node, node, node->predicate, node.predicate) 894 DEFINE_TYPE_CASTS(thisType, Node, node, node->predicate, node.predicate)
895 895
896 // This requires isClassName(const Node&). 896 // This requires isClassName(const Node&).
897 #define DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) \ 897 #define DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) \
898 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) { return to##thisType(node.get()); } \ 898 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) { return to##thisType(node.get()); } \
899 DEFINE_TYPE_CASTS(thisType, Node, node, is##thisType(*node), is##thisType(no de)) 899 DEFINE_TYPE_CASTS(thisType, Node, node, is##thisType(*node), is##thisType(no de))
900 900
901 #define DECLARE_NODE_FACTORY(T) \
902 static PassRefPtrWillBeRawPtr<T> create(Document&)
901 #define DEFINE_NODE_FACTORY(T) \ 903 #define DEFINE_NODE_FACTORY(T) \
902 inline static PassRefPtrWillBeRawPtr<T> create(Document& document) \ 904 PassRefPtrWillBeRawPtr<T> T::create(Document& document) \
903 { \ 905 { \
904 return adoptRefWillBeRefCountedGarbageCollected(new T(document)); \ 906 return adoptRefWillBeRefCountedGarbageCollected(new T(document)); \
905 } 907 }
906 908
907 } // namespace WebCore 909 } // namespace WebCore
908 910
909 #ifndef NDEBUG 911 #ifndef NDEBUG
910 // Outside the WebCore namespace for ease of invocation from gdb. 912 // Outside the WebCore namespace for ease of invocation from gdb.
911 void showNode(const WebCore::Node*); 913 void showNode(const WebCore::Node*);
912 void showTree(const WebCore::Node*); 914 void showTree(const WebCore::Node*);
913 void showNodePath(const WebCore::Node*); 915 void showNodePath(const WebCore::Node*);
914 #endif 916 #endif
915 917
916 #endif 918 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLAreaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698