Bug 1097615 - Add MOZ_OVERRIDE annotations to subclasses of gfxFont. r=jdaggett
authorJonathan Kew <jkew@mozilla.com>
Mon, 17 Nov 2014 09:59:50 +0000
changeset 228263 5e993b51246b8752893c4f4e39f259bd0ec239e6
parent 228262 e98e2ac200a67aacbe2570c4963f30711ce10560
child 228264 43550a3c2c488a8d2314bccfe3401dec8d477a77
push idunknown
push userunknown
push dateunknown
reviewersjdaggett
bugs1097615
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1097615 - Add MOZ_OVERRIDE annotations to subclasses of gfxFont. r=jdaggett
gfx/thebes/gfxDWriteFonts.cpp
gfx/thebes/gfxDWriteFonts.h
gfx/thebes/gfxFT2FontBase.h
gfx/thebes/gfxGDIFont.h
gfx/thebes/gfxMacFont.h
--- a/gfx/thebes/gfxDWriteFonts.cpp
+++ b/gfx/thebes/gfxDWriteFonts.cpp
@@ -464,17 +464,17 @@ gfxDWriteFont::SetupCairoFont(gfxContext
         // the cairo_t, precluding any further drawing.
         return false;
     }
     cairo_set_scaled_font(aContext->GetCairo(), scaledFont);
     return true;
 }
 
 bool
-gfxDWriteFont::IsValid()
+gfxDWriteFont::IsValid() const
 {
     return mFontFace != nullptr;
 }
 
 IDWriteFontFace*
 gfxDWriteFont::GetFontFace()
 {
     return  mFontFace.get();
--- a/gfx/thebes/gfxDWriteFonts.h
+++ b/gfx/thebes/gfxDWriteFonts.h
@@ -23,60 +23,64 @@ class gfxDWriteFont : public gfxFont
 {
 public:
     gfxDWriteFont(gfxFontEntry *aFontEntry,
                   const gfxFontStyle *aFontStyle,
                   bool aNeedsBold = false,
                   AntialiasOption = kAntialiasDefault);
     ~gfxDWriteFont();
 
-    virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption);
+    virtual gfxFont*
+    CopyWithAntialiasOption(AntialiasOption anAAOption) MOZ_OVERRIDE;
 
-    virtual uint32_t GetSpaceGlyph();
+    virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE;
 
-    virtual bool SetupCairoFont(gfxContext *aContext);
+    virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
 
-    virtual bool AllowSubpixelAA() { return mAllowManualShowGlyphs; }
+    virtual bool AllowSubpixelAA() MOZ_OVERRIDE
+    { return mAllowManualShowGlyphs; }
 
-    virtual bool IsValid();
+    bool IsValid() const;
 
-    gfxFloat GetAdjustedSize() {
+    virtual gfxFloat GetAdjustedSize() const MOZ_OVERRIDE {
         return mAdjustedSize;
     }
 
     IDWriteFontFace *GetFontFace();
 
     /* override Measure to add padding for antialiasing */
     virtual RunMetrics Measure(gfxTextRun *aTextRun,
                                uint32_t aStart, uint32_t aEnd,
                                BoundingBoxType aBoundingBoxType,
                                gfxContext *aContextForTightBoundingBox,
                                Spacing *aSpacing,
-                               uint16_t aOrientation);
+                               uint16_t aOrientation) MOZ_OVERRIDE;
 
-    virtual bool ProvidesGlyphWidths() const;
+    virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE;
 
-    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
+    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
+                                  uint16_t aGID) MOZ_OVERRIDE;
 
     virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
-        GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
+    GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
 
     virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontCacheSizes* aSizes) const;
     virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontCacheSizes* aSizes) const;
 
     virtual FontType GetType() const { return FONT_TYPE_DWRITE; }
 
-    virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget);
+    virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
+    GetScaledFont(mozilla::gfx::DrawTarget *aTarget) MOZ_OVERRIDE;
 
-    virtual cairo_scaled_font_t *GetCairoScaledFont();
+    virtual cairo_scaled_font_t *GetCairoScaledFont() MOZ_OVERRIDE;
 
 protected:
-    virtual const Metrics& GetHorizontalMetrics();
+    virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE;
 
     bool GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics);
 
     void ComputeMetrics(AntialiasOption anAAOption);
 
     bool HasBitmapStrikeForSize(uint32_t aSize);
 
     cairo_font_face_t *CairoFontFace();
