| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 lazyReattachIfAttached(); | 323 lazyReattachIfAttached(); |
| 324 resetToDefaultSelection(); | 324 resetToDefaultSelection(); |
| 325 if (!usesMenuList()) | 325 if (!usesMenuList()) |
| 326 saveListboxActiveSelection(); | 326 saveListboxActiveSelection(); |
| 327 } | 327 } |
| 328 } else if (name == multipleAttr) { | 328 } else if (name == multipleAttr) { |
| 329 parseMultipleAttribute(value); | 329 parseMultipleAttribute(value); |
| 330 } else if (name == accesskeyAttr) { | 330 } else if (name == accesskeyAttr) { |
| 331 // FIXME: ignore for the moment. | 331 // FIXME: ignore for the moment. |
| 332 // | 332 // |
| 333 } else if (name == disabledAttr) { | |
| 334 HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); | |
| 335 if (popupIsVisible()) | |
| 336 hidePopup(); | |
| 337 | |
| 338 } else { | 333 } else { |
| 339 HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); | 334 HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); |
| 340 } | 335 } |
| 341 } | 336 } |
| 342 | 337 |
| 343 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const { | 338 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const { |
| 344 return true; | 339 return true; |
| 345 } | 340 } |
| 346 | 341 |
| 347 bool HTMLSelectElement::canSelectAll() const { | 342 bool HTMLSelectElement::canSelectAll() const { |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 Element* newFocusedElement, | 1066 Element* newFocusedElement, |
| 1072 WebFocusType type, | 1067 WebFocusType type, |
| 1073 InputDeviceCapabilities* sourceCapabilities) { | 1068 InputDeviceCapabilities* sourceCapabilities) { |
| 1074 m_typeAhead.resetSession(); | 1069 m_typeAhead.resetSession(); |
| 1075 // We only need to fire change events here for menu lists, because we fire | 1070 // We only need to fire change events here for menu lists, because we fire |
| 1076 // change events for list boxes whenever the selection change is actually | 1071 // change events for list boxes whenever the selection change is actually |
| 1077 // made. This matches other browsers' behavior. | 1072 // made. This matches other browsers' behavior. |
| 1078 if (usesMenuList()) | 1073 if (usesMenuList()) |
| 1079 dispatchInputAndChangeEventForMenuList(); | 1074 dispatchInputAndChangeEventForMenuList(); |
| 1080 m_lastOnChangeSelection.clear(); | 1075 m_lastOnChangeSelection.clear(); |
| 1076 if (popupIsVisible()) |
| 1077 hidePopup(); |
| 1081 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type, | 1078 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type, |
| 1082 sourceCapabilities); | 1079 sourceCapabilities); |
| 1083 } | 1080 } |
| 1084 | 1081 |
| 1085 void HTMLSelectElement::deselectItemsWithoutValidation( | 1082 void HTMLSelectElement::deselectItemsWithoutValidation( |
| 1086 HTMLOptionElement* excludeElement) { | 1083 HTMLOptionElement* excludeElement) { |
| 1087 if (!isMultiple() && usesMenuList() && m_lastOnChangeOption && | 1084 if (!isMultiple() && usesMenuList() && m_lastOnChangeOption && |
| 1088 m_lastOnChangeOption != excludeElement) { | 1085 m_lastOnChangeOption != excludeElement) { |
| 1089 m_lastOnChangeOption->setSelectedState(false); | 1086 m_lastOnChangeOption->setSelectedState(false); |
| 1090 return; | 1087 return; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 // makes a selection from the menu. | 1366 // makes a selection from the menu. |
| 1370 saveLastSelection(); | 1367 saveLastSelection(); |
| 1371 // TODO(lanwei): Will check if we need to add | 1368 // TODO(lanwei): Will check if we need to add |
| 1372 // InputDeviceCapabilities here when select menu list gets | 1369 // InputDeviceCapabilities here when select menu list gets |
| 1373 // focus, see https://crbug.com/476530. | 1370 // focus, see https://crbug.com/476530. |
| 1374 showPopup(); | 1371 showPopup(); |
| 1375 } | 1372 } |
| 1376 } | 1373 } |
| 1377 event->setDefaultHandled(); | 1374 event->setDefaultHandled(); |
| 1378 } | 1375 } |
| 1379 | |
| 1380 if (event->type() == EventTypeNames::blur) { | |
| 1381 if (popupIsVisible()) | |
| 1382 hidePopup(); | |
| 1383 } | |
| 1384 } | 1376 } |
| 1385 | 1377 |
| 1386 void HTMLSelectElement::updateSelectedState(HTMLOptionElement* clickedOption, | 1378 void HTMLSelectElement::updateSelectedState(HTMLOptionElement* clickedOption, |
| 1387 bool multi, | 1379 bool multi, |
| 1388 bool shift) { | 1380 bool shift) { |
| 1389 DCHECK(clickedOption); | 1381 DCHECK(clickedOption); |
| 1390 // Save the selection so it can be compared to the new selection when | 1382 // Save the selection so it can be compared to the new selection when |
| 1391 // dispatching change events during mouseup, or after autoscroll finishes. | 1383 // dispatching change events during mouseup, or after autoscroll finishes. |
| 1392 saveLastSelection(); | 1384 saveLastSelection(); |
| 1393 | 1385 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 m_popupUpdater = nullptr; | 2028 m_popupUpdater = nullptr; |
| 2037 } | 2029 } |
| 2038 | 2030 |
| 2039 void HTMLSelectElement::didMutateSubtree() { | 2031 void HTMLSelectElement::didMutateSubtree() { |
| 2040 DCHECK(popupIsVisible()); | 2032 DCHECK(popupIsVisible()); |
| 2041 DCHECK(m_popup); | 2033 DCHECK(m_popup); |
| 2042 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2034 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2043 } | 2035 } |
| 2044 | 2036 |
| 2045 } // namespace blink | 2037 } // namespace blink |
| OLD | NEW |