Index: Source/core/rendering/RenderListBox.cpp |
diff --git a/Source/core/rendering/RenderListBox.cpp b/Source/core/rendering/RenderListBox.cpp |
index 37fade30333d46c3bbc9302f93134d910ae6e569..016cd795dea75f081cfb97d61f8fb2773bdafe15 100644 |
--- a/Source/core/rendering/RenderListBox.cpp |
+++ b/Source/core/rendering/RenderListBox.cpp |
@@ -340,6 +340,12 @@ void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& |
HTMLSelectElement* select = selectElement(); |
+ // Focus the previewed item. |
tkent
2014/03/04 01:09:01
How does it look like? We need a rendering test.
|
+ if (select->suggestedIndex() >= 0) { |
+ rects.append(pixelSnappedIntRect(itemBoundingBoxRect(additionalOffset, select->suggestedIndex()))); |
+ return; |
+ } |
+ |
// Focus the last selected item. |
int selectedItem = select->activeSelectionEndListIndex(); |
if (selectedItem >= 0) { |
@@ -426,7 +432,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint& |
applyTextTransform(style(), itemText, ' '); |
Color textColor = element->renderStyle() ? resolveColor(element->renderStyle(), CSSPropertyColor) : resolveColor(CSSPropertyColor); |
- if (isOptionElement && toHTMLOptionElement(element)->selected()) { |
+ if (isOptionElement && ((toHTMLOptionElement(element)->selected() && select->suggestedIndex() < 0) || listIndex == select->suggestedIndex())) { |
if (frame()->selection().isFocusedAndActive() && document().focusedElement() == node()) |
textColor = RenderTheme::theme().activeListBoxSelectionForegroundColor(); |
// Honor the foreground color for disabled items |
@@ -460,7 +466,7 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint& |
HTMLElement* element = listItems[listIndex]; |
Color backColor; |
- if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) { |
+ if (element->hasTagName(optionTag) && ((toHTMLOptionElement(element)->selected() && selectElement()->suggestedIndex() < 0) || listIndex == selectElement()->suggestedIndex())) { |
if (frame()->selection().isFocusedAndActive() && document().focusedElement() == node()) |
backColor = RenderTheme::theme().activeListBoxSelectionBackgroundColor(); |
else |