diff --git a/dom/interfaces/css/nsIDOMCSS2Properties.idl b/dom/interfaces/css/nsIDOMCSS2Properties.idl index 2a968befb87..2942e572dfe 100644 --- a/dom/interfaces/css/nsIDOMCSS2Properties.idl +++ b/dom/interfaces/css/nsIDOMCSS2Properties.idl @@ -51,7 +51,7 @@ * http://www.w3.org/TR/DOM-Level-2-Style */ -[builtinclass, scriptable, uuid(519ae4fa-0fee-4aaa-bcb9-34b503236801)] +[builtinclass, scriptable, uuid(0a6fc4c6-a62a-4f52-9ab6-3d398b958843)] interface nsIDOMCSS2Properties : nsISupports { attribute DOMString background; @@ -764,4 +764,7 @@ interface nsIDOMCSS2Properties : nsISupports attribute DOMString MozAnimation; // raises(DOMException) on setting + + attribute DOMString MozTextSizeAdjust; + // raises(DOMException) on setting }; diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index 68985b6471d..7b0cec3c219 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -713,6 +713,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_HYPHENS_MANUAL 1 #define NS_STYLE_HYPHENS_AUTO 2 +// See nsStyleText +#define NS_STYLE_TEXT_SIZE_ADJUST_NONE 0 +#define NS_STYLE_TEXT_SIZE_ADJUST_AUTO 1 + // See nsStyleText #define NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT 0 diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index a075798442f..69268eee5a4 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2235,6 +2235,15 @@ CSS_PROP_TEXT( nsnull, offsetof(nsStyleText, mTextShadow), eStyleAnimType_Shadow) +CSS_PROP_TEXT( + -moz-text-size-adjust, + text_size_adjust, + CSS_PROP_DOMPROP_PREFIXED(TextSizeAdjust), + CSS_PROPERTY_PARSE_VALUE, + VARIANT_AUTO | VARIANT_NONE | VARIANT_INHERIT, + nsnull, + CSS_PROP_NO_OFFSET, + eStyleAnimType_None) CSS_PROP_TEXT( text-transform, text_transform, diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 5363e010fbe..a0eebfff543 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -2643,6 +2643,24 @@ nsComputedDOMStyle::DoGetHyphens() return val; } +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextSizeAdjust() +{ + nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); + switch (GetStyleText()->mTextSizeAdjust) { + default: + NS_NOTREACHED("unexpected value"); + // fall through + case NS_STYLE_TEXT_SIZE_ADJUST_AUTO: + val->SetIdent(eCSSKeyword_auto); + break; + case NS_STYLE_TEXT_SIZE_ADJUST_NONE: + val->SetIdent(eCSSKeyword_none); + break; + } + return val; +} + nsIDOMCSSValue* nsComputedDOMStyle::DoGetPointerEvents() { @@ -4579,6 +4597,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength) COMPUTED_STYLE_MAP_ENTRY(text_decoration_color, MozTextDecorationColor), COMPUTED_STYLE_MAP_ENTRY(text_decoration_line, MozTextDecorationLine), COMPUTED_STYLE_MAP_ENTRY(text_decoration_style, MozTextDecorationStyle), + COMPUTED_STYLE_MAP_ENTRY(text_size_adjust, TextSizeAdjust), COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_transform, MozTransform), COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_transform_origin, MozTransformOrigin), COMPUTED_STYLE_MAP_ENTRY(transform_style, MozTransformStyle), diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 37e95178631..d1a432136bd 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -322,6 +322,7 @@ private: nsIDOMCSSValue* DoGetWordWrap(); nsIDOMCSSValue* DoGetHyphens(); nsIDOMCSSValue* DoGetMozTabSize(); + nsIDOMCSSValue* DoGetTextSizeAdjust(); /* Visibility properties */ nsIDOMCSSValue* DoGetOpacity(); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 27336bf8ea5..2e7a332edad 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -3398,6 +3398,15 @@ nsRuleNode::ComputeTextData(void* aStartStruct, SETDSC_ENUMERATED, parentText->mHyphens, NS_STYLE_HYPHENS_MANUAL, 0, 0, 0, 0); + // text-size-adjust: none, auto, inherit, initial + SetDiscrete(*aRuleData->ValueForTextSizeAdjust(), text->mTextSizeAdjust, + canStoreInRuleTree, SETDSC_NONE | SETDSC_AUTO, + parentText->mTextSizeAdjust, + NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // initial value + NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // auto value + NS_STYLE_TEXT_SIZE_ADJUST_NONE, // none value + 0, 0); + COMPUTE_END_INHERITED(Text, text) } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 988070a0bd2..559b45d60ca 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2800,6 +2800,7 @@ nsStyleText::nsStyleText(void) mWhiteSpace = NS_STYLE_WHITESPACE_NORMAL; mWordWrap = NS_STYLE_WORDWRAP_NORMAL; mHyphens = NS_STYLE_HYPHENS_MANUAL; + mTextSizeAdjust = NS_STYLE_TEXT_SIZE_ADJUST_AUTO; mLetterSpacing.SetNormalValue(); mLineHeight.SetNormalValue(); @@ -2816,6 +2817,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource) mWhiteSpace(aSource.mWhiteSpace), mWordWrap(aSource.mWordWrap), mHyphens(aSource.mHyphens), + mTextSizeAdjust(aSource.mTextSizeAdjust), mTabSize(aSource.mTabSize), mLetterSpacing(aSource.mLetterSpacing), mLineHeight(aSource.mLineHeight), @@ -2843,6 +2845,7 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const (mWhiteSpace != aOther.mWhiteSpace) || (mWordWrap != aOther.mWordWrap) || (mHyphens != aOther.mHyphens) || + (mTextSizeAdjust != aOther.mTextSizeAdjust) || (mLetterSpacing != aOther.mLetterSpacing) || (mLineHeight != aOther.mLineHeight) || (mTextIndent != aOther.mTextIndent) || diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 332b089d570..d8114caec12 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1280,6 +1280,7 @@ struct nsStyleText { PRUint8 mWhiteSpace; // [inherited] see nsStyleConsts.h PRUint8 mWordWrap; // [inherited] see nsStyleConsts.h PRUint8 mHyphens; // [inherited] see nsStyleConsts.h + PRUint8 mTextSizeAdjust; // [inherited] see nsStyleConsts.h PRInt32 mTabSize; // [inherited] see nsStyleConsts.h nsStyleCoord mLetterSpacing; // [inherited] coord, normal diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 1e20b45c21b..7d7f231f566 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -925,6 +925,14 @@ var gCSSProperties = { other_values: [ "0", "3", "99", "12000" ], invalid_values: [ "-1", "-808", "3.0", "17.5" ] }, + "-moz-text-size-adjust": { + domProp: "MozTextSizeAdjust", + inherited: true, + type: CSS_TYPE_LONGHAND, + initial_values: [ "auto" ], + other_values: [ "none" ], + invalid_values: [ "-5%", "0", "100", "0%", "50%", "100%", "220.3%" ] + }, "-moz-transform": { domProp: "MozTransform", inherited: false,