--- a/gfx/thebes/gfxFT2FontBase.h
+++ b/gfx/thebes/gfxFT2FontBase.h
@@ -16,31 +16,33 @@ public:
     gfxFT2FontBase(cairo_scaled_font_t *aScaledFont,
                    gfxFontEntry *aFontEntry,
                    const gfxFontStyle *aFontStyle);
     virtual ~gfxFT2FontBase();
 
     uint32_t GetGlyph(uint32_t aCharCode);
     void GetGlyphExtents(uint32_t aGlyph,
                          cairo_text_extents_t* aExtents);
-    virtual uint32_t GetSpaceGlyph();
-    virtual bool ProvidesGetGlyph() const { return true; }
-    virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector);
-    virtual bool ProvidesGlyphWidths() const { return true; }
-    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
+    virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE;
+    virtual bool ProvidesGetGlyph() const MOZ_OVERRIDE { return true; }
+    virtual uint32_t GetGlyph(uint32_t unicode,
+                              uint32_t variation_selector) MOZ_OVERRIDE;
+    virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE { return true; }
+    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
+                                  uint16_t aGID) MOZ_OVERRIDE;
 
     cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
-    virtual bool SetupCairoFont(gfxContext *aContext);
+    virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
 
-    virtual FontType GetType() const { return FONT_TYPE_FT2; }
+    virtual FontType GetType() const MOZ_OVERRIDE { return FONT_TYPE_FT2; }
 
     mozilla::gfx::FontOptions* GetFontOptions() { return &mFontOptions; }
 
 protected:
-    virtual const Metrics& GetHorizontalMetrics();
+    virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE;
 
     uint32_t mSpaceGlyph;
     bool mHasMetrics;
     Metrics mMetrics;
 
     // Azure font description
     mozilla::gfx::FontOptions  mFontOptions;
     void ConstructFontOptions();
--- a/gfx/thebes/gfxGDIFont.h
+++ b/gfx/thebes/gfxGDIFont.h
@@ -23,68 +23,77 @@ public:
                const gfxFontStyle *aFontStyle,
                bool aNeedsBold,
                AntialiasOption anAAOption = kAntialiasDefault);
 
     virtual ~gfxGDIFont();
 
     HFONT GetHFONT() { if (!mMetrics) Initialize(); return mFont; }
 
-    gfxFloat GetAdjustedSize() { if (!mMetrics) Initialize(); return mAdjustedSize; }
+    virtual gfxFloat GetAdjustedSize()
+    {
+        if (!mMetrics) {
+            Initialize();
+        }
+        return mAdjustedSize;
+    }
 
     cairo_font_face_t   *CairoFontFace() { return mFontFace; }
     cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }
 
     /* overrides for the pure virtual methods in gfxFont */
-    virtual uint32_t GetSpaceGlyph();
+    virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE;
 
-    virtual bool SetupCairoFont(gfxContext *aContext);
+    virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
 
     /* override Measure to add padding for antialiasing */
     virtual RunMetrics Measure(gfxTextRun *aTextRun,
                                uint32_t aStart, uint32_t aEnd,
                                BoundingBoxType aBoundingBoxType,
                                gfxContext *aContextForTightBoundingBox,
                                Spacing *aSpacing,
-                               uint16_t aOrientation);
+                               uint16_t aOrientation) MOZ_OVERRIDE;
 
     /* required for MathML to suppress effects of ClearType "padding" */
-    virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption);
+    virtual gfxFont*
+    CopyWithAntialiasOption(AntialiasOption anAAOption) MOZ_OVERRIDE;
 
     // If the font has a cmap table, we handle it purely with harfbuzz;
     // but if not (e.g. .fon fonts), we'll use a GDI callback to get glyphs.
-    virtual bool ProvidesGetGlyph() const {
+    virtual bool ProvidesGetGlyph() const MOZ_OVERRIDE {
         return !mFontEntry->HasCmapTable();
     }
 
-    virtual uint32_t GetGlyph(uint32_t aUnicode, uint32_t aVarSelector);
+    virtual uint32_t GetGlyph(uint32_t aUnicode,
+                              uint32_t aVarSelector) MOZ_OVERRIDE;
 
-    virtual bool ProvidesGlyphWidths() const { return true; }
+    virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE { return true; }
 
     // get hinted glyph width in pixels as 16.16 fixed-point value
-    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
+    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
+                                  uint16_t aGID) MOZ_OVERRIDE;
 
     virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontCacheSizes* aSizes) const;
     virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontCacheSizes* aSizes) const;
 
