diff options
Diffstat (limited to 'Source/WebCore/html/HTMLOptionElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLOptionElement.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index 3691e8241..bb68a9d32 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -30,6 +30,7 @@ #include "Attribute.h" #include "Document.h" #include "ExceptionCode.h" +#include "HTMLDataListElement.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "HTMLSelectElement.h" @@ -187,6 +188,12 @@ int HTMLOptionElement::index() const void HTMLOptionElement::parseAttribute(const Attribute& attribute) { +#if ENABLE(DATALIST_ELEMENT) + if (attribute.name() == valueAttr) { + if (HTMLDataListElement* dataList = ownerDataListElement()) + dataList->optionElementChildrenChanged(); + } else +#endif if (attribute.name() == disabledAttr) { bool oldDisabled = m_disabled; m_disabled = !attribute.isNull(); @@ -252,11 +259,27 @@ void HTMLOptionElement::setSelectedState(bool selected) void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { +#if ENABLE(DATALIST_ELEMENT) + if (HTMLDataListElement* dataList = ownerDataListElement()) + dataList->optionElementChildrenChanged(); + else +#endif if (HTMLSelectElement* select = ownerSelectElement()) select->optionElementChildrenChanged(); HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } +#if ENABLE(DATALIST_ELEMENT) +HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const +{ + for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) { + if (parent->hasTagName(datalistTag)) + return static_cast<HTMLDataListElement*>(parent); + } + return 0; +} +#endif + HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const { ContainerNode* select = parentNode(); |