| 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, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl
e Inc. All rights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl
e 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 bool isJavaScriptURLAttribute(const Attribute&) const; | 666 bool isJavaScriptURLAttribute(const Attribute&) const; |
| 667 | 667 |
| 668 RefPtr<ElementData> m_elementData; | 668 RefPtr<ElementData> m_elementData; |
| 669 }; | 669 }; |
| 670 | 670 |
| 671 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); | 671 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); |
| 672 template <typename T> bool isElementOfType(const Element&); | 672 template <typename T> bool isElementOfType(const Element&); |
| 673 template <typename T> inline bool isElementOfType(const Node& node) { return nod
e.isElementNode() && isElementOfType<const T>(toElement(node)); } | 673 template <typename T> inline bool isElementOfType(const Node& node) { return nod
e.isElementNode() && isElementOfType<const T>(toElement(node)); } |
| 674 template <> inline bool isElementOfType<const Element>(const Element&) { return
true; } | 674 template <> inline bool isElementOfType<const Element>(const Element&) { return
true; } |
| 675 | 675 |
| 676 // Type casting. | |
| 677 template<typename T> inline T& toElement(Node& node) | |
| 678 { | |
| 679 ASSERT_WITH_SECURITY_IMPLICATION(isElementOfType<const T>(node)); | |
| 680 return static_cast<T&>(node); | |
| 681 } | |
| 682 template<typename T> inline T* toElement(Node* node) | |
| 683 { | |
| 684 ASSERT_WITH_SECURITY_IMPLICATION(!node || isElementOfType<const T>(*node)); | |
| 685 return static_cast<T*>(node); | |
| 686 } | |
| 687 template<typename T> inline const T& toElement(const Node& node) | |
| 688 { | |
| 689 ASSERT_WITH_SECURITY_IMPLICATION(isElementOfType<const T>(node)); | |
| 690 return static_cast<const T&>(node); | |
| 691 } | |
| 692 template<typename T> inline const T* toElement(const Node* node) | |
| 693 { | |
| 694 ASSERT_WITH_SECURITY_IMPLICATION(!node || isElementOfType<const T>(*node)); | |
| 695 return static_cast<const T*>(node); | |
| 696 } | |
| 697 template<typename T, typename U> inline T* toElement(const RefPtr<U>& node) { re
turn toElement<T>(node.get()); } | |
| 698 | |
| 699 inline bool isDisabledFormControl(const Node* node) | 676 inline bool isDisabledFormControl(const Node* node) |
| 700 { | 677 { |
| 701 return node->isElementNode() && toElement(node)->isDisabledFormControl(); | 678 return node->isElementNode() && toElement(node)->isDisabledFormControl(); |
| 702 } | 679 } |
| 703 | 680 |
| 704 inline bool Node::hasTagName(const QualifiedName& name) const | 681 inline bool Node::hasTagName(const QualifiedName& name) const |
| 705 { | 682 { |
| 706 return isElementNode() && toElement(this)->hasTagName(name); | 683 return isElementNode() && toElement(this)->hasTagName(name); |
| 707 } | 684 } |
| 708 | 685 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 } | 859 } |
| 883 | 860 |
| 884 inline bool isShadowHost(const Element* element) | 861 inline bool isShadowHost(const Element* element) |
| 885 { | 862 { |
| 886 return element && element->shadow(); | 863 return element && element->shadow(); |
| 887 } | 864 } |
| 888 | 865 |
| 889 } // namespace | 866 } // namespace |
| 890 | 867 |
| 891 #endif | 868 #endif |
| OLD | NEW |