| 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" |
| 11 #include "core/dom/NodeComputedStyle.h" | 11 #include "core/dom/NodeComputedStyle.h" |
| 12 #include "core/dom/StyleEngine.h" | 12 #include "core/dom/StyleEngine.h" |
| 13 #include "core/dom/TaskRunnerHelper.h" |
| 13 #include "core/events/ScopedEventQueue.h" | 14 #include "core/events/ScopedEventQueue.h" |
| 14 #include "core/frame/FrameView.h" | 15 #include "core/frame/FrameView.h" |
| 15 #include "core/frame/LocalFrame.h" | 16 #include "core/frame/LocalFrame.h" |
| 16 #include "core/html/HTMLHRElement.h" | 17 #include "core/html/HTMLHRElement.h" |
| 17 #include "core/html/HTMLOptGroupElement.h" | 18 #include "core/html/HTMLOptGroupElement.h" |
| 18 #include "core/html/HTMLOptionElement.h" | 19 #include "core/html/HTMLOptionElement.h" |
| 19 #include "core/html/HTMLSelectElement.h" | 20 #include "core/html/HTMLSelectElement.h" |
| 20 #include "core/html/parser/HTMLParserIdioms.h" | 21 #include "core/html/parser/HTMLParserIdioms.h" |
| 21 #include "core/layout/LayoutTheme.h" | 22 #include "core/layout/LayoutTheme.h" |
| 22 #include "core/page/PagePopup.h" | 23 #include "core/page/PagePopup.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 493 |
| 493 void PopupMenuImpl::hide() { | 494 void PopupMenuImpl::hide() { |
| 494 closePopup(); | 495 closePopup(); |
| 495 } | 496 } |
| 496 | 497 |
| 497 void PopupMenuImpl::updateFromElement(UpdateReason) { | 498 void PopupMenuImpl::updateFromElement(UpdateReason) { |
| 498 if (m_needsUpdate) | 499 if (m_needsUpdate) |
| 499 return; | 500 return; |
| 500 m_needsUpdate = true; | 501 m_needsUpdate = true; |
| 501 ownerElement().document().postTask( | 502 ownerElement().document().postTask( |
| 502 BLINK_FROM_HERE, | 503 TaskType::UserInteraction, BLINK_FROM_HERE, |
| 503 createSameThreadTask(&PopupMenuImpl::update, wrapPersistent(this))); | 504 createSameThreadTask(&PopupMenuImpl::update, wrapPersistent(this))); |
| 504 } | 505 } |
| 505 | 506 |
| 506 void PopupMenuImpl::update() { | 507 void PopupMenuImpl::update() { |
| 507 if (!m_popup || !m_ownerElement) | 508 if (!m_popup || !m_ownerElement) |
| 508 return; | 509 return; |
| 509 ownerElement().document().updateStyleAndLayoutTree(); | 510 ownerElement().document().updateStyleAndLayoutTree(); |
| 510 // disconnectClient() might have been called. | 511 // disconnectClient() might have been called. |
| 511 if (!m_ownerElement) | 512 if (!m_ownerElement) |
| 512 return; | 513 return; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } | 552 } |
| 552 | 553 |
| 553 void PopupMenuImpl::disconnectClient() { | 554 void PopupMenuImpl::disconnectClient() { |
| 554 m_ownerElement = nullptr; | 555 m_ownerElement = nullptr; |
| 555 // Cannot be done during finalization, so instead done when the | 556 // Cannot be done during finalization, so instead done when the |
| 556 // layout object is destroyed and disconnected. | 557 // layout object is destroyed and disconnected. |
| 557 dispose(); | 558 dispose(); |
| 558 } | 559 } |
| 559 | 560 |
| 560 } // namespace blink | 561 } // namespace blink |
| OLD | NEW |