Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: third_party/WebKit/Source/core/html/HTMLHRElement.cpp

Issue 2109993003: Remove redundant calls to HTMLSelectElement::setRecalcListItems(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLHRElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLHRElement.cpp b/third_party/WebKit/Source/core/html/HTMLHRElement.cpp
index 4292a119ab57c0d896fe22073caf277f21b92073..6a67cc7c0e9ffd73d5d71299d3f51b4a96d9a547 100644
--- a/third_party/WebKit/Source/core/html/HTMLHRElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLHRElement.cpp
@@ -27,6 +27,8 @@
#include "core/HTMLNames.h"
#include "core/css/CSSColorValue.h"
#include "core/css/StylePropertySet.h"
+#include "core/html/HTMLOptGroupElement.h"
+#include "core/html/HTMLSelectElement.h"
namespace blink {
@@ -90,4 +92,39 @@ void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& na
}
}
+HTMLSelectElement* HTMLHRElement::ownerSelectElement() const
+{
+ if (!parentNode())
+ return nullptr;
+ if (isHTMLSelectElement(*parentNode()))
+ return toHTMLSelectElement(parentNode());
+ if (!isHTMLOptGroupElement(*parentNode()))
+ return nullptr;
+ Node* grandParent = parentNode()->parentNode();
+ return isHTMLSelectElement(grandParent) ? toHTMLSelectElement(grandParent) : nullptr;
+}
+
+Node::InsertionNotificationRequest HTMLHRElement::insertedInto(ContainerNode* insertionPoint)
+{
+ HTMLElement::insertedInto(insertionPoint);
+ if (HTMLSelectElement* select = ownerSelectElement()) {
+ if (insertionPoint == select || (isHTMLOptGroupElement(*insertionPoint) && insertionPoint->parentNode() == select))
keishi 2016/06/29 08:46:40 Isn't existence of ownerSelectElement enough? do w
tkent 2016/06/29 08:58:04 Checking only existence of ownerSelectElement isn'
+ select->hrInsertedOrRemoved(*this);
+ }
+ return InsertionDone;
+}
+
+void HTMLHRElement::removedFrom(ContainerNode* insertionPoint)
+{
+ if (isHTMLSelectElement(*insertionPoint)) {
+ if (!parentNode() || isHTMLOptGroupElement(*parentNode()))
+ toHTMLSelectElement(insertionPoint)->hrInsertedOrRemoved(*this);
+ } else if (isHTMLOptGroupElement(*insertionPoint)) {
+ Node* parent = insertionPoint->parentNode();
+ if (isHTMLSelectElement(parent))
+ toHTMLSelectElement(parent)->hrInsertedOrRemoved(*this);
+ }
+ HTMLElement::removedFrom(insertionPoint);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLHRElement.h ('k') | third_party/WebKit/Source/core/html/HTMLOptGroupElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698