Bug 1228501 patch 5 - Remove NS_FONT_DECORATION_* constants. r=jdaggett

Decorations in Gecko are associated with the CSS 'text-decoration'
property, so the constants should live in nsStyleConsts.h, as they
largely already do (since the names defined there are the vast majority
of the uses).
This commit is contained in:
L. David Baron 2015-11-29 23:15:37 -08:00
parent 9f6dab38dc
commit c3b8687f98
4 changed files with 13 additions and 17 deletions

View File

@ -143,9 +143,4 @@ protected:
#define NS_FONT_VARIANT_NORMAL 0
#define NS_FONT_VARIANT_SMALL_CAPS 1
#define NS_FONT_DECORATION_NONE 0x0
#define NS_FONT_DECORATION_UNDERLINE 0x1
#define NS_FONT_DECORATION_OVERLINE 0x2
#define NS_FONT_DECORATION_LINE_THROUGH 0x4
#endif /* nsFont_h___ */

View File

@ -801,9 +801,9 @@ enum class FillMode : uint32_t;
// See nsStyleText, nsStyleFont
#define NS_STYLE_TEXT_DECORATION_LINE_NONE 0
#define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE NS_FONT_DECORATION_UNDERLINE
#define NS_STYLE_TEXT_DECORATION_LINE_OVERLINE NS_FONT_DECORATION_OVERLINE
#define NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
#define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE 0x01
#define NS_STYLE_TEXT_DECORATION_LINE_OVERLINE 0x02
#define NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH 0x04
#define NS_STYLE_TEXT_DECORATION_LINE_BLINK 0x08
#define NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS 0x10
// OVERRIDE_ALL does not occur in stylesheets; it only comes from HTML

View File

@ -492,12 +492,12 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
// (We don't apply this rule to the access-key underline because we only
// find out where that is as a side effect of drawing the text, in the
// general case -- see below.)
if (decorations & (NS_FONT_DECORATION_OVERLINE |
NS_FONT_DECORATION_UNDERLINE)) {
if (decorations & (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE |
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE)) {
fontMet->GetUnderline(offset, size);
gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
Float sizePixel = presContext->AppUnitsToGfxUnits(size);
if ((decorations & NS_FONT_DECORATION_UNDERLINE) &&
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) &&
underStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
nsCSSRendering::PaintDecorationLine(this, *drawTarget,
ToRect(dirtyRect), underColor,
@ -506,7 +506,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, underStyle,
vertical);
}
if ((decorations & NS_FONT_DECORATION_OVERLINE) &&
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) &&
overStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
nsCSSRendering::PaintDecorationLine(this, *drawTarget,
ToRect(dirtyRect), overColor,
@ -586,7 +586,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
// Strikeout is drawn on top of the text, per
// http://www.w3.org/TR/CSS21/zindex.html point 7.2.1.4.1.1.
if ((decorations & NS_FONT_DECORATION_LINE_THROUGH) &&
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) &&
strikeStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
fontMet->GetStrikeout(offset, size);
gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);

View File

@ -3748,15 +3748,16 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
nscoord offset;
nscoord size;
if (decorations & (NS_FONT_DECORATION_OVERLINE | NS_FONT_DECORATION_UNDERLINE)) {
if (decorations & (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE |
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE)) {
fontMet->GetUnderline(offset, size);
if (decorations & NS_FONT_DECORATION_OVERLINE) {
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) {
nsRect r(textRect.x, textRect.y, textRect.width, size);
Rect devPxRect =
NSRectToSnappedRect(r, appUnitsPerDevPixel, *drawTarget);
drawTarget->FillRect(devPxRect, color);
}
if (decorations & NS_FONT_DECORATION_UNDERLINE) {
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) {
nsRect r(textRect.x, textRect.y + baseline - offset,
textRect.width, size);
Rect devPxRect =
@ -3764,7 +3765,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
drawTarget->FillRect(devPxRect, color);
}
}
if (decorations & NS_FONT_DECORATION_LINE_THROUGH) {
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) {
fontMet->GetStrikeout(offset, size);
nsRect r(textRect.x, textRect.y + baseline - offset, textRect.width, size);
Rect devPxRect =