Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp

Issue 2537573003: Merge "SELECT element: Commit a provisional OPTION selection on blur." to M56 (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 // makes a selection from the menu. 1361 // makes a selection from the menu.
1365 saveLastSelection(); 1362 saveLastSelection();
1366 // TODO(lanwei): Will check if we need to add 1363 // TODO(lanwei): Will check if we need to add
1367 // InputDeviceCapabilities here when select menu list gets 1364 // InputDeviceCapabilities here when select menu list gets
1368 // focus, see https://crbug.com/476530. 1365 // focus, see https://crbug.com/476530.
1369 showPopup(); 1366 showPopup();
1370 } 1367 }
1371 } 1368 }
1372 event->setDefaultHandled(); 1369 event->setDefaultHandled();
1373 } 1370 }
1374
1375 if (event->type() == EventTypeNames::blur) {
1376 if (popupIsVisible())
1377 hidePopup();
1378 }
1379 } 1371 }
1380 1372
1381 void HTMLSelectElement::updateSelectedState(HTMLOptionElement* clickedOption, 1373 void HTMLSelectElement::updateSelectedState(HTMLOptionElement* clickedOption,
1382 bool multi, 1374 bool multi,
1383 bool shift) { 1375 bool shift) {
1384 DCHECK(clickedOption); 1376 DCHECK(clickedOption);
1385 // Save the selection so it can be compared to the new selection when 1377 // Save the selection so it can be compared to the new selection when
1386 // dispatching change events during mouseup, or after autoscroll finishes. 1378 // dispatching change events during mouseup, or after autoscroll finishes.
1387 saveLastSelection(); 1379 saveLastSelection();
1388 1380
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 m_popupUpdater = nullptr; 2023 m_popupUpdater = nullptr;
2032 } 2024 }
2033 2025
2034 void HTMLSelectElement::didMutateSubtree() { 2026 void HTMLSelectElement::didMutateSubtree() {
2035 DCHECK(popupIsVisible()); 2027 DCHECK(popupIsVisible());
2036 DCHECK(m_popup); 2028 DCHECK(m_popup);
2037 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2029 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2038 } 2030 }
2039 2031
2040 } // namespace blink 2032 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698