| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights |
| 7 * reserved. | 7 * reserved. |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2010 Google Inc. All rights reserved. | 9 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 notifyFormStateChanged(); | 1047 notifyFormStateChanged(); |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 void HTMLSelectElement::dispatchFocusEvent( | 1050 void HTMLSelectElement::dispatchFocusEvent( |
| 1051 Element* oldFocusedElement, | 1051 Element* oldFocusedElement, |
| 1052 WebFocusType type, | 1052 WebFocusType type, |
| 1053 InputDeviceCapabilities* sourceCapabilities) { | 1053 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
| 1054 // Save the selection so it can be compared to the new selection when | 1054 // Save the selection so it can be compared to the new selection when |
| 1055 // dispatching change events during blur event dispatch. | 1055 // dispatching change events during blur event dispatch. |
| 1056 if (usesMenuList()) | 1056 if (usesMenuList()) |
| 1057 saveLastSelection(); | 1057 saveLastSelection(); |
| 1058 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, type, | 1058 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, type, |
| 1059 sourceCapabilities); | 1059 sourceCapabilities); |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 void HTMLSelectElement::dispatchBlurEvent( | 1062 void HTMLSelectElement::dispatchBlurEvent( |
| 1063 Element* newFocusedElement, | 1063 Element* newFocusedElement, |
| 1064 WebFocusType type, | 1064 WebFocusType type, |
| 1065 InputDeviceCapabilities* sourceCapabilities) { | 1065 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
| 1066 m_typeAhead.resetSession(); | 1066 m_typeAhead.resetSession(); |
| 1067 // We only need to fire change events here for menu lists, because we fire | 1067 // We only need to fire change events here for menu lists, because we fire |
| 1068 // change events for list boxes whenever the selection change is actually | 1068 // change events for list boxes whenever the selection change is actually |
| 1069 // made. This matches other browsers' behavior. | 1069 // made. This matches other browsers' behavior. |
| 1070 if (usesMenuList()) | 1070 if (usesMenuList()) |
| 1071 dispatchInputAndChangeEventForMenuList(); | 1071 dispatchInputAndChangeEventForMenuList(); |
| 1072 m_lastOnChangeSelection.clear(); | 1072 m_lastOnChangeSelection.clear(); |
| 1073 if (popupIsVisible()) | 1073 if (popupIsVisible()) |
| 1074 hidePopup(); | 1074 hidePopup(); |
| 1075 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type, | 1075 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type, |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 if (form()) | 1344 if (form()) |
| 1345 form()->submitImplicitly(event, false); | 1345 form()->submitImplicitly(event, false); |
| 1346 dispatchInputAndChangeEventForMenuList(); | 1346 dispatchInputAndChangeEventForMenuList(); |
| 1347 event->setDefaultHandled(); | 1347 event->setDefaultHandled(); |
| 1348 } | 1348 } |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && | 1351 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && |
| 1352 toMouseEvent(event)->button() == | 1352 toMouseEvent(event)->button() == |
| 1353 static_cast<short>(WebPointerProperties::Button::Left)) { | 1353 static_cast<short>(WebPointerProperties::Button::Left)) { |
| 1354 InputDeviceCapabilities* sourceCapabilities = | 1354 InputDeviceCapabilitiesValue sourceCapabilities = |
| 1355 document().domWindow()->getInputDeviceCapabilities()->firesTouchEvents( | 1355 InputDeviceCapabilitiesValue(toMouseEvent(event)->fromTouch()); |
| 1356 toMouseEvent(event)->fromTouch()); | |
| 1357 focus(FocusParams(SelectionBehaviorOnFocus::Restore, WebFocusTypeNone, | 1356 focus(FocusParams(SelectionBehaviorOnFocus::Restore, WebFocusTypeNone, |
| 1358 sourceCapabilities)); | 1357 sourceCapabilities)); |
| 1359 if (layoutObject() && layoutObject()->isMenuList() && | 1358 if (layoutObject() && layoutObject()->isMenuList() && |
| 1360 !isDisabledFormControl()) { | 1359 !isDisabledFormControl()) { |
| 1361 if (popupIsVisible()) { | 1360 if (popupIsVisible()) { |
| 1362 hidePopup(); | 1361 hidePopup(); |
| 1363 } else { | 1362 } else { |
| 1364 // Save the selection so it can be compared to the new selection | 1363 // Save the selection so it can be compared to the new selection |
| 1365 // when we call onChange during selectOption, which gets called | 1364 // when we call onChange during selectOption, which gets called |
| 1366 // from selectOptionByPopup, which gets called after the user | 1365 // from selectOptionByPopup, which gets called after the user |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 m_popupUpdater = nullptr; | 2041 m_popupUpdater = nullptr; |
| 2043 } | 2042 } |
| 2044 | 2043 |
| 2045 void HTMLSelectElement::didMutateSubtree() { | 2044 void HTMLSelectElement::didMutateSubtree() { |
| 2046 DCHECK(popupIsVisible()); | 2045 DCHECK(popupIsVisible()); |
| 2047 DCHECK(m_popup); | 2046 DCHECK(m_popup); |
| 2048 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2047 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2049 } | 2048 } |
| 2050 | 2049 |
| 2051 } // namespace blink | 2050 } // namespace blink |
| OLD | NEW |