Bug 968118. Make nsCSSProps keyword tables be int16_t instead of int32_t for a small space win. r=heycam

--HG--
extra : rebase_source : 94cf09d0d96dd3c8e2a9528f5d242e36e85fcf75
This commit is contained in:
Robert O'Callahan 2014-02-06 00:10:44 +13:00
parent b275242936
commit 1b8d891c71
8 changed files with 323 additions and 302 deletions

View File

@ -488,7 +488,8 @@ static void GetKeywordsForProperty(const nsCSSProperty aProperty,
// Shorthand props have no keywords. // Shorthand props have no keywords.
return; return;
} }
const int32_t *keywordTable = nsCSSProps::kKeywordTableTable[aProperty]; const nsCSSProps::KTableValue *keywordTable =
nsCSSProps::kKeywordTableTable[aProperty];
if (keywordTable && keywordTable != nsCSSProps::kBoxPropSourceKTable) { if (keywordTable && keywordTable != nsCSSProps::kBoxPropSourceKTable) {
size_t i = 0; size_t i = 0;
while (nsCSSKeyword(keywordTable[i]) != eCSSKeyword_UNKNOWN) { while (nsCSSKeyword(keywordTable[i]) != eCSSKeyword_UNKNOWN) {

View File

@ -48,6 +48,8 @@
using namespace mozilla; using namespace mozilla;
typedef nsCSSProps::KTableValue KTableValue;
const uint32_t const uint32_t
nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = { nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \ #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
@ -624,7 +626,8 @@ protected:
bool ParseFontSynthesis(nsCSSValue& aValue); bool ParseFontSynthesis(nsCSSValue& aValue);
bool ParseSingleAlternate(int32_t& aWhichFeature, nsCSSValue& aValue); bool ParseSingleAlternate(int32_t& aWhichFeature, nsCSSValue& aValue);
bool ParseFontVariantAlternates(nsCSSValue& aValue); bool ParseFontVariantAlternates(nsCSSValue& aValue);
bool ParseBitmaskValues(nsCSSValue& aValue, const int32_t aKeywordTable[], bool ParseBitmaskValues(nsCSSValue& aValue,
const KTableValue aKeywordTable[],
const int32_t aMasks[]); const int32_t aMasks[]);
bool ParseFontVariantEastAsian(nsCSSValue& aValue); bool ParseFontVariantEastAsian(nsCSSValue& aValue);
bool ParseFontVariantLigatures(nsCSSValue& aValue); bool ParseFontVariantLigatures(nsCSSValue& aValue);
@ -645,7 +648,8 @@ protected:
bool ParsePadding(); bool ParsePadding();
bool ParseQuotes(); bool ParseQuotes();
bool ParseSize(); bool ParseSize();
bool ParseTextAlign(nsCSSValue& aValue, const int32_t aTable[]); bool ParseTextAlign(nsCSSValue& aValue,
const KTableValue aTable[]);
bool ParseTextAlign(nsCSSValue& aValue); bool ParseTextAlign(nsCSSValue& aValue);
bool ParseTextAlignLast(nsCSSValue& aValue); bool ParseTextAlignLast(nsCSSValue& aValue);
bool ParseTextDecoration(); bool ParseTextDecoration();
@ -751,16 +755,17 @@ protected:
// after the opacity // after the opacity
bool ParseColorOpacity(uint8_t& aOpacity); bool ParseColorOpacity(uint8_t& aOpacity);
bool ParseColorOpacity(float& aOpacity); bool ParseColorOpacity(float& aOpacity);
bool ParseEnum(nsCSSValue& aValue, const int32_t aKeywordTable[]); bool ParseEnum(nsCSSValue& aValue,
const KTableValue aKeywordTable[]);
bool ParseVariant(nsCSSValue& aValue, bool ParseVariant(nsCSSValue& aValue,
int32_t aVariantMask, int32_t aVariantMask,
const int32_t aKeywordTable[]); const KTableValue aKeywordTable[]);
bool ParseNonNegativeVariant(nsCSSValue& aValue, bool ParseNonNegativeVariant(nsCSSValue& aValue,
int32_t aVariantMask, int32_t aVariantMask,
const int32_t aKeywordTable[]); const KTableValue aKeywordTable[]);
bool ParseOneOrLargerVariant(nsCSSValue& aValue, bool ParseOneOrLargerVariant(nsCSSValue& aValue,
int32_t aVariantMask, int32_t aVariantMask,
const int32_t aKeywordTable[]); const KTableValue aKeywordTable[]);
bool ParseCounter(nsCSSValue& aValue); bool ParseCounter(nsCSSValue& aValue);
bool ParseAttr(nsCSSValue& aValue); bool ParseAttr(nsCSSValue& aValue);
bool SetValueToURL(nsCSSValue& aValue, const nsString& aURL); bool SetValueToURL(nsCSSValue& aValue, const nsString& aURL);
@ -5871,7 +5876,7 @@ static const nsCSSProperty kColumnRuleIDs[] = {
bool bool
CSSParserImpl::ParseEnum(nsCSSValue& aValue, CSSParserImpl::ParseEnum(nsCSSValue& aValue,
const int32_t aKeywordTable[]) const KTableValue aKeywordTable[])
{ {
nsSubstring* ident = NextIdent(); nsSubstring* ident = NextIdent();
if (nullptr == ident) { if (nullptr == ident) {
@ -6020,7 +6025,7 @@ CSSParserImpl::TranslateDimension(nsCSSValue& aValue,
bool bool
CSSParserImpl::ParseNonNegativeVariant(nsCSSValue& aValue, CSSParserImpl::ParseNonNegativeVariant(nsCSSValue& aValue,
int32_t aVariantMask, int32_t aVariantMask,
const int32_t aKeywordTable[]) const KTableValue aKeywordTable[])
{ {
// The variant mask must only contain non-numeric variants or the ones // The variant mask must only contain non-numeric variants or the ones
// that we specifically handle. // that we specifically handle.
@ -6062,7 +6067,7 @@ CSSParserImpl::ParseNonNegativeVariant(nsCSSValue& aValue,
bool bool
CSSParserImpl::ParseOneOrLargerVariant(nsCSSValue& aValue, CSSParserImpl::ParseOneOrLargerVariant(nsCSSValue& aValue,
int32_t aVariantMask, int32_t aVariantMask,
const int32_t aKeywordTable[]) const KTableValue aKeywordTable[])
{ {
// The variant mask must only contain non-numeric variants or the ones // The variant mask must only contain non-numeric variants or the ones
// that we specifically handle. // that we specifically handle.
@ -6092,7 +6097,7 @@ CSSParserImpl::ParseOneOrLargerVariant(nsCSSValue& aValue,
bool bool
CSSParserImpl::ParseVariant(nsCSSValue& aValue, CSSParserImpl::ParseVariant(nsCSSValue& aValue,
int32_t aVariantMask, int32_t aVariantMask,
const int32_t aKeywordTable[]) const KTableValue aKeywordTable[])
{ {
NS_ASSERTION(!(mHashlessColorQuirk && (aVariantMask & VARIANT_COLOR)) || NS_ASSERTION(!(mHashlessColorQuirk && (aVariantMask & VARIANT_COLOR)) ||
!(aVariantMask & VARIANT_NUMBER), !(aVariantMask & VARIANT_NUMBER),
@ -7947,7 +7952,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
aPropID == eCSSProperty_math_display)) aPropID == eCSSProperty_math_display))
return false; return false;
const int32_t *kwtable = nsCSSProps::kKeywordTableTable[aPropID]; const KTableValue *kwtable = nsCSSProps::kKeywordTableTable[aPropID];
switch (nsCSSProps::ValueRestrictions(aPropID)) { switch (nsCSSProps::ValueRestrictions(aPropID)) {
default: default:
NS_ABORT_IF_FALSE(false, "should not be reached"); NS_ABORT_IF_FALSE(false, "should not be reached");
@ -9714,7 +9719,7 @@ CSSParserImpl::ParseContent()
{ {
// We need to divide the 'content' keywords into two classes for // We need to divide the 'content' keywords into two classes for
// ParseVariant's sake, so we can't just use nsCSSProps::kContentKTable. // ParseVariant's sake, so we can't just use nsCSSProps::kContentKTable.
static const int32_t kContentListKWs[] = { static const KTableValue kContentListKWs[] = {
eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE, eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE,
eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE, eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE,
eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE, eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE,
@ -9722,7 +9727,7 @@ CSSParserImpl::ParseContent()
eCSSKeyword_UNKNOWN,-1 eCSSKeyword_UNKNOWN,-1
}; };
static const int32_t kContentSolitaryKWs[] = { static const KTableValue kContentSolitaryKWs[] = {
eCSSKeyword__moz_alt_content, NS_STYLE_CONTENT_ALT_CONTENT, eCSSKeyword__moz_alt_content, NS_STYLE_CONTENT_ALT_CONTENT,
eCSSKeyword_UNKNOWN,-1 eCSSKeyword_UNKNOWN,-1
}; };
@ -10164,7 +10169,7 @@ CSSParserImpl::ParseFontVariantAlternates(nsCSSValue& aValue)
bool bool
CSSParserImpl::ParseBitmaskValues(nsCSSValue& aValue, CSSParserImpl::ParseBitmaskValues(nsCSSValue& aValue,
const int32_t aKeywordTable[], const KTableValue aKeywordTable[],
const int32_t aMasks[]) const int32_t aMasks[])
{ {
if (!ParseVariant(aValue, VARIANT_HMK, aKeywordTable)) { if (!ParseVariant(aValue, VARIANT_HMK, aKeywordTable)) {
@ -10927,7 +10932,7 @@ CSSParserImpl::ParseTextDecoration()
eDecorationBlink | eDecorationPrefAnchors), eDecorationBlink | eDecorationPrefAnchors),
"text decoration constants need to be bitmasks"); "text decoration constants need to be bitmasks");
static const int32_t kTextDecorationKTable[] = { static const KTableValue kTextDecorationKTable[] = {
eCSSKeyword_none, eDecorationNone, eCSSKeyword_none, eDecorationNone,
eCSSKeyword_underline, eDecorationUnderline, eCSSKeyword_underline, eDecorationUnderline,
eCSSKeyword_overline, eDecorationOverline, eCSSKeyword_overline, eDecorationOverline,
@ -10991,7 +10996,7 @@ CSSParserImpl::ParseTextDecoration()
} }
bool bool
CSSParserImpl::ParseTextAlign(nsCSSValue& aValue, const int32_t aTable[]) CSSParserImpl::ParseTextAlign(nsCSSValue& aValue, const KTableValue aTable[])
{ {
if (ParseVariant(aValue, VARIANT_INHERIT, nullptr)) { if (ParseVariant(aValue, VARIANT_INHERIT, nullptr)) {
// 'inherit', 'initial' and 'unset' must be alone // 'inherit', 'initial' and 'unset' must be alone
@ -12389,7 +12394,7 @@ CSSParserImpl::ParsePaintOrder()
((1 << NS_STYLE_PAINT_ORDER_BITWIDTH) > NS_STYLE_PAINT_ORDER_LAST_VALUE, ((1 << NS_STYLE_PAINT_ORDER_BITWIDTH) > NS_STYLE_PAINT_ORDER_LAST_VALUE,
"bitfield width insufficient for paint-order constants"); "bitfield width insufficient for paint-order constants");
static const int32_t kPaintOrderKTable[] = { static const KTableValue kPaintOrderKTable[] = {
eCSSKeyword_normal, NS_STYLE_PAINT_ORDER_NORMAL, eCSSKeyword_normal, NS_STYLE_PAINT_ORDER_NORMAL,
eCSSKeyword_fill, NS_STYLE_PAINT_ORDER_FILL, eCSSKeyword_fill, NS_STYLE_PAINT_ORDER_FILL,
eCSSKeyword_stroke, NS_STYLE_PAINT_ORDER_STROKE, eCSSKeyword_stroke, NS_STYLE_PAINT_ORDER_STROKE,

File diff suppressed because it is too large Load Diff

View File

@ -243,6 +243,8 @@ enum nsStyleAnimType {
class nsCSSProps { class nsCSSProps {
public: public:
typedef int16_t KTableValue;
static void AddRefTable(void); static void AddRefTable(void);
static void ReleaseTable(void); static void ReleaseTable(void);
@ -298,19 +300,23 @@ public:
// Returns the index of |aKeyword| in |aTable|, if it exists there; // Returns the index of |aKeyword| in |aTable|, if it exists there;
// otherwise, returns -1. // otherwise, returns -1.
// NOTE: Generally, clients should call FindKeyword() instead of this method. // NOTE: Generally, clients should call FindKeyword() instead of this method.
static int32_t FindIndexOfKeyword(nsCSSKeyword aKeyword, const int32_t aTable[]); static int32_t FindIndexOfKeyword(nsCSSKeyword aKeyword,
const KTableValue aTable[]);
// Find |aKeyword| in |aTable|, if found set |aValue| to its corresponding value. // Find |aKeyword| in |aTable|, if found set |aValue| to its corresponding value.
// If not found, return false and do not set |aValue|. // If not found, return false and do not set |aValue|.
static bool FindKeyword(nsCSSKeyword aKeyword, const int32_t aTable[], int32_t& aValue); static bool FindKeyword(nsCSSKeyword aKeyword, const KTableValue aTable[],
int32_t& aValue);
// Return the first keyword in |aTable| that has the corresponding value |aValue|. // Return the first keyword in |aTable| that has the corresponding value |aValue|.
// Return |eCSSKeyword_UNKNOWN| if not found. // Return |eCSSKeyword_UNKNOWN| if not found.
static nsCSSKeyword ValueToKeywordEnum(int32_t aValue, const int32_t aTable[]); static nsCSSKeyword ValueToKeywordEnum(int32_t aValue,
const KTableValue aTable[]);
// Ditto but as a string, return "" when not found. // Ditto but as a string, return "" when not found.
static const nsAFlatCString& ValueToKeyword(int32_t aValue, const int32_t aTable[]); static const nsAFlatCString& ValueToKeyword(int32_t aValue,
const KTableValue aTable[]);
static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands]; static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands];
static const int32_t* const kKeywordTableTable[eCSSProperty_COUNT_no_shorthands]; static const KTableValue* const kKeywordTableTable[eCSSProperty_COUNT_no_shorthands];
static const nsStyleAnimType kAnimTypeTable[eCSSProperty_COUNT_no_shorthands]; static const nsStyleAnimType kAnimTypeTable[eCSSProperty_COUNT_no_shorthands];
static const ptrdiff_t static const ptrdiff_t
kStyleStructOffsetTable[eCSSProperty_COUNT_no_shorthands]; kStyleStructOffsetTable[eCSSProperty_COUNT_no_shorthands];
@ -438,145 +444,145 @@ public:
if (nsCSSProps::IsEnabled(*iter_)) if (nsCSSProps::IsEnabled(*iter_))
// Keyword/Enum value tables // Keyword/Enum value tables
static const int32_t kAnimationDirectionKTable[]; static const KTableValue kAnimationDirectionKTable[];
static const int32_t kAnimationFillModeKTable[]; static const KTableValue kAnimationFillModeKTable[];
static const int32_t kAnimationIterationCountKTable[]; static const KTableValue kAnimationIterationCountKTable[];
static const int32_t kAnimationPlayStateKTable[]; static const KTableValue kAnimationPlayStateKTable[];
static const int32_t kAnimationTimingFunctionKTable[]; static const KTableValue kAnimationTimingFunctionKTable[];
static const int32_t kAppearanceKTable[]; static const KTableValue kAppearanceKTable[];
static const int32_t kAzimuthKTable[]; static const KTableValue kAzimuthKTable[];
static const int32_t kBackfaceVisibilityKTable[]; static const KTableValue kBackfaceVisibilityKTable[];
static const int32_t kTransformStyleKTable[]; static const KTableValue kTransformStyleKTable[];
static const int32_t kBackgroundAttachmentKTable[]; static const KTableValue kBackgroundAttachmentKTable[];
static const int32_t kBackgroundInlinePolicyKTable[]; static const KTableValue kBackgroundInlinePolicyKTable[];
static const int32_t kBackgroundOriginKTable[]; static const KTableValue kBackgroundOriginKTable[];
static const int32_t kBackgroundPositionKTable[]; static const KTableValue kBackgroundPositionKTable[];
static const int32_t kBackgroundRepeatKTable[]; static const KTableValue kBackgroundRepeatKTable[];
static const int32_t kBackgroundRepeatPartKTable[]; static const KTableValue kBackgroundRepeatPartKTable[];
static const int32_t kBackgroundSizeKTable[]; static const KTableValue kBackgroundSizeKTable[];
static const int32_t kBlendModeKTable[]; static const KTableValue kBlendModeKTable[];
static const int32_t kBorderCollapseKTable[]; static const KTableValue kBorderCollapseKTable[];
static const int32_t kBorderColorKTable[]; static const KTableValue kBorderColorKTable[];
static const int32_t kBorderImageRepeatKTable[]; static const KTableValue kBorderImageRepeatKTable[];
static const int32_t kBorderImageSliceKTable[]; static const KTableValue kBorderImageSliceKTable[];
static const int32_t kBorderStyleKTable[]; static const KTableValue kBorderStyleKTable[];
static const int32_t kBorderWidthKTable[]; static const KTableValue kBorderWidthKTable[];
static const int32_t kBoxAlignKTable[]; static const KTableValue kBoxAlignKTable[];
static const int32_t kBoxDirectionKTable[]; static const KTableValue kBoxDirectionKTable[];
static const int32_t kBoxOrientKTable[]; static const KTableValue kBoxOrientKTable[];
static const int32_t kBoxPackKTable[]; static const KTableValue kBoxPackKTable[];
static const int32_t kDominantBaselineKTable[]; static const KTableValue kDominantBaselineKTable[];
static const int32_t kFillRuleKTable[]; static const KTableValue kFillRuleKTable[];
static const int32_t kFilterFunctionKTable[]; static const KTableValue kFilterFunctionKTable[];
static const int32_t kImageRenderingKTable[]; static const KTableValue kImageRenderingKTable[];
static const int32_t kShapeRenderingKTable[]; static const KTableValue kShapeRenderingKTable[];
static const int32_t kStrokeLinecapKTable[]; static const KTableValue kStrokeLinecapKTable[];
static const int32_t kStrokeLinejoinKTable[]; static const KTableValue kStrokeLinejoinKTable[];
static const int32_t kStrokeContextValueKTable[]; static const KTableValue kStrokeContextValueKTable[];
static const int32_t kVectorEffectKTable[]; static const KTableValue kVectorEffectKTable[];
static const int32_t kTextAnchorKTable[]; static const KTableValue kTextAnchorKTable[];
static const int32_t kTextRenderingKTable[]; static const KTableValue kTextRenderingKTable[];
static const int32_t kColorInterpolationKTable[]; static const KTableValue kColorInterpolationKTable[];
static const int32_t kColumnFillKTable[]; static const KTableValue kColumnFillKTable[];
static const int32_t kBoxPropSourceKTable[]; static const KTableValue kBoxPropSourceKTable[];
static const int32_t kBoxShadowTypeKTable[]; static const KTableValue kBoxShadowTypeKTable[];
static const int32_t kBoxSizingKTable[]; static const KTableValue kBoxSizingKTable[];
static const int32_t kCaptionSideKTable[]; static const KTableValue kCaptionSideKTable[];
static const int32_t kClearKTable[]; static const KTableValue kClearKTable[];
static const int32_t kColorKTable[]; static const KTableValue kColorKTable[];
static const int32_t kContentKTable[]; static const KTableValue kContentKTable[];
static const int32_t kCursorKTable[]; static const KTableValue kCursorKTable[];
static const int32_t kDirectionKTable[]; static const KTableValue kDirectionKTable[];
static const int32_t kDisplayKTable[]; static const KTableValue kDisplayKTable[];
static const int32_t kElevationKTable[]; static const KTableValue kElevationKTable[];
static const int32_t kEmptyCellsKTable[]; static const KTableValue kEmptyCellsKTable[];
static const int32_t kAlignContentKTable[]; static const KTableValue kAlignContentKTable[];
static const int32_t kAlignItemsKTable[]; static const KTableValue kAlignItemsKTable[];
static const int32_t kAlignSelfKTable[]; static const KTableValue kAlignSelfKTable[];
static const int32_t kFlexDirectionKTable[]; static const KTableValue kFlexDirectionKTable[];
static const int32_t kFlexWrapKTable[]; static const KTableValue kFlexWrapKTable[];
static const int32_t kJustifyContentKTable[]; static const KTableValue kJustifyContentKTable[];
static const int32_t kFloatKTable[]; static const KTableValue kFloatKTable[];
static const int32_t kFloatEdgeKTable[]; static const KTableValue kFloatEdgeKTable[];
static const int32_t kFontKTable[]; static const KTableValue kFontKTable[];
static const int32_t kFontKerningKTable[]; static const KTableValue kFontKerningKTable[];
static const int32_t kFontSizeKTable[]; static const KTableValue kFontSizeKTable[];
static const int32_t kFontSmoothingKTable[]; static const KTableValue kFontSmoothingKTable[];
static const int32_t kFontStretchKTable[]; static const KTableValue kFontStretchKTable[];
static const int32_t kFontStyleKTable[]; static const KTableValue kFontStyleKTable[];
static const int32_t kFontSynthesisKTable[]; static const KTableValue kFontSynthesisKTable[];
static const int32_t kFontVariantKTable[]; static const KTableValue kFontVariantKTable[];
static const int32_t kFontVariantAlternatesKTable[]; static const KTableValue kFontVariantAlternatesKTable[];
static const int32_t kFontVariantAlternatesFuncsKTable[]; static const KTableValue kFontVariantAlternatesFuncsKTable[];
static const int32_t kFontVariantCapsKTable[]; static const KTableValue kFontVariantCapsKTable[];
static const int32_t kFontVariantEastAsianKTable[]; static const KTableValue kFontVariantEastAsianKTable[];
static const int32_t kFontVariantLigaturesKTable[]; static const KTableValue kFontVariantLigaturesKTable[];
static const int32_t kFontVariantNumericKTable[]; static const KTableValue kFontVariantNumericKTable[];
static const int32_t kFontVariantPositionKTable[]; static const KTableValue kFontVariantPositionKTable[];
static const int32_t kFontWeightKTable[]; static const KTableValue kFontWeightKTable[];
static const int32_t kImageOrientationKTable[]; static const KTableValue kImageOrientationKTable[];
static const int32_t kImageOrientationFlipKTable[]; static const KTableValue kImageOrientationFlipKTable[];
static const int32_t kIMEModeKTable[]; static const KTableValue kIMEModeKTable[];
static const int32_t kLineHeightKTable[]; static const KTableValue kLineHeightKTable[];
static const int32_t kListStylePositionKTable[]; static const KTableValue kListStylePositionKTable[];
static const int32_t kListStyleKTable[]; static const KTableValue kListStyleKTable[];
static const int32_t kMaskTypeKTable[]; static const KTableValue kMaskTypeKTable[];
static const int32_t kMathVariantKTable[]; static const KTableValue kMathVariantKTable[];
static const int32_t kMathDisplayKTable[]; static const KTableValue kMathDisplayKTable[];
static const int32_t kContextOpacityKTable[]; static const KTableValue kContextOpacityKTable[];
static const int32_t kContextPatternKTable[]; static const KTableValue kContextPatternKTable[];
static const int32_t kOrientKTable[]; static const KTableValue kOrientKTable[];
static const int32_t kOutlineStyleKTable[]; static const KTableValue kOutlineStyleKTable[];
static const int32_t kOutlineColorKTable[]; static const KTableValue kOutlineColorKTable[];
static const int32_t kOverflowKTable[]; static const KTableValue kOverflowKTable[];
static const int32_t kOverflowSubKTable[]; static const KTableValue kOverflowSubKTable[];
static const int32_t kPageBreakKTable[]; static const KTableValue kPageBreakKTable[];
static const int32_t kPageBreakInsideKTable[]; static const KTableValue kPageBreakInsideKTable[];
static const int32_t kPageMarksKTable[]; static const KTableValue kPageMarksKTable[];
static const int32_t kPageSizeKTable[]; static const KTableValue kPageSizeKTable[];
static const int32_t kPitchKTable[]; static const KTableValue kPitchKTable[];
static const int32_t kPointerEventsKTable[]; static const KTableValue kPointerEventsKTable[];
// Not const because we modify its entries when the pref // Not const because we modify its entries when the pref
// "layout.css.sticky.enabled" changes: // "layout.css.sticky.enabled" changes:
static int32_t kPositionKTable[]; static KTableValue kPositionKTable[];
static const int32_t kRadialGradientShapeKTable[]; static const KTableValue kRadialGradientShapeKTable[];
static const int32_t kRadialGradientSizeKTable[]; static const KTableValue kRadialGradientSizeKTable[];
static const int32_t kRadialGradientLegacySizeKTable[]; static const KTableValue kRadialGradientLegacySizeKTable[];
static const int32_t kResizeKTable[]; static const KTableValue kResizeKTable[];
static const int32_t kSpeakKTable[]; static const KTableValue kSpeakKTable[];
static const int32_t kSpeakHeaderKTable[]; static const KTableValue kSpeakHeaderKTable[];
static const int32_t kSpeakNumeralKTable[]; static const KTableValue kSpeakNumeralKTable[];
static const int32_t kSpeakPunctuationKTable[]; static const KTableValue kSpeakPunctuationKTable[];
static const int32_t kSpeechRateKTable[]; static const KTableValue kSpeechRateKTable[];
static const int32_t kStackSizingKTable[]; static const KTableValue kStackSizingKTable[];
static const int32_t kTableLayoutKTable[]; static const KTableValue kTableLayoutKTable[];
// Not const because we modify its entries when the pref // Not const because we modify its entries when the pref
// "layout.css.text-align-true-value.enabled" changes: // "layout.css.text-align-true-value.enabled" changes:
static int32_t kTextAlignKTable[]; static KTableValue kTextAlignKTable[];
static int32_t kTextAlignLastKTable[]; static KTableValue kTextAlignLastKTable[];
static const int32_t kTextCombineHorizontalKTable[]; static const KTableValue kTextCombineHorizontalKTable[];
static const int32_t kTextDecorationLineKTable[]; static const KTableValue kTextDecorationLineKTable[];
static const int32_t kTextDecorationStyleKTable[]; static const KTableValue kTextDecorationStyleKTable[];
static const int32_t kTextOrientationKTable[]; static const KTableValue kTextOrientationKTable[];
static const int32_t kTextOverflowKTable[]; static const KTableValue kTextOverflowKTable[];
static const int32_t kTextTransformKTable[]; static const KTableValue kTextTransformKTable[];
static const int32_t kTouchActionKTable[]; static const KTableValue kTouchActionKTable[];
static const int32_t kTransitionTimingFunctionKTable[]; static const KTableValue kTransitionTimingFunctionKTable[];
static const int32_t kUnicodeBidiKTable[]; static const KTableValue kUnicodeBidiKTable[];
static const int32_t kUserFocusKTable[]; static const KTableValue kUserFocusKTable[];
static const int32_t kUserInputKTable[]; static const KTableValue kUserInputKTable[];
static const int32_t kUserModifyKTable[]; static const KTableValue kUserModifyKTable[];
static const int32_t kUserSelectKTable[]; static const KTableValue kUserSelectKTable[];
static const int32_t kVerticalAlignKTable[]; static const KTableValue kVerticalAlignKTable[];
static const int32_t kVisibilityKTable[]; static const KTableValue kVisibilityKTable[];
static const int32_t kVolumeKTable[]; static const KTableValue kVolumeKTable[];
static const int32_t kWhitespaceKTable[]; static const KTableValue kWhitespaceKTable[];
static const int32_t kWidthKTable[]; // also min-width, max-width static const KTableValue kWidthKTable[]; // also min-width, max-width
static const int32_t kWindowShadowKTable[]; static const KTableValue kWindowShadowKTable[];
static const int32_t kWordBreakKTable[]; static const KTableValue kWordBreakKTable[];
static const int32_t kWordWrapKTable[]; static const KTableValue kWordWrapKTable[];
static const int32_t kWritingModeKTable[]; static const KTableValue kWritingModeKTable[];
static const int32_t kHyphensKTable[]; static const KTableValue kHyphensKTable[];
}; };
#endif /* nsCSSProps_h___ */ #endif /* nsCSSProps_h___ */

View File

@ -1740,7 +1740,7 @@ nsComputedDOMStyle::DoGetFontVariantPosition()
CSSValue* CSSValue*
nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember, nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
uint32_t nsStyleBackground::* aCount, uint32_t nsStyleBackground::* aCount,
const int32_t aTable[]) const KTableValue aTable[])
{ {
const nsStyleBackground* bg = StyleBackground(); const nsStyleBackground* bg = StyleBackground();
@ -2847,7 +2847,7 @@ nsComputedDOMStyle::DoGetVerticalAlign()
CSSValue* CSSValue*
nsComputedDOMStyle::CreateTextAlignValue(uint8_t aAlign, bool aAlignTrue, nsComputedDOMStyle::CreateTextAlignValue(uint8_t aAlign, bool aAlignTrue,
const int32_t aTable[]) const KTableValue aTable[])
{ {
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue; nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
val->SetIdent(nsCSSProps::ValueToKeywordEnum(aAlign, aTable)); val->SetIdent(nsCSSProps::ValueToKeywordEnum(aAlign, aTable));
@ -4301,7 +4301,7 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
const nsStyleCoord& aCoord, const nsStyleCoord& aCoord,
bool aClampNegativeCalc, bool aClampNegativeCalc,
PercentageBaseGetter aPercentageBaseGetter, PercentageBaseGetter aPercentageBaseGetter,
const int32_t aTable[], const KTableValue aTable[],
nscoord aMinAppUnits, nscoord aMinAppUnits,
nscoord aMaxAppUnits) nscoord aMaxAppUnits)
{ {

View File

@ -68,6 +68,8 @@ class gfx3DMatrix;
class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration
{ {
public: public:
typedef nsCSSProps::KTableValue KTableValue;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle, NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle,
nsICSSDeclaration) nsICSSDeclaration)
@ -143,7 +145,7 @@ private:
// Helper method for DoGetTextAlign[Last]. // Helper method for DoGetTextAlign[Last].
mozilla::dom::CSSValue* CreateTextAlignValue(uint8_t aAlign, mozilla::dom::CSSValue* CreateTextAlignValue(uint8_t aAlign,
bool aAlignTrue, bool aAlignTrue,
const int32_t aTable[]); const KTableValue aTable[]);
// This indicates error by leaving mStyleContextHolder null. // This indicates error by leaving mStyleContextHolder null.
void UpdateCurrentStyleSources(bool aNeedsLayoutFlush); void UpdateCurrentStyleSources(bool aNeedsLayoutFlush);
void ClearCurrentStyleSources(); void ClearCurrentStyleSources();
@ -195,7 +197,7 @@ private:
mozilla::dom::CSSValue* GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember, mozilla::dom::CSSValue* GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
uint32_t nsStyleBackground::* aCount, uint32_t nsStyleBackground::* aCount,
const int32_t aTable[]); const KTableValue aTable[]);
void GetCSSGradientString(const nsStyleGradient* aGradient, void GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString); nsAString& aString);
@ -528,7 +530,7 @@ private:
const nsStyleCoord& aCoord, const nsStyleCoord& aCoord,
bool aClampNegativeCalc, bool aClampNegativeCalc,
PercentageBaseGetter aPercentageBaseGetter = nullptr, PercentageBaseGetter aPercentageBaseGetter = nullptr,
const int32_t aTable[] = nullptr, const KTableValue aTable[] = nullptr,
nscoord aMinAppUnits = nscoord_MIN, nscoord aMinAppUnits = nscoord_MIN,
nscoord aMaxAppUnits = nscoord_MAX); nscoord aMaxAppUnits = nscoord_MAX);

View File

@ -20,13 +20,13 @@
using namespace mozilla; using namespace mozilla;
static const int32_t kOrientationKeywords[] = { static const nsCSSProps::KTableValue kOrientationKeywords[] = {
eCSSKeyword_portrait, NS_STYLE_ORIENTATION_PORTRAIT, eCSSKeyword_portrait, NS_STYLE_ORIENTATION_PORTRAIT,
eCSSKeyword_landscape, NS_STYLE_ORIENTATION_LANDSCAPE, eCSSKeyword_landscape, NS_STYLE_ORIENTATION_LANDSCAPE,
eCSSKeyword_UNKNOWN, -1 eCSSKeyword_UNKNOWN, -1
}; };
static const int32_t kScanKeywords[] = { static const nsCSSProps::KTableValue kScanKeywords[] = {
eCSSKeyword_progressive, NS_STYLE_SCAN_PROGRESSIVE, eCSSKeyword_progressive, NS_STYLE_SCAN_PROGRESSIVE,
eCSSKeyword_interlace, NS_STYLE_SCAN_INTERLACE, eCSSKeyword_interlace, NS_STYLE_SCAN_INTERLACE,
eCSSKeyword_UNKNOWN, -1 eCSSKeyword_UNKNOWN, -1

View File

@ -9,6 +9,7 @@
#define nsMediaFeatures_h_ #define nsMediaFeatures_h_
#include "nsError.h" #include "nsError.h"
#include "nsCSSProps.h"
class nsIAtom; class nsIAtom;
class nsPresContext; class nsPresContext;
@ -53,7 +54,7 @@ struct nsMediaFeature {
const void* mInitializer_; const void* mInitializer_;
// If mValueType == eEnumerated: const int32_t*: keyword table in // If mValueType == eEnumerated: const int32_t*: keyword table in
// the same format as the keyword tables in nsCSSProps. // the same format as the keyword tables in nsCSSProps.
const int32_t* mKeywordTable; const nsCSSProps::KTableValue* mKeywordTable;
// If mGetter == GetSystemMetric (which implies mValueType == // If mGetter == GetSystemMetric (which implies mValueType ==
// eBoolInteger): nsIAtom * const *, for the system metric. // eBoolInteger): nsIAtom * const *, for the system metric.
nsIAtom * const * mMetric; nsIAtom * const * mMetric;