OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "web/PopupMenuImpl.h" | 5 #include "web/PopupMenuImpl.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/css/CSSFontSelector.h" | 8 #include "core/css/CSSFontSelector.h" |
9 #include "core/dom/ElementTraversal.h" | 9 #include "core/dom/ElementTraversal.h" |
10 #include "core/dom/ExecutionContextTask.h" | 10 #include "core/dom/ExecutionContextTask.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 void PopupMenuImpl::setValueAndClosePopup(int numValue, const String& stringValu
e) | 392 void PopupMenuImpl::setValueAndClosePopup(int numValue, const String& stringValu
e) |
393 { | 393 { |
394 DCHECK(m_popup); | 394 DCHECK(m_popup); |
395 DCHECK(m_ownerElement); | 395 DCHECK(m_ownerElement); |
396 bool success; | 396 bool success; |
397 int listIndex = stringValue.toInt(&success); | 397 int listIndex = stringValue.toInt(&success); |
398 DCHECK(success); | 398 DCHECK(success); |
399 { | 399 { |
400 EventQueueScope scope; | 400 EventQueueScope scope; |
401 m_ownerElement->valueChanged(listIndex); | 401 m_ownerElement->selectOptionByPopup(listIndex); |
402 if (m_popup) | 402 if (m_popup) |
403 m_chromeClient->closePagePopup(m_popup); | 403 m_chromeClient->closePagePopup(m_popup); |
404 // 'change' event is dispatched here. For compatbility with | 404 // 'change' event is dispatched here. For compatbility with |
405 // Angular 1.2, we need to dispatch a change event before | 405 // Angular 1.2, we need to dispatch a change event before |
406 // mouseup/click events. | 406 // mouseup/click events. |
407 } | 407 } |
408 // We dispatch events on the owner element to match the legacy behavior. | 408 // We dispatch events on the owner element to match the legacy behavior. |
409 // Other browsers dispatch click events before and after showing the popup. | 409 // Other browsers dispatch click events before and after showing the popup. |
410 if (m_ownerElement) { | 410 if (m_ownerElement) { |
411 PlatformMouseEvent event; | 411 PlatformMouseEvent event; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 void PopupMenuImpl::disconnectClient() | 521 void PopupMenuImpl::disconnectClient() |
522 { | 522 { |
523 m_ownerElement = nullptr; | 523 m_ownerElement = nullptr; |
524 // Cannot be done during finalization, so instead done when the | 524 // Cannot be done during finalization, so instead done when the |
525 // layout object is destroyed and disconnected. | 525 // layout object is destroyed and disconnected. |
526 dispose(); | 526 dispose(); |
527 } | 527 } |
528 | 528 |
529 } // namespace blink | 529 } // namespace blink |
OLD | NEW |