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