| 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 inline const T& toElement(const Node& node) { | 954 inline const T& toElement(const Node& node) { |
| 955 SECURITY_DCHECK(isElementOfType<const T>(node)); | 955 SECURITY_DCHECK(isElementOfType<const T>(node)); |
| 956 return static_cast<const T&>(node); | 956 return static_cast<const T&>(node); |
| 957 } | 957 } |
| 958 template <typename T> | 958 template <typename T> |
| 959 inline const T* toElement(const Node* node) { | 959 inline const T* toElement(const Node* node) { |
| 960 SECURITY_DCHECK(!node || isElementOfType<const T>(*node)); | 960 SECURITY_DCHECK(!node || isElementOfType<const T>(*node)); |
| 961 return static_cast<const T*>(node); | 961 return static_cast<const T*>(node); |
| 962 } | 962 } |
| 963 | 963 |
| 964 template <typename T> |
| 965 inline T& toElementOrDie(Node& node) { |
| 966 CHECK(isElementOfType<const T>(node)); |
| 967 return static_cast<T&>(node); |
| 968 } |
| 969 template <typename T> |
| 970 inline T* toElementOrDie(Node* node) { |
| 971 CHECK(!node || isElementOfType<const T>(*node)); |
| 972 return static_cast<T*>(node); |
| 973 } |
| 974 template <typename T> |
| 975 inline const T& toElementOrDie(const Node& node) { |
| 976 CHECK(isElementOfType<const T>(node)); |
| 977 return static_cast<const T&>(node); |
| 978 } |
| 979 template <typename T> |
| 980 inline const T* toElementOrDie(const Node* node) { |
| 981 CHECK(!node || isElementOfType<const T>(*node)); |
| 982 return static_cast<const T*>(node); |
| 983 } |
| 984 |
| 964 inline bool isDisabledFormControl(const Node* node) { | 985 inline bool isDisabledFormControl(const Node* node) { |
| 965 return node->isElementNode() && toElement(node)->isDisabledFormControl(); | 986 return node->isElementNode() && toElement(node)->isDisabledFormControl(); |
| 966 } | 987 } |
| 967 | 988 |
| 968 inline Element* Node::parentElement() const { | 989 inline Element* Node::parentElement() const { |
| 969 ContainerNode* parent = parentNode(); | 990 ContainerNode* parent = parentNode(); |
| 970 return parent && parent->isElementNode() ? toElement(parent) : nullptr; | 991 return parent && parent->isElementNode() ? toElement(parent) : nullptr; |
| 971 } | 992 } |
| 972 | 993 |
| 973 inline bool Element::fastHasAttribute(const QualifiedName& name) const { | 994 inline bool Element::fastHasAttribute(const QualifiedName& name) const { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 1176 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
| 1156 static T* create(const QualifiedName&, Document&) | 1177 static T* create(const QualifiedName&, Document&) |
| 1157 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 1178 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
| 1158 T* T::create(const QualifiedName& tagName, Document& document) { \ | 1179 T* T::create(const QualifiedName& tagName, Document& document) { \ |
| 1159 return new T(tagName, document); \ | 1180 return new T(tagName, document); \ |
| 1160 } | 1181 } |
| 1161 | 1182 |
| 1162 } // namespace blink | 1183 } // namespace blink |
| 1163 | 1184 |
| 1164 #endif // Element_h | 1185 #endif // Element_h |
| OLD | NEW |