diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index f493633a9f6d..bd3c905fa901 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -48,6 +48,7 @@ nsFont::Init() sizeAdjust = -1.0f; kerning = NS_FONT_KERNING_AUTO; synthesis = NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE; + decorations = 0; variantAlternates = 0; variantCaps = NS_FONT_VARIANT_CAPS_NORMAL; @@ -64,6 +65,7 @@ nsFont::nsFont(const nsFont& aOther) systemFont = aOther.systemFont; weight = aOther.weight; stretch = aOther.stretch; + decorations = aOther.decorations; smoothing = aOther.smoothing; size = aOther.size; sizeAdjust = aOther.sizeAdjust; @@ -116,6 +118,15 @@ bool nsFont::BaseEquals(const nsFont& aOther) const return false; } +bool nsFont::Equals(const nsFont& aOther) const +{ + if (BaseEquals(aOther) && + (decorations == aOther.decorations)) { + return true; + } + return false; +} + nsFont& nsFont::operator=(const nsFont& aOther) { fontlist = aOther.fontlist; @@ -123,6 +134,7 @@ nsFont& nsFont::operator=(const nsFont& aOther) systemFont = aOther.systemFont; weight = aOther.weight; stretch = aOther.stretch; + decorations = aOther.decorations; smoothing = aOther.smoothing; size = aOther.size; sizeAdjust = aOther.sizeAdjust; diff --git a/gfx/src/nsFont.h b/gfx/src/nsFont.h index 68f1c2acb1ab..7b4137543985 100644 --- a/gfx/src/nsFont.h +++ b/gfx/src/nsFont.h @@ -66,6 +66,10 @@ struct nsFont { // -- bitmask for both enumerated and functional propvals uint16_t variantAlternates; + // The decorations on the font (underline, overline, + // line-through). The decorations can be binary or'd together. + uint8_t decorations; + // Smoothing - controls subpixel-antialiasing (currently OSX only) uint8_t smoothing; @@ -123,11 +127,8 @@ struct nsFont { return Equals(aOther); } - // FIXME (in patch 3): These are now the same. Remove BaseEquals! - bool Equals(const nsFont& aOther) const - { - return BaseEquals(aOther); - } + bool Equals(const nsFont& aOther) const ; + // Compare ignoring differences in 'variant' and 'decoration' bool BaseEquals(const nsFont& aOther) const; nsFont& operator=(const nsFont& aOther); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 7b3a3996db14..9fee0a12abb2 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -3413,6 +3413,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext, systemFont.systemFont = fontStyle.systemFont; systemFont.weight = fontStyle.weight; systemFont.stretch = fontStyle.stretch; + systemFont.decorations = NS_FONT_DECORATION_NONE; systemFont.size = NSFloatPixelsToAppUnits(fontStyle.size, aPresContext->DeviceContext()-> diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 59923d86b0d9..633c2bd35a68 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -251,7 +251,10 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont& (aFont1.fontFeatureSettings == aFont2.fontFeatureSettings) && (aFont1.languageOverride == aFont2.languageOverride) && (aFont1.systemFont == aFont2.systemFont)) { - return NS_STYLE_HINT_NONE; + if ((aFont1.decorations == aFont2.decorations)) { + return NS_STYLE_HINT_NONE; + } + return nsChangeHint_RepaintFrame; } return NS_STYLE_HINT_REFLOW; }