OLD | NEW |
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 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. | 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. |
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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 return isElementOfType<T>(static_cast<const Node&>(element)); | 931 return isElementOfType<T>(static_cast<const Node&>(element)); |
932 } | 932 } |
933 template <> | 933 template <> |
934 inline bool isElementOfType<const Element>(const Element&) { | 934 inline bool isElementOfType<const Element>(const Element&) { |
935 return true; | 935 return true; |
936 } | 936 } |
937 | 937 |
938 // Type casting. | 938 // Type casting. |
939 template <typename T> | 939 template <typename T> |
940 inline T& toElement(Node& node) { | 940 inline T& toElement(Node& node) { |
941 ASSERT_WITH_SECURITY_IMPLICATION(isElementOfType<const T>(node)); | 941 SECURITY_DCHECK(isElementOfType<const T>(node)); |
942 return static_cast<T&>(node); | 942 return static_cast<T&>(node); |
943 } | 943 } |
944 template <typename T> | 944 template <typename T> |
945 inline T* toElement(Node* node) { | 945 inline T* toElement(Node* node) { |
946 ASSERT_WITH_SECURITY_IMPLICATION(!node || isElementOfType<const T>(*node)); | 946 SECURITY_DCHECK(!node || isElementOfType<const T>(*node)); |
947 return static_cast<T*>(node); | 947 return static_cast<T*>(node); |
948 } | 948 } |
949 template <typename T> | 949 template <typename T> |
950 inline const T& toElement(const Node& node) { | 950 inline const T& toElement(const Node& node) { |
951 ASSERT_WITH_SECURITY_IMPLICATION(isElementOfType<const T>(node)); | 951 SECURITY_DCHECK(isElementOfType<const T>(node)); |
952 return static_cast<const T&>(node); | 952 return static_cast<const T&>(node); |
953 } | 953 } |
954 template <typename T> | 954 template <typename T> |
955 inline const T* toElement(const Node* node) { | 955 inline const T* toElement(const Node* node) { |
956 ASSERT_WITH_SECURITY_IMPLICATION(!node || isElementOfType<const T>(*node)); | 956 SECURITY_DCHECK(!node || isElementOfType<const T>(*node)); |
957 return static_cast<const T*>(node); | 957 return static_cast<const T*>(node); |
958 } | 958 } |
959 | 959 |
960 inline bool isDisabledFormControl(const Node* node) { | 960 inline bool isDisabledFormControl(const Node* node) { |
961 return node->isElementNode() && toElement(node)->isDisabledFormControl(); | 961 return node->isElementNode() && toElement(node)->isDisabledFormControl(); |
962 } | 962 } |
963 | 963 |
964 inline Element* Node::parentElement() const { | 964 inline Element* Node::parentElement() const { |
965 ContainerNode* parent = parentNode(); | 965 ContainerNode* parent = parentNode(); |
966 return parent && parent->isElementNode() ? toElement(parent) : nullptr; | 966 return parent && parent->isElementNode() ? toElement(parent) : nullptr; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 1151 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
1152 static T* create(const QualifiedName&, Document&) | 1152 static T* create(const QualifiedName&, Document&) |
1153 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 1153 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
1154 T* T::create(const QualifiedName& tagName, Document& document) { \ | 1154 T* T::create(const QualifiedName& tagName, Document& document) { \ |
1155 return new T(tagName, document); \ | 1155 return new T(tagName, document); \ |
1156 } | 1156 } |
1157 | 1157 |
1158 } // namespace blink | 1158 } // namespace blink |
1159 | 1159 |
1160 #endif // Element_h | 1160 #endif // Element_h |
OLD | NEW |