Index: Source/core/html/HTMLSelectElement.cpp |
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp |
index ed9942c1b431faf10bf5242adf2dab270549dd4b..ff5f956156332e8ad2f4a45a421fb6adf6839a7e 100644 |
--- a/Source/core/html/HTMLSelectElement.cpp |
+++ b/Source/core/html/HTMLSelectElement.cpp |
@@ -76,6 +76,7 @@ HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form) |
, m_suggestedIndex(-1) |
{ |
ScriptWrappable::init(this); |
+ setHasCustomStyleCallbacks(); |
} |
PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document) |
@@ -508,11 +509,12 @@ int HTMLSelectElement::nextValidIndex(int listIndex, SkipDirection direction, in |
int size = listItems.size(); |
for (listIndex += direction; listIndex >= 0 && listIndex < size; listIndex += direction) { |
--skip; |
- if (!listItems[listIndex]->isDisabledFormControl() && isHTMLOptionElement(*listItems[listIndex])) { |
- lastGoodIndex = listIndex; |
- if (skip <= 0) |
- break; |
- } |
+ HTMLElement* element = listItems[listIndex]; |
+ if (!isHTMLOptionElement(*element) || toHTMLOptionElement(element)->isDisabledFormControl() || toHTMLOptionElement(element)->isDisplayNone()) |
+ continue; |
+ lastGoodIndex = listIndex; |
+ if (skip <= 0) |
+ break; |
} |
return lastGoodIndex; |
} |
@@ -625,7 +627,7 @@ void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions) |
const Vector<HTMLElement*>& items = listItems(); |
for (unsigned i = 0; i < items.size(); ++i) { |
HTMLElement* element = items[i]; |
- if (!isHTMLOptionElement(*element) || toHTMLOptionElement(element)->isDisabledFormControl()) |
+ if (!isHTMLOptionElement(*element) || toHTMLOptionElement(element)->isDisabledFormControl() || toHTMLOptionElement(element)->isDisplayNone()) |
continue; |
if (i >= start && i <= end) |
@@ -843,8 +845,10 @@ void HTMLSelectElement::setSuggestedIndex(int suggestedIndex) |
if (RenderObject* renderer = this->renderer()) { |
renderer->updateFromElement(); |
- if (renderer->isListBox()) |
- toRenderListBox(renderer)->scrollToRevealElementAtListIndex(suggestedIndex); |
+ if (renderer->isListBox()) { |
+ RenderListBox* listBox = toRenderListBox(renderer); |
+ listBox->scrollToRevealElementAtListIndex(listBox->toRenderListBoxIndex(suggestedIndex)); |
keishi
2014/04/11 06:40:13
I don't like to have yet another index. We have op
spartha
2014/04/11 11:19:45
Done.
|
+ } |
} |
} |
@@ -1450,8 +1454,8 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) |
deselectItemsWithoutValidation(); |
setActiveSelectionAnchorIndex(m_activeSelectionEndIndex); |
} |
- |
- toRenderListBox(renderer())->scrollToRevealElementAtListIndex(endIndex); |
+ RenderListBox* listBox = toRenderListBox(renderer()); |
+ toRenderListBox(renderer())->scrollToRevealElementAtListIndex(listBox->toRenderListBoxIndex(endIndex)); |
keishi
2014/04/11 06:40:13
Ditto.
spartha
2014/04/11 11:19:45
Done.
|
if (selectNewItem) { |
updateListBoxSelection(deselectOthers); |
listBoxOnChange(); |
@@ -1624,4 +1628,15 @@ bool HTMLSelectElement::supportsAutofocus() const |
return true; |
} |
+void HTMLSelectElement::updateListOnRenderer() |
+{ |
+ setOptionsChangedOnRenderer(); |
+} |
+ |
+void HTMLSelectElement::didRecalcStyle(StyleRecalcChange) |
+{ |
+ if (RenderObject* renderer = this->renderer()) |
+ renderer->updateFromElement(); |
+} |
+ |
} // namespace |