Chromium Code Reviews| 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 |