Chromium Code Reviews| 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/frame/FrameView.h" | 14 #include "core/frame/FrameView.h" |
| 15 #include "core/html/HTMLHRElement.h" | 15 #include "core/html/HTMLHRElement.h" |
| 16 #include "core/html/HTMLOptGroupElement.h" | 16 #include "core/html/HTMLOptGroupElement.h" |
| 17 #include "core/html/HTMLOptionElement.h" | 17 #include "core/html/HTMLOptionElement.h" |
| 18 #include "core/html/parser/HTMLParserIdioms.h" | 18 #include "core/html/parser/HTMLParserIdioms.h" |
| 19 #include "core/layout/LayoutTheme.h" | 19 #include "core/layout/LayoutTheme.h" |
| 20 #include "core/page/PagePopup.h" | 20 #include "core/page/PagePopup.h" |
| 21 #include "platform/geometry/IntRect.h" | 21 #include "platform/geometry/IntRect.h" |
| 22 #include "platform/text/PlatformLocale.h" | 22 #include "platform/text/PlatformLocale.h" |
| 23 #include "public/platform/Platform.h" | 23 #include "public/platform/Platform.h" |
| 24 #include "public/web/WebColorChooser.h" | 24 #include "public/web/WebColorChooser.h" |
| 25 #include "web/ChromeClientImpl.h" | 25 #include "web/ChromeClientImpl.h" |
| 26 #include "web/WebViewImpl.h" | 26 #include "web/WebViewImpl.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class PopupMenuCSSFontSelector : public CSSFontSelector { | 30 class PopupMenuCSSFontSelector : public CSSFontSelector, private CSSFontSelector Client { |
| 31 public: | 31 public: |
| 32 static PassRefPtrWillBeRawPtr<PopupMenuCSSFontSelector> create(Document* doc ument, CSSFontSelector* ownerFontSelector) | 32 static PassRefPtrWillBeRawPtr<PopupMenuCSSFontSelector> create(Document* doc ument, CSSFontSelector* ownerFontSelector) |
| 33 { | 33 { |
| 34 return adoptRefWillBeNoop(new PopupMenuCSSFontSelector(document, ownerFo ntSelector)); | 34 return adoptRefWillBeNoop(new PopupMenuCSSFontSelector(document, ownerFo ntSelector)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ~PopupMenuCSSFontSelector(); | |
| 38 | |
| 37 // We don't override willUseFontData() for now because the old PopupListBox | 39 // We don't override willUseFontData() for now because the old PopupListBox |
| 38 // only worked with fonts loaded when opening the popup. | 40 // only worked with fonts loaded when opening the popup. |
| 39 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi cString&) override; | 41 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi cString&) override; |
| 40 | 42 |
| 41 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 PopupMenuCSSFontSelector(Document* document, CSSFontSelector* ownerFontSelec tor) | 46 PopupMenuCSSFontSelector(Document*, CSSFontSelector*); |
| 45 : CSSFontSelector(document) | 47 |
| 46 , m_ownerFontSelector(ownerFontSelector) | 48 virtual void fontsNeedUpdate(CSSFontSelector*) override; |
| 47 { | 49 |
| 48 } | |
| 49 RefPtrWillBeMember<CSSFontSelector> m_ownerFontSelector; | 50 RefPtrWillBeMember<CSSFontSelector> m_ownerFontSelector; |
| 50 }; | 51 }; |
| 51 | 52 |
| 53 PopupMenuCSSFontSelector::PopupMenuCSSFontSelector(Document* document, CSSFontSe lector* ownerFontSelector) | |
| 54 : CSSFontSelector(document) | |
| 55 , m_ownerFontSelector(ownerFontSelector) | |
| 56 { | |
| 57 m_ownerFontSelector->registerForInvalidationCallbacks(this); | |
| 58 } | |
| 59 | |
| 60 PopupMenuCSSFontSelector::~PopupMenuCSSFontSelector() | |
| 61 { | |
| 62 #if ENABLE(OILPAN) | |
|
Kunihiko Sakamoto
2015/05/29 07:40:06
Should be #if !ENABLE(OILPAN).
keishi
2015/06/02 05:33:00
Done.
| |
| 63 m_ownerFontSelector->unregisterForInvalidationCallbacks(this); | |
| 64 #endif | |
| 65 } | |
| 66 | |
| 52 PassRefPtr<FontData> PopupMenuCSSFontSelector::getFontData(const FontDescription & description, const AtomicString& name) | 67 PassRefPtr<FontData> PopupMenuCSSFontSelector::getFontData(const FontDescription & description, const AtomicString& name) |
| 53 { | 68 { |
| 54 return m_ownerFontSelector->getFontData(description, name); | 69 return m_ownerFontSelector->getFontData(description, name); |
| 55 } | 70 } |
| 56 | 71 |
| 72 void PopupMenuCSSFontSelector::fontsNeedUpdate(CSSFontSelector* fontSelector) | |
| 73 { | |
| 74 dispatchInvalidationCallbacks(); | |
| 75 } | |
| 76 | |
| 57 DEFINE_TRACE(PopupMenuCSSFontSelector) | 77 DEFINE_TRACE(PopupMenuCSSFontSelector) |
| 58 { | 78 { |
| 59 visitor->trace(m_ownerFontSelector); | 79 visitor->trace(m_ownerFontSelector); |
| 60 CSSFontSelector::trace(visitor); | 80 CSSFontSelector::trace(visitor); |
| 81 CSSFontSelectorClient::trace(visitor); | |
| 61 } | 82 } |
| 62 | 83 |
| 63 PassRefPtrWillBeRawPtr<PopupMenuImpl> PopupMenuImpl::create(ChromeClientImpl* ch romeClient, PopupMenuClient* client) | 84 PassRefPtrWillBeRawPtr<PopupMenuImpl> PopupMenuImpl::create(ChromeClientImpl* ch romeClient, PopupMenuClient* client) |
| 64 { | 85 { |
| 65 return adoptRefWillBeNoop(new PopupMenuImpl(chromeClient, client)); | 86 return adoptRefWillBeNoop(new PopupMenuImpl(chromeClient, client)); |
| 66 } | 87 } |
| 67 | 88 |
| 68 PopupMenuImpl::PopupMenuImpl(ChromeClientImpl* chromeClient, PopupMenuClient* cl ient) | 89 PopupMenuImpl::PopupMenuImpl(ChromeClientImpl* chromeClient, PopupMenuClient* cl ient) |
| 69 : m_chromeClient(chromeClient) | 90 : m_chromeClient(chromeClient) |
| 70 , m_client(client) | 91 , m_client(client) |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 | 391 |
| 371 void PopupMenuImpl::disconnectClient() | 392 void PopupMenuImpl::disconnectClient() |
| 372 { | 393 { |
| 373 m_client = nullptr; | 394 m_client = nullptr; |
| 374 // Cannot be done during finalization, so instead done when the | 395 // Cannot be done during finalization, so instead done when the |
| 375 // layout object is destroyed and disconnected. | 396 // layout object is destroyed and disconnected. |
| 376 dispose(); | 397 dispose(); |
| 377 } | 398 } |
| 378 | 399 |
| 379 } // namespace blink | 400 } // namespace blink |
| OLD | NEW |