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

Side by Side Diff: Source/web/PopupMenuImpl.cpp

Issue 1159833003: New SELECT Popup: Recalc style when a web font is loaded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 6 months 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 | Annotate | Revision Log
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
21 #include "core/page/PagePopup.h" 21 #include "core/page/PagePopup.h"
22 #include "platform/geometry/IntRect.h" 22 #include "platform/geometry/IntRect.h"
23 #include "platform/text/PlatformLocale.h" 23 #include "platform/text/PlatformLocale.h"
24 #include "public/platform/Platform.h" 24 #include "public/platform/Platform.h"
25 #include "public/web/WebColorChooser.h" 25 #include "public/web/WebColorChooser.h"
26 #include "web/ChromeClientImpl.h" 26 #include "web/ChromeClientImpl.h"
27 #include "web/WebViewImpl.h" 27 #include "web/WebViewImpl.h"
28 28
29 namespace blink { 29 namespace blink {
30 30
31 class PopupMenuCSSFontSelector : public CSSFontSelector { 31 class PopupMenuCSSFontSelector : public CSSFontSelector, private CSSFontSelector Client {
32 public: 32 public:
33 static PassRefPtrWillBeRawPtr<PopupMenuCSSFontSelector> create(Document* doc ument, CSSFontSelector* ownerFontSelector) 33 static PassRefPtrWillBeRawPtr<PopupMenuCSSFontSelector> create(Document* doc ument, CSSFontSelector* ownerFontSelector)
34 { 34 {
35 return adoptRefWillBeNoop(new PopupMenuCSSFontSelector(document, ownerFo ntSelector)); 35 return adoptRefWillBeNoop(new PopupMenuCSSFontSelector(document, ownerFo ntSelector));
36 } 36 }
37 37
38 ~PopupMenuCSSFontSelector();
39
38 // We don't override willUseFontData() for now because the old PopupListBox 40 // We don't override willUseFontData() for now because the old PopupListBox
39 // only worked with fonts loaded when opening the popup. 41 // only worked with fonts loaded when opening the popup.
40 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi cString&) override; 42 virtual PassRefPtr<FontData> getFontData(const FontDescription&, const Atomi cString&) override;
41 43
42 DECLARE_VIRTUAL_TRACE(); 44 DECLARE_VIRTUAL_TRACE();
43 45
44 private: 46 private:
45 PopupMenuCSSFontSelector(Document* document, CSSFontSelector* ownerFontSelec tor) 47 PopupMenuCSSFontSelector(Document*, CSSFontSelector*);
46 : CSSFontSelector(document) 48
47 , m_ownerFontSelector(ownerFontSelector) 49 virtual void fontsNeedUpdate(CSSFontSelector*) override;
48 { 50
49 }
50 RefPtrWillBeMember<CSSFontSelector> m_ownerFontSelector; 51 RefPtrWillBeMember<CSSFontSelector> m_ownerFontSelector;
51 }; 52 };
52 53
54 PopupMenuCSSFontSelector::PopupMenuCSSFontSelector(Document* document, CSSFontSe lector* ownerFontSelector)
55 : CSSFontSelector(document)
56 , m_ownerFontSelector(ownerFontSelector)
57 {
58 m_ownerFontSelector->registerForInvalidationCallbacks(this);
59 }
60
61 PopupMenuCSSFontSelector::~PopupMenuCSSFontSelector()
62 {
63 #if !ENABLE(OILPAN)
64 m_ownerFontSelector->unregisterForInvalidationCallbacks(this);
65 #endif
66 }
67
53 PassRefPtr<FontData> PopupMenuCSSFontSelector::getFontData(const FontDescription & description, const AtomicString& name) 68 PassRefPtr<FontData> PopupMenuCSSFontSelector::getFontData(const FontDescription & description, const AtomicString& name)
54 { 69 {
55 return m_ownerFontSelector->getFontData(description, name); 70 return m_ownerFontSelector->getFontData(description, name);
56 } 71 }
57 72
73 void PopupMenuCSSFontSelector::fontsNeedUpdate(CSSFontSelector* fontSelector)
74 {
75 dispatchInvalidationCallbacks();
76 }
77
58 DEFINE_TRACE(PopupMenuCSSFontSelector) 78 DEFINE_TRACE(PopupMenuCSSFontSelector)
59 { 79 {
60 visitor->trace(m_ownerFontSelector); 80 visitor->trace(m_ownerFontSelector);
61 CSSFontSelector::trace(visitor); 81 CSSFontSelector::trace(visitor);
82 CSSFontSelectorClient::trace(visitor);
62 } 83 }
63 84
64 PassRefPtrWillBeRawPtr<PopupMenuImpl> PopupMenuImpl::create(ChromeClientImpl* ch romeClient, PopupMenuClient* client) 85 PassRefPtrWillBeRawPtr<PopupMenuImpl> PopupMenuImpl::create(ChromeClientImpl* ch romeClient, PopupMenuClient* client)
65 { 86 {
66 return adoptRefWillBeNoop(new PopupMenuImpl(chromeClient, client)); 87 return adoptRefWillBeNoop(new PopupMenuImpl(chromeClient, client));
67 } 88 }
68 89
69 PopupMenuImpl::PopupMenuImpl(ChromeClientImpl* chromeClient, PopupMenuClient* cl ient) 90 PopupMenuImpl::PopupMenuImpl(ChromeClientImpl* chromeClient, PopupMenuClient* cl ient)
70 : m_chromeClient(chromeClient) 91 : m_chromeClient(chromeClient)
71 , m_client(client) 92 , m_client(client)
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 426
406 void PopupMenuImpl::disconnectClient() 427 void PopupMenuImpl::disconnectClient()
407 { 428 {
408 m_client = nullptr; 429 m_client = nullptr;
409 // Cannot be done during finalization, so instead done when the 430 // Cannot be done during finalization, so instead done when the
410 // layout object is destroyed and disconnected. 431 // layout object is destroyed and disconnected.
411 dispose(); 432 dispose();
412 } 433 }
413 434
414 } // namespace blink 435 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/StyleEngine.cpp ('k') | Tools/Scripts/webkitpy/layout_tests/servers/apache_http.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698