| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web/PopupMenuImpl.h" | 6 #include "web/PopupMenuImpl.h" |
| 7 | 7 |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/css/CSSFontSelector.h" | 9 #include "core/css/CSSFontSelector.h" |
| 10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
| 11 #include "core/dom/ExecutionContextTask.h" | 11 #include "core/dom/ExecutionContextTask.h" |
| 12 #include "core/dom/NodeComputedStyle.h" | 12 #include "core/dom/NodeComputedStyle.h" |
| 13 #include "core/dom/StyleEngine.h" | 13 #include "core/dom/StyleEngine.h" |
| 14 #include "core/events/ScopedEventQueue.h" |
| 14 #include "core/frame/FrameView.h" | 15 #include "core/frame/FrameView.h" |
| 15 #include "core/html/HTMLHRElement.h" | 16 #include "core/html/HTMLHRElement.h" |
| 16 #include "core/html/HTMLOptGroupElement.h" | 17 #include "core/html/HTMLOptGroupElement.h" |
| 17 #include "core/html/HTMLOptionElement.h" | 18 #include "core/html/HTMLOptionElement.h" |
| 18 #include "core/html/HTMLSelectElement.h" | 19 #include "core/html/HTMLSelectElement.h" |
| 19 #include "core/html/parser/HTMLParserIdioms.h" | 20 #include "core/html/parser/HTMLParserIdioms.h" |
| 20 #include "core/layout/LayoutTheme.h" | 21 #include "core/layout/LayoutTheme.h" |
| 21 #include "core/page/PagePopup.h" | 22 #include "core/page/PagePopup.h" |
| 22 #include "platform/geometry/IntRect.h" | 23 #include "platform/geometry/IntRect.h" |
| 23 #include "platform/text/PlatformLocale.h" | 24 #include "platform/text/PlatformLocale.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 void PopupMenuImpl::selectFontsFromOwnerDocument(Document& document) | 398 void PopupMenuImpl::selectFontsFromOwnerDocument(Document& document) |
| 398 { | 399 { |
| 399 Document& ownerDocument = ownerElement().document(); | 400 Document& ownerDocument = ownerElement().document(); |
| 400 document.styleEngine().setFontSelector(PopupMenuCSSFontSelector::create(&doc
ument, ownerDocument.styleEngine().fontSelector())); | 401 document.styleEngine().setFontSelector(PopupMenuCSSFontSelector::create(&doc
ument, ownerDocument.styleEngine().fontSelector())); |
| 401 } | 402 } |
| 402 | 403 |
| 403 void PopupMenuImpl::setValueAndClosePopup(int numValue, const String& stringValu
e) | 404 void PopupMenuImpl::setValueAndClosePopup(int numValue, const String& stringValu
e) |
| 404 { | 405 { |
| 405 ASSERT(m_popup); | 406 ASSERT(m_popup); |
| 406 ASSERT(m_ownerElement); | 407 ASSERT(m_ownerElement); |
| 408 EventQueueScope scope; |
| 407 RefPtrWillBeRawPtr<PopupMenuImpl> protector(this); | 409 RefPtrWillBeRawPtr<PopupMenuImpl> protector(this); |
| 408 bool success; | 410 bool success; |
| 409 int listIndex = stringValue.toInt(&success); | 411 int listIndex = stringValue.toInt(&success); |
| 410 ASSERT(success); | 412 ASSERT(success); |
| 411 m_ownerElement->valueChanged(listIndex); | 413 m_ownerElement->valueChanged(listIndex); |
| 412 if (m_popup) | 414 if (m_popup) |
| 413 m_chromeClient->closePagePopup(m_popup); | 415 m_chromeClient->closePagePopup(m_popup); |
| 414 // We dispatch events on the owner element to match the legacy behavior. | 416 // We dispatch events on the owner element to match the legacy behavior. |
| 415 // Other browsers dispatch click events before and after showing the popup. | 417 // Other browsers dispatch click events before and after showing the popup. |
| 416 if (m_ownerElement) { | 418 if (m_ownerElement) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 518 |
| 517 void PopupMenuImpl::disconnectClient() | 519 void PopupMenuImpl::disconnectClient() |
| 518 { | 520 { |
| 519 m_ownerElement = nullptr; | 521 m_ownerElement = nullptr; |
| 520 // Cannot be done during finalization, so instead done when the | 522 // Cannot be done during finalization, so instead done when the |
| 521 // layout object is destroyed and disconnected. | 523 // layout object is destroyed and disconnected. |
| 522 dispose(); | 524 dispose(); |
| 523 } | 525 } |
| 524 | 526 |
| 525 } // namespace blink | 527 } // namespace blink |
| OLD | NEW |