Commit edb0f744 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Cleanup unused macro from blink directory

As per the current status, all descendant classes of blink::Node and
blink::Element are ported to use new downcast helpers. The old
macro-based downcast helper implementation is not in use anymore. This
CL cleans up element.h, node.h and mathml_element.h files.

This CL removes,
- DEFINE_NODE_TYPE_CASTS,
- DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION,
- DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION,
- DEFINE_MATHMLELEMENT_TYPE_CASTS_WITH_FUNCTION

Bug: 891908
Change-Id: I04a3a639e44ee5b15b249ea97f16916bd6b4ece2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1958494Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#723467}
parent 1c73ddcb
...@@ -1216,7 +1216,6 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable { ...@@ -1216,7 +1216,6 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
Member<ElementData> element_data_; Member<ElementData> element_data_;
}; };
DEFINE_NODE_TYPE_CASTS(Element, IsElementNode());
template <typename T> template <typename T>
bool IsElementOfType(const Node&); bool IsElementOfType(const Node&);
template <> template <>
...@@ -1381,16 +1380,6 @@ inline bool IsAtShadowBoundary(const Element* element) { ...@@ -1381,16 +1380,6 @@ inline bool IsAtShadowBoundary(const Element* element) {
return parent_node && parent_node->IsShadowRoot(); return parent_node && parent_node->IsShadowRoot();
} }
// These macros do the same as their NODE equivalents but additionally provide a
// template specialization for isElementOfType<>() so that the Traversal<> API
// works for these Element types.
#define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \
template <> \
inline bool IsElementOfType<const thisType>(const Node& node) { \
return Is##thisType(node); \
} \
DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType)
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_H_
...@@ -1091,14 +1091,6 @@ inline ContainerNode* Node::ParentOrShadowHostNode() const { ...@@ -1091,14 +1091,6 @@ inline ContainerNode* Node::ParentOrShadowHostNode() const {
// Allow equality comparisons of Nodes by reference or pointer, interchangeably. // Allow equality comparisons of Nodes by reference or pointer, interchangeably.
DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(Node) DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(Node)
#define DEFINE_NODE_TYPE_CASTS(thisType, predicate) \
DEFINE_TYPE_CASTS(thisType, Node, node, node->predicate, node.predicate)
// This requires isClassName(const Node&).
#define DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) \
DEFINE_TYPE_CASTS(thisType, Node, node, Is##thisType(*node), \
Is##thisType(node))
CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node&); CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node&);
CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node*); CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node*);
......
...@@ -57,30 +57,6 @@ inline bool Node::HasTagName(const MathMLQualifiedName& name) const { ...@@ -57,30 +57,6 @@ inline bool Node::HasTagName(const MathMLQualifiedName& name) const {
return mathml_element && mathml_element->HasTagName(name); return mathml_element && mathml_element->HasTagName(name);
} }
// This requires IsMathML*Element(const MathMLElement&).
#define DEFINE_MATHMLELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \
inline bool Is##thisType(const thisType* element); \
inline bool Is##thisType(const thisType& element); \
inline bool Is##thisType(const MathMLElement* element) { \
return element && Is##thisType(*element); \
} \
inline bool Is##thisType(const Node& node) { \
auto* mathml_element = DynamicTo<MathMLElement>(node); \
return mathml_element && Is##thisType(mathml_element); \
} \
inline bool Is##thisType(const Node* node) { \
return node && Is##thisType(*node); \
} \
template <typename T> \
inline bool Is##thisType(const Member<T>& node) { \
return Is##thisType(node.Get()); \
} \
template <> \
inline bool IsElementOfType<const thisType>(const MathMLElement& element) { \
return Is##thisType(element); \
} \
DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType)
} // namespace blink } // namespace blink
#include "third_party/blink/renderer/core/mathml_element_type_helpers.h" #include "third_party/blink/renderer/core/mathml_element_type_helpers.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment