Bug 1403690 Part 4: gtk rearrange header and implementation to keep init and refresh functions together. r=karlt
authorBrad Werth <bwerth@mozilla.com>
Tue, 10 Oct 2017 14:12:47 -0700
changeset 688095 4df8244690cf51becf42e70ce846c91c92e3780c
parent 688094 1570e72037e260c094b4db4cd3a3263ac6e990de
child 688096 436c11e3c38952bf698fe6e5a14f7376b7905a31
push id86669
push userhikezoe@mozilla.com
push dateSat, 28 Oct 2017 10:13:18 +0000
reviewerskarlt
bugs1403690
milestone58.0a1
Bug 1403690 Part 4: gtk rearrange header and implementation to keep init and refresh functions together. r=karlt MozReview-Commit-ID: ERsI916e7zf
widget/gtk/nsLookAndFeel.cpp
widget/gtk/nsLookAndFeel.h
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -48,22 +48,16 @@ using mozilla::LookAndFeel;
 nsLookAndFeel::nsLookAndFeel()
     : nsXPLookAndFeel(),
       mDefaultFontCached(false), mButtonFontCached(false),
       mFieldFontCached(false), mMenuFontCached(false),
       mInitialized(false)
 {
 }
 
-void
-nsLookAndFeel::NativeInit()
-{
-    EnsureInit();
-}
-
 nsLookAndFeel::~nsLookAndFeel()
 {
 }
 
 // Modifies color |*aDest| as if a pattern of color |aSource| was painted with
 // CAIRO_OPERATOR_OVER to a surface with color |*aDest|.
 static void
 ApplyColorOver(const GdkRGBA& aSource, GdkRGBA* aDest) {
@@ -215,16 +209,36 @@ GetBorderColors(GtkStyleContext* aContex
 {
     GdkRGBA lightColor, darkColor;
     bool ret = GetBorderColors(aContext, &lightColor, &darkColor);
     *aLightColor = GDK_RGBA_TO_NS_RGBA(lightColor);
     *aDarkColor = GDK_RGBA_TO_NS_RGBA(darkColor);
     return ret;
 }
 
+void
+nsLookAndFeel::NativeInit()
+{
+    EnsureInit();
+}
+
+void
+nsLookAndFeel::RefreshImpl()
+{
+    nsXPLookAndFeel::RefreshImpl();
+    moz_gtk_refresh();
+
+    mDefaultFontCached = false;
+    mButtonFontCached = false;
+    mFieldFontCached = false;
+    mMenuFontCached = false;
+
+    mInitialized = false;
+}
+
 nsresult
 nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
 {
     EnsureInit();
 
     nsresult res = NS_OK;
 
     switch (aID) {
@@ -1094,26 +1108,12 @@ nsLookAndFeel::EnsureInit()
 // virtual
 char16_t
 nsLookAndFeel::GetPasswordCharacterImpl()
 {
     EnsureInit();
     return sInvisibleCharacter;
 }
 
-void
-nsLookAndFeel::RefreshImpl()
-{
-    nsXPLookAndFeel::RefreshImpl();
-    moz_gtk_refresh();
-
-    mDefaultFontCached = false;
-    mButtonFontCached = false;
-    mFieldFontCached = false;
-    mMenuFontCached = false;
-
-    mInitialized = false;
-}
-
 bool
 nsLookAndFeel::GetEchoPasswordImpl() {
     return false;
 }
--- a/widget/gtk/nsLookAndFeel.h
+++ b/widget/gtk/nsLookAndFeel.h
@@ -15,25 +15,25 @@
 struct _GtkStyle;
 
 class nsLookAndFeel final : public nsXPLookAndFeel
 {
 public:
     nsLookAndFeel();
     virtual ~nsLookAndFeel();
 
+    virtual void NativeInit() final;
+    virtual void RefreshImpl();
     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,
                              gfxFontStyle& aFontStyle,
                              float aDevPixPerCSSPixel);
 
-    virtual void RefreshImpl();
     virtual char16_t GetPasswordCharacterImpl();
     virtual bool GetEchoPasswordImpl();
 
     bool IsCSDAvailable() const { return sCSDAvailable; }
 
 protected:
 
     // Cached fonts