summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLSelectElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-11 13:45:28 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-11 13:45:28 +0200
commitd6a599dbc9d824a462b2b206316e102bf8136446 (patch)
treeecb257a5e55b2239d74b90fdad62fccd661cf286 /Source/WebCore/html/HTMLSelectElement.cpp
parent3ccc3a85f09a83557b391aae380d3bf5f81a2911 (diff)
downloadqtwebkit-d6a599dbc9d824a462b2b206316e102bf8136446.tar.gz
Imported WebKit commit 8ff1f22783a32de82fee915abd55bd1b298f2644 (http://svn.webkit.org/repository/webkit/trunk@122325)
New snapshot that should work with the latest Qt build system changes
Diffstat (limited to 'Source/WebCore/html/HTMLSelectElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLSelectElement.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp
index 04227aec6..83ccec5c3 100644
--- a/Source/WebCore/html/HTMLSelectElement.cpp
+++ b/Source/WebCore/html/HTMLSelectElement.cpp
@@ -347,14 +347,21 @@ RenderObject* HTMLSelectElement::createRenderer(RenderArena* arena, RenderStyle*
bool HTMLSelectElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- return childContext.isOnUpperEncapsulationBoundary() && HTMLFormControlElementWithState::childShouldCreateRenderer(childContext);
+ if (!HTMLFormControlElementWithState::childShouldCreateRenderer(childContext))
+ return false;
+ if (!usesMenuList())
+ return true;
+ return validationMessageShadowTreeContains(childContext.node());
+}
+
+PassRefPtr<HTMLCollection> HTMLSelectElement::selectedOptions()
+{
+ return ensureCachedHTMLCollection(SelectedOptions);
}
-HTMLOptionsCollection* HTMLSelectElement::options()
+PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options()
{
- if (!m_optionsCollection)
- m_optionsCollection = HTMLOptionsCollection::create(this);
- return m_optionsCollection.get();
+ return static_cast<HTMLOptionsCollection*>(ensureCachedHTMLCollection(SelectOptions).get());
}
void HTMLSelectElement::updateListItemSelectedStates()
@@ -700,6 +707,12 @@ const Vector<HTMLElement*>& HTMLSelectElement::listItems() const
return m_listItems;
}
+void HTMLSelectElement::invalidateSelectedItems()
+{
+ if (HTMLCollection* collection = cachedHTMLCollection(SelectedOptions))
+ collection->invalidateCache();
+}
+
void HTMLSelectElement::setRecalcListItems()
{
m_shouldRecalcListItems = true;
@@ -707,8 +720,12 @@ void HTMLSelectElement::setRecalcListItems()
m_activeSelectionAnchorIndex = -1;
setOptionsChangedOnRenderer();
setNeedsStyleRecalc();
- if (!inDocument() && m_optionsCollection)
- m_optionsCollection->invalidateCacheIfNeeded();
+ if (!inDocument()) {
+ if (HTMLCollection* collection = cachedHTMLCollection(SelectOptions))
+ collection->invalidateCache();
+ }
+ if (!inDocument())
+ invalidateSelectedItems();
}
void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const