 Chromium Code Reviews
 Chromium Code Reviews Issue 1159833003:
  New SELECT Popup: Recalc style when a web font is loaded  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 1159833003:
  New SELECT Popup: Recalc style when a web font is loaded  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| Index: Source/web/PopupMenuImpl.cpp | 
| diff --git a/Source/web/PopupMenuImpl.cpp b/Source/web/PopupMenuImpl.cpp | 
| index 621fa5861f7ba0bfafd4e98ebfe7de003ec4a800..eb74561ca6fe385d0028e095effaa36410de650b 100644 | 
| --- a/Source/web/PopupMenuImpl.cpp | 
| +++ b/Source/web/PopupMenuImpl.cpp | 
| @@ -27,13 +27,15 @@ | 
| namespace blink { | 
| -class PopupMenuCSSFontSelector : public CSSFontSelector { | 
| +class PopupMenuCSSFontSelector : public CSSFontSelector, private CSSFontSelectorClient { | 
| public: | 
| static PassRefPtrWillBeRawPtr<PopupMenuCSSFontSelector> create(Document* document, CSSFontSelector* ownerFontSelector) | 
| { | 
| return adoptRefWillBeNoop(new PopupMenuCSSFontSelector(document, ownerFontSelector)); | 
| } | 
| + ~PopupMenuCSSFontSelector(); | 
| + | 
| // We don't override willUseFontData() for now because the old PopupListBox | 
| // only worked with fonts loaded when opening the popup. | 
| virtual PassRefPtr<FontData> getFontData(const FontDescription&, const AtomicString&) override; | 
| @@ -41,23 +43,42 @@ public: | 
| DECLARE_VIRTUAL_TRACE(); | 
| private: | 
| - PopupMenuCSSFontSelector(Document* document, CSSFontSelector* ownerFontSelector) | 
| - : CSSFontSelector(document) | 
| - , m_ownerFontSelector(ownerFontSelector) | 
| - { | 
| - } | 
| + PopupMenuCSSFontSelector(Document*, CSSFontSelector*); | 
| + | 
| + virtual void fontsNeedUpdate(CSSFontSelector*) override; | 
| + | 
| RefPtrWillBeMember<CSSFontSelector> m_ownerFontSelector; | 
| }; | 
| +PopupMenuCSSFontSelector::PopupMenuCSSFontSelector(Document* document, CSSFontSelector* ownerFontSelector) | 
| + : CSSFontSelector(document) | 
| + , m_ownerFontSelector(ownerFontSelector) | 
| +{ | 
| + m_ownerFontSelector->registerForInvalidationCallbacks(this); | 
| +} | 
| + | 
| +PopupMenuCSSFontSelector::~PopupMenuCSSFontSelector() | 
| +{ | 
| +#if ENABLE(OILPAN) | 
| 
Kunihiko Sakamoto
2015/05/29 07:40:06
Should be #if !ENABLE(OILPAN).
 
keishi
2015/06/02 05:33:00
Done.
 | 
| + m_ownerFontSelector->unregisterForInvalidationCallbacks(this); | 
| +#endif | 
| +} | 
| + | 
| PassRefPtr<FontData> PopupMenuCSSFontSelector::getFontData(const FontDescription& description, const AtomicString& name) | 
| { | 
| return m_ownerFontSelector->getFontData(description, name); | 
| } | 
| +void PopupMenuCSSFontSelector::fontsNeedUpdate(CSSFontSelector* fontSelector) | 
| +{ | 
| + dispatchInvalidationCallbacks(); | 
| +} | 
| + | 
| DEFINE_TRACE(PopupMenuCSSFontSelector) | 
| { | 
| visitor->trace(m_ownerFontSelector); | 
| CSSFontSelector::trace(visitor); | 
| + CSSFontSelectorClient::trace(visitor); | 
| } | 
| PassRefPtrWillBeRawPtr<PopupMenuImpl> PopupMenuImpl::create(ChromeClientImpl* chromeClient, PopupMenuClient* client) |