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 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 // Actual index of option not counting OPTGROUP entries that may be in list. | 1096 // Actual index of option not counting OPTGROUP entries that may be in list. |
1097 int optionIndex = 0; | 1097 int optionIndex = 0; |
1098 for (int i = 0; i < listIndex; ++i) { | 1098 for (int i = 0; i < listIndex; ++i) { |
1099 if (isHTMLOptionElement(*items[i])) | 1099 if (isHTMLOptionElement(*items[i])) |
1100 ++optionIndex; | 1100 ++optionIndex; |
1101 } | 1101 } |
1102 | 1102 |
1103 return optionIndex; | 1103 return optionIndex; |
1104 } | 1104 } |
1105 | 1105 |
1106 void HTMLSelectElement::dispatchFocusEvent(Element* oldFocusedElement, WebFocusT
ype type, InputDeviceCapabilities* sourceCapabilities) | |
1107 { | |
1108 // Save the selection so it can be compared to the new selection when | |
1109 // dispatching change events during blur event dispatch. | |
1110 if (usesMenuList()) | |
1111 saveLastSelection(); | |
1112 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, type,
sourceCapabilities); | |
1113 } | |
1114 | |
1115 void HTMLSelectElement::dispatchBlurEvent(Element* newFocusedElement, WebFocusTy
pe type, InputDeviceCapabilities* sourceCapabilities) | |
1116 { | |
1117 m_typeAhead.resetSession(); | |
1118 // We only need to fire change events here for menu lists, because we fire | |
1119 // change events for list boxes whenever the selection change is actually | |
1120 // made. This matches other browsers' behavior. | |
1121 if (usesMenuList()) | |
1122 dispatchInputAndChangeEventForMenuList(); | |
1123 m_lastOnChangeSelection.clear(); | |
1124 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type,
sourceCapabilities); | |
1125 } | |
1126 | |
1127 void HTMLSelectElement::deselectItemsWithoutValidation(HTMLElement* excludeEleme
nt) | 1106 void HTMLSelectElement::deselectItemsWithoutValidation(HTMLElement* excludeEleme
nt) |
1128 { | 1107 { |
1129 for (auto& element : listItems()) { | 1108 for (auto& element : listItems()) { |
1130 if (element != excludeElement && isHTMLOptionElement(*element)) | 1109 if (element != excludeElement && isHTMLOptionElement(*element)) |
1131 toHTMLOptionElement(element)->setSelectedState(false); | 1110 toHTMLOptionElement(element)->setSelectedState(false); |
1132 } | 1111 } |
1133 } | 1112 } |
1134 | 1113 |
1135 FormControlState HTMLSelectElement::saveFormControlState() const | 1114 FormControlState HTMLSelectElement::saveFormControlState() const |
1136 { | 1115 { |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 m_popup->disconnectClient(); | 1961 m_popup->disconnectClient(); |
1983 m_popupIsVisible = false; | 1962 m_popupIsVisible = false; |
1984 m_popup = nullptr; | 1963 m_popup = nullptr; |
1985 } | 1964 } |
1986 | 1965 |
1987 void HTMLSelectElement::resetTypeAheadSessionForTesting() | 1966 void HTMLSelectElement::resetTypeAheadSessionForTesting() |
1988 { | 1967 { |
1989 m_typeAhead.resetSession(); | 1968 m_typeAhead.resetSession(); |
1990 } | 1969 } |
1991 | 1970 |
| 1971 void HTMLSelectElement::dispatchFocusEvent(Element* oldFocusedElement, WebFocusT
ype type, InputDeviceCapabilities* sourceCapabilities) |
| 1972 { |
| 1973 // Save the selection so it can be compared to the new selection when |
| 1974 // dispatching change events during blur event dispatch. |
| 1975 if (usesMenuList()) |
| 1976 saveLastSelection(); |
| 1977 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, type,
sourceCapabilities); |
| 1978 } |
| 1979 |
| 1980 void HTMLSelectElement::dispatchBlurEvent(Element* newFocusedElement, WebFocusTy
pe type, InputDeviceCapabilities* sourceCapabilities) |
| 1981 { |
| 1982 m_typeAhead.resetSession(); |
| 1983 // We only need to fire change events here for menu lists, because we fire |
| 1984 // change events for list boxes whenever the selection change is actually |
| 1985 // made. This matches other browsers' behavior. |
| 1986 if (usesMenuList()) |
| 1987 dispatchInputAndChangeEventForMenuList(); |
| 1988 m_lastOnChangeSelection.clear(); |
| 1989 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type,
sourceCapabilities); |
| 1990 } |
| 1991 |
1992 } // namespace blink | 1992 } // namespace blink |
OLD | NEW |