Commit 483db096 authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

Use Element& instead of Element* as a parameter of HasEquivalentAttributes

When HasEquivalentAttributes is called, Element object was passed as
a parameter.
and it is never nullptr. so it can be changed to reference instead of pointer.

Bug: 874385
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I237a11e88236ef195ade12ee26b0722786f17e29
Reviewed-on: https://chromium-review.googlesource.com/1232810Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Cr-Commit-Position: refs/heads/master@{#592681}
parent 80e4b8d8
......@@ -1981,15 +1981,15 @@ void Element::ParserSetAttributes(const Vector<Attribute>& attribute_vector) {
}
}
bool Element::HasEquivalentAttributes(const Element* other) const {
bool Element::HasEquivalentAttributes(const Element& other) const {
SynchronizeAllAttributes();
other->SynchronizeAllAttributes();
if (GetElementData() == other->GetElementData())
other.SynchronizeAllAttributes();
if (GetElementData() == other.GetElementData())
return true;
if (GetElementData())
return GetElementData()->IsEquivalent(other->GetElementData());
if (other->GetElementData())
return other->GetElementData()->IsEquivalent(GetElementData());
return GetElementData()->IsEquivalent(other.GetElementData());
if (other.GetElementData())
return other.GetElementData()->IsEquivalent(GetElementData());
return true;
}
......
......@@ -502,7 +502,7 @@ class CORE_EXPORT Element : public ContainerNode {
// Clones attributes only.
void CloneAttributesFrom(const Element&);
bool HasEquivalentAttributes(const Element* other) const;
bool HasEquivalentAttributes(const Element& other) const;
// Step 5 of https://dom.spec.whatwg.org/#concept-node-clone
virtual void CloneNonAttributePropertiesFrom(const Element&,
......
......@@ -1343,7 +1343,7 @@ bool Node::isEqualNode(Node* other) const {
if (ToElement(this)->TagQName() != ToElement(other)->TagQName())
return false;
if (!ToElement(this)->HasEquivalentAttributes(ToElement(other)))
if (!ToElement(this)->HasEquivalentAttributes(ToElement(*other)))
return false;
} else if (nodeName() != other->nodeName()) {
return false;
......
......@@ -138,7 +138,7 @@ bool AreIdenticalElements(const Node& first, const Node& second) {
if (!first_element.HasTagName(second_element.TagQName()))
return false;
if (!first_element.HasEquivalentAttributes(&second_element))
if (!first_element.HasEquivalentAttributes(second_element))
return false;
return HasEditableStyle(first_element) && HasEditableStyle(second_element);
......
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