OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
10 * | 10 * |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 if (!isRequired()) | 171 if (!isRequired()) |
172 return false; | 172 return false; |
173 | 173 |
174 int firstSelectionIndex = selectedIndex(); | 174 int firstSelectionIndex = selectedIndex(); |
175 | 175 |
176 // If a non-placeholer label option is selected (firstSelectionIndex > 0), i
t's not value-missing. | 176 // If a non-placeholer label option is selected (firstSelectionIndex > 0), i
t's not value-missing. |
177 return firstSelectionIndex < 0 || (!firstSelectionIndex && hasPlaceholderLab
elOption()); | 177 return firstSelectionIndex < 0 || (!firstSelectionIndex && hasPlaceholderLab
elOption()); |
178 } | 178 } |
179 | 179 |
| 180 void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelec
tions, bool shift, bool fireOnChangeNow) |
| 181 { |
| 182 if (!multiple()) |
| 183 optionSelectedByUser(listToOptionIndex(listIndex), fireOnChangeNow, fals
e); |
| 184 else { |
| 185 updateSelectedState(listIndex, allowMultiplySelections, shift); |
| 186 setNeedsValidityCheck(); |
| 187 if (fireOnChangeNow) |
| 188 listBoxOnChange(); |
| 189 } |
| 190 } |
| 191 |
180 bool HTMLSelectElement::usesMenuList() const | 192 bool HTMLSelectElement::usesMenuList() const |
181 { | 193 { |
182 if (RenderTheme::theme().delegatesMenuListRendering()) | 194 if (RenderTheme::theme().delegatesMenuListRendering()) |
183 return true; | 195 return true; |
184 | 196 |
185 return !m_multiple && m_size <= 1; | 197 return !m_multiple && m_size <= 1; |
186 } | 198 } |
187 | 199 |
188 int HTMLSelectElement::activeSelectionStartListIndex() const | 200 int HTMLSelectElement::activeSelectionStartListIndex() const |
189 { | 201 { |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 int focusedIndex = activeSelectionEndListIndex(); | 1738 int focusedIndex = activeSelectionEndListIndex(); |
1727 if (focusedIndex < 0) | 1739 if (focusedIndex < 0) |
1728 focusedIndex = firstSelectableListIndex(); | 1740 focusedIndex = firstSelectableListIndex(); |
1729 if (focusedIndex < 0) | 1741 if (focusedIndex < 0) |
1730 return nullptr; | 1742 return nullptr; |
1731 HTMLElement* focused = listItems()[focusedIndex]; | 1743 HTMLElement* focused = listItems()[focusedIndex]; |
1732 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1744 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
1733 } | 1745 } |
1734 | 1746 |
1735 } // namespace | 1747 } // namespace |
OLD | NEW |