-    virtual FontType GetType() const { return FONT_TYPE_GDI; }
+    virtual FontType GetType() const MOZ_OVERRIDE { return FONT_TYPE_GDI; }
 
 protected:
-    virtual const Metrics& GetHorizontalMetrics();
+    virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE;
 
     /* override to ensure the cairo font is set up properly */
     virtual bool ShapeText(gfxContext     *aContext,
                            const char16_t *aText,
                            uint32_t        aOffset,
                            uint32_t        aLength,
                            int32_t         aScript,
                            bool            aVertical,
-                           gfxShapedText  *aShapedText);
+                           gfxShapedText  *aShapedText) MOZ_OVERRIDE;
 
     void Initialize(); // creates metrics and Cairo fonts
 
     // Fill the given LOGFONT record according to our style, but don't adjust
     // the lfItalic field if we're going to use a cairo transform for fake
     // italics.
     void FillLogFont(LOGFONTW& aLogFont, gfxFloat aSize, bool aUseGDIFakeItalic);
 
--- a/gfx/thebes/gfxMacFont.h
+++ b/gfx/thebes/gfxMacFont.h
@@ -19,63 +19,66 @@ public:
     gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
                bool aNeedsBold);
 
     virtual ~gfxMacFont();
 
     CGFontRef GetCGFontRef() const { return mCGFont; }
 
     /* overrides for the pure virtual methods in gfxFont */
-    virtual uint32_t GetSpaceGlyph() {
+    virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE {
         return mSpaceGlyph;
     }
 
-    virtual bool SetupCairoFont(gfxContext *aContext);
+    virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
 
     /* override Measure to add padding for antialiasing */
     virtual RunMetrics Measure(gfxTextRun *aTextRun,
                                uint32_t aStart, uint32_t aEnd,
                                BoundingBoxType aBoundingBoxType,
                                gfxContext *aContextForTightBoundingBox,
-                               Spacing *aSpacing, uint16_t aOrientation);
+                               Spacing *aSpacing,
+                               uint16_t aOrientation) MOZ_OVERRIDE;
 
     // We need to provide hinted (non-linear) glyph widths if using a font
     // with embedded color bitmaps (Apple Color Emoji), as Core Text renders
     // the glyphs with non-linear scaling at small pixel sizes.
-    virtual bool ProvidesGlyphWidths() const {
+    virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE {
         return mFontEntry->HasFontTable(TRUETYPE_TAG('s','b','i','x'));
     }
 
-    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
+    virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
+                                  uint16_t aGID) MOZ_OVERRIDE;
 
-    virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget);
+    virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
+    GetScaledFont(mozilla::gfx::DrawTarget *aTarget) MOZ_OVERRIDE;
 
     virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
       GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
 
     virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontCacheSizes* aSizes) const;
     virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontCacheSizes* aSizes) const;
 
-    virtual FontType GetType() const { return FONT_TYPE_MAC; }
+    virtual FontType GetType() const MOZ_OVERRIDE { return FONT_TYPE_MAC; }
 
 protected:
-    virtual const Metrics& GetHorizontalMetrics() {
+    virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE {
         return mMetrics;
     }
 
     // override to prefer CoreText shaping with fonts that depend on AAT
     virtual bool ShapeText(gfxContext     *aContext,
                            const char16_t *aText,
                            uint32_t        aOffset,
                            uint32_t        aLength,
                            int32_t         aScript,
                            bool            aVertical,
-                           gfxShapedText  *aShapedText);
+                           gfxShapedText  *aShapedText) MOZ_OVERRIDE;
 
     void InitMetrics();
     void InitMetricsFromPlatform();
 
     // Get width and glyph ID for a character; uses aConvFactor
     // to convert font units as returned by CG to actual dimensions
     gfxFloat GetCharWidth(CFDataRef aCmap, char16_t aUniChar,
                           uint32_t *aGlyphID, gfxFloat aConvFactor);