| 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 ASSERT(tagName.localName() == m_tagName.localName()); | 819 ASSERT(tagName.localName() == m_tagName.localName()); |
| 820 ASSERT(tagName.namespaceURI() == m_tagName.namespaceURI()); | 820 ASSERT(tagName.namespaceURI() == m_tagName.namespaceURI()); |
| 821 m_tagName = tagName; | 821 m_tagName = tagName; |
| 822 } | 822 } |
| 823 | 823 |
| 824 inline bool isShadowHost(const Node* node) | 824 inline bool isShadowHost(const Node* node) |
| 825 { | 825 { |
| 826 return node && node->isElementNode() && toElement(node)->shadow(); | 826 return node && node->isElementNode() && toElement(node)->shadow(); |
| 827 } | 827 } |
| 828 | 828 |
| 829 inline bool isShadowHost(const Node& node) |
| 830 { |
| 831 return node.isElementNode() && toElement(node).shadow(); |
| 832 } |
| 833 |
| 829 inline bool isShadowHost(const Element* element) | 834 inline bool isShadowHost(const Element* element) |
| 830 { | 835 { |
| 831 return element && element->shadow(); | 836 return element && element->shadow(); |
| 832 } | 837 } |
| 833 | 838 |
| 839 inline bool isShadowHost(const Element& element) |
| 840 { |
| 841 return element.shadow(); |
| 842 } |
| 843 |
| 834 inline bool isAtShadowBoundary(const Element* element) | 844 inline bool isAtShadowBoundary(const Element* element) |
| 835 { | 845 { |
| 836 if (!element) | 846 if (!element) |
| 837 return false; | 847 return false; |
| 838 ContainerNode* parentNode = element->parentNode(); | 848 ContainerNode* parentNode = element->parentNode(); |
| 839 return parentNode && parentNode->isShadowRoot(); | 849 return parentNode && parentNode->isShadowRoot(); |
| 840 } | 850 } |
| 841 | 851 |
| 842 // These macros do the same as their NODE equivalents but additionally provide a
template specialization | 852 // These macros do the same as their NODE equivalents but additionally provide a
template specialization |
| 843 // for isElementOfType<>() so that the Traversal<> API works for these Element t
ypes. | 853 // for isElementOfType<>() so that the Traversal<> API works for these Element t
ypes. |
| 844 #define DEFINE_ELEMENT_TYPE_CASTS(thisType, predicate) \ | 854 #define DEFINE_ELEMENT_TYPE_CASTS(thisType, predicate) \ |
| 845 template <> inline bool isElementOfType<const thisType>(const Node& node) {
return node.predicate; } \ | 855 template <> inline bool isElementOfType<const thisType>(const Node& node) {
return node.predicate; } \ |
| 846 DEFINE_NODE_TYPE_CASTS(thisType, predicate) | 856 DEFINE_NODE_TYPE_CASTS(thisType, predicate) |
| 847 | 857 |
| 848 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ | 858 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
| 849 template <> inline bool isElementOfType<const thisType>(const Node& node) {
return is##thisType(node); } \ | 859 template <> inline bool isElementOfType<const thisType>(const Node& node) {
return is##thisType(node); } \ |
| 850 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) | 860 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) |
| 851 | 861 |
| 852 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 862 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
| 853 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) | 863 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) |
| 854 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ | 864 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ |
| 855 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document&
document) \ | 865 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document&
document) \ |
| 856 { \ | 866 { \ |
| 857 return adoptRefWillBeNoop(new T(tagName, document)); \ | 867 return adoptRefWillBeNoop(new T(tagName, document)); \ |
| 858 } | 868 } |
| 859 | 869 |
| 860 } // namespace | 870 } // namespace |
| 861 | 871 |
| 862 #endif // Element_h | 872 #endif // Element_h |
| OLD | NEW |