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

Reland "Cleanup unused macro from blink directory"

This is a reland of edb0f744

TBR=jbroman@chromium.org
Original change's description:
> 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/+/1958494
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
> Cr-Commit-Position: refs/heads/master@{#723467}

Bug: 891908
Change-Id: I5e886d630357fea89601ede408f9f5934378da02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1967097Reviewed-by: default avatarAbhijeet Kandalkar <abhijeet@igalia.com>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#724583}
parent 613ecd10
......@@ -1224,7 +1224,6 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
Member<ElementData> element_data_;
};
DEFINE_NODE_TYPE_CASTS(Element, IsElementNode());
template <typename T>
bool IsElementOfType(const Node&);
template <>
......@@ -1389,16 +1388,6 @@ inline bool IsAtShadowBoundary(const Element* element) {
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
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ELEMENT_H_
......@@ -1081,14 +1081,6 @@ inline ContainerNode* Node::ParentOrShadowHostNode() const {
// Allow equality comparisons of Nodes by reference or pointer, interchangeably.
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*);
......
......@@ -57,30 +57,6 @@ inline bool Node::HasTagName(const MathMLQualifiedName& name) const {
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
#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