mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
Bug 1386915 - Add nsLookAndFeel::NativeInit() virtual call for initializing native-side state; r=jfkthame
MozReview-Commit-ID: 8XKSC1AOI0N
This commit is contained in:
parent
89df80e7d0
commit
b74c4d0f69
@ -9,6 +9,7 @@
|
||||
#include "gfxPlatformFontList.h"
|
||||
#include "mozilla/AutoRestyleTimelineMarker.h"
|
||||
#include "mozilla/DocumentStyleRootIterator.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/ServoStyleRuleMap.h"
|
||||
@ -260,6 +261,8 @@ ServoStyleSet::PreTraverseSync()
|
||||
|
||||
nsCSSRuleProcessor::InitSystemMetrics();
|
||||
|
||||
LookAndFeel::NativeInit();
|
||||
|
||||
// This is lazily computed and pseudo matching needs to access
|
||||
// it so force computation early.
|
||||
mPresContext->Document()->GetDocumentState();
|
||||
|
@ -618,6 +618,16 @@ public:
|
||||
*/
|
||||
static void Refresh();
|
||||
|
||||
/**
|
||||
* GTK's initialization code can't be run off main thread, call this
|
||||
* if you plan on using LookAndFeel off main thread later.
|
||||
*
|
||||
* This initialized state may get reset due to theme changes, so it
|
||||
* must be called prior to each potential off-main-thread LookAndFeel
|
||||
* call, not just once.
|
||||
*/
|
||||
static void NativeInit();
|
||||
|
||||
/**
|
||||
* If the implementation is caching values, these accessors allow the
|
||||
* cache to be exported and imported.
|
||||
|
@ -15,6 +15,7 @@ public:
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
|
||||
virtual void NativeInit() final {};
|
||||
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
|
||||
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
|
||||
virtual bool GetFontImpl(FontID aID, nsString& aName, gfxFontStyle& aStyle,
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
|
||||
virtual void NativeInit() final {};
|
||||
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
|
||||
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
|
||||
virtual bool GetFontImpl(FontID aID, nsString& aFontName,
|
||||
|
@ -54,6 +54,12 @@ nsLookAndFeel::nsLookAndFeel()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsLookAndFeel::NativeInit()
|
||||
{
|
||||
EnsureInit();
|
||||
}
|
||||
|
||||
nsLookAndFeel::~nsLookAndFeel()
|
||||
{
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
|
||||
virtual void NativeInit() final;
|
||||
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
|
||||
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
|
||||
virtual bool GetFontImpl(FontID aID, nsString& aFontName,
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
virtual ~HeadlessLookAndFeel();
|
||||
|
||||
virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
|
||||
virtual void NativeInit() final {};
|
||||
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
|
||||
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
|
||||
virtual bool GetFontImpl(FontID aID,
|
||||
|
@ -990,6 +990,13 @@ LookAndFeel::Refresh()
|
||||
nsLookAndFeel::GetInstance()->RefreshImpl();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
LookAndFeel::NativeInit()
|
||||
{
|
||||
nsLookAndFeel::GetInstance()->NativeInit();
|
||||
}
|
||||
|
||||
// static
|
||||
nsTArray<LookAndFeelInt>
|
||||
LookAndFeel::GetIntCache()
|
||||
|
@ -84,6 +84,8 @@ public:
|
||||
virtual nsTArray<LookAndFeelInt> GetIntCacheImpl();
|
||||
virtual void SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache) {}
|
||||
|
||||
virtual void NativeInit() = 0;
|
||||
|
||||
protected:
|
||||
nsXPLookAndFeel();
|
||||
|
||||
|
@ -15,6 +15,7 @@ public:
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
virtual nsresult NativeGetColor(const ColorID aID, nscolor &aResult);
|
||||
virtual void NativeInit() final {};
|
||||
virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
|
||||
virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
|
||||
virtual bool GetFontImpl(FontID aID, nsString& aFontName,
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
nsresult NativeGetColor(ColorID aID, nscolor &aResult) override;
|
||||
void NativeInit() final {};
|
||||
nsresult GetIntImpl(IntID aID, int32_t &aResult) override;
|
||||
nsresult GetFloatImpl(FloatID aID, float &aResult) override;
|
||||
bool GetFontImpl(FontID aID, nsString& aFontName,
|
||||
|
Loading…
x
Reference in New Issue
Block a user