Bug 655065 - Add a -moz-orient CSS property. r=bz

This commit is contained in:
Mounir Lamouri 2011-05-10 15:47:46 +02:00
parent 3ea309cc44
commit d58b2950df
11 changed files with 53 additions and 0 deletions

View File

@ -555,6 +555,9 @@ interface nsIDOMCSS2Properties : nsISupports
attribute DOMString MozOpacity;
// raises(DOMException) on setting
attribute DOMString MozOrient;
// raises(DOMException) on setting
attribute DOMString MozOutline;
// raises(DOMException) on setting

View File

@ -162,6 +162,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_BOX_ORIENT_HORIZONTAL 0
#define NS_STYLE_BOX_ORIENT_VERTICAL 1
// orient
#define NS_STYLE_ORIENT_HORIZONTAL 0
#define NS_STYLE_ORIENT_VERTICAL 1
// stack-sizing
#define NS_STYLE_STACK_SIZING_IGNORE 0
#define NS_STYLE_STACK_SIZING_STRETCH_TO_FIT 1

View File

@ -1813,6 +1813,15 @@ CSS_PROP_DISPLAY(
nsnull,
offsetof(nsStyleDisplay, mOpacity),
eStyleAnimType_float) // XXX bug 3935
CSS_PROP_DISPLAY(
-moz-orient,
orient,
CSS_PROP_DOMPROP_PREFIXED(Orient),
CSS_PROPERTY_PARSE_VALUE,
VARIANT_HK,
kOrientKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_BACKENDONLY(
orphans,
orphans,

View File

@ -1038,6 +1038,12 @@ const PRInt32 nsCSSProps::kListStyleKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const PRInt32 nsCSSProps::kOrientKTable[] = {
eCSSKeyword_horizontal, NS_STYLE_ORIENT_HORIZONTAL,
eCSSKeyword_vertical, NS_STYLE_ORIENT_VERTICAL,
eCSSKeyword_UNKNOWN, -1
};
// Same as kBorderStyleKTable except 'hidden'.
const PRInt32 nsCSSProps::kOutlineStyleKTable[] = {
eCSSKeyword_none, NS_STYLE_BORDER_STYLE_NONE,

View File

@ -383,6 +383,7 @@ public:
static const PRInt32 kLineHeightKTable[];
static const PRInt32 kListStylePositionKTable[];
static const PRInt32 kListStyleKTable[];
static const PRInt32 kOrientKTable[];
static const PRInt32 kOutlineStyleKTable[];
static const PRInt32 kOutlineColorKTable[];
static const PRInt32 kOverflowKTable[];

View File

@ -1912,6 +1912,16 @@ nsComputedDOMStyle::DoGetMarkerOffset()
return val;
}
nsIDOMCSSValue*
nsComputedDOMStyle::DoGetOrient()
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOrient,
nsCSSProps::kOrientKTable));
return val;
}
nsIDOMCSSValue*
nsComputedDOMStyle::DoGetOutline()
{
@ -4383,6 +4393,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
COMPUTED_STYLE_MAP_ENTRY(marker_end, MarkerEnd),
COMPUTED_STYLE_MAP_ENTRY(marker_mid, MarkerMid),
COMPUTED_STYLE_MAP_ENTRY(marker_start, MarkerStart),
COMPUTED_STYLE_MAP_ENTRY(orient, Orient),
COMPUTED_STYLE_MAP_ENTRY(shape_rendering, ShapeRendering),
COMPUTED_STYLE_MAP_ENTRY(stop_color, StopColor),
COMPUTED_STYLE_MAP_ENTRY(stop_opacity, StopOpacity),

View File

@ -346,6 +346,7 @@ private:
nsIDOMCSSValue* DoGetPageBreakBefore();
nsIDOMCSSValue* DoGetMozTransform();
nsIDOMCSSValue* DoGetMozTransformOrigin();
nsIDOMCSSValue* DoGetOrient();
/* User interface properties */
nsIDOMCSSValue* DoGetCursor();

View File

@ -4482,6 +4482,12 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
NS_ASSERTION(result, "Malformed -moz-transform-origin parse!");
}
// orient: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForOrient(),
display->mOrient, canStoreInRuleTree,
SETDSC_ENUMERATED, parentDisplay->mOrient,
NS_STYLE_ORIENT_HORIZONTAL, 0, 0, 0, 0);
COMPUTE_END_RESET(Display, display)
}

View File

@ -2029,6 +2029,7 @@ nsStyleDisplay::nsStyleDisplay()
mSpecifiedTransform = nsnull;
mTransformOrigin[0].SetPercentValue(0.5f); // Transform is centered on origin
mTransformOrigin[1].SetPercentValue(0.5f);
mOrient = NS_STYLE_ORIENT_HORIZONTAL;
mTransitions.AppendElement();
NS_ABORT_IF_FALSE(mTransitions.Length() == 1,
@ -2089,6 +2090,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
mClipFlags = aSource.mClipFlags;
mClip = aSource.mClip;
mOpacity = aSource.mOpacity;
mOrient = aSource.mOrient;
/* Copy over the transformation information. */
mSpecifiedTransform = aSource.mSpecifiedTransform;
@ -2127,6 +2129,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mBreakBefore != aOther.mBreakBefore
|| mBreakAfter != aOther.mBreakAfter
|| mAppearance != aOther.mAppearance
|| mOrient != aOther.mOrient
|| mClipFlags != aOther.mClipFlags || !mClip.IsEqualInterior(aOther.mClip))
NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_ReflowFrame, nsChangeHint_RepaintFrame));

View File

@ -1514,6 +1514,7 @@ struct nsStyleDisplay {
PRUint8 mOverflowY; // [reset] see nsStyleConsts.h
PRUint8 mResize; // [reset] see nsStyleConsts.h
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
PRUint8 mOrient; // [reset] see nsStyleConsts.h
// mSpecifiedTransform is the list of transform functions as
// specified, or null to indicate there is no transform. (inherit or

View File

@ -2161,6 +2161,14 @@ var gCSSProperties = {
other_values: [ "0", "0.4", "0.0000", "-3" ],
invalid_values: [ "0px", "1px" ]
},
"-moz-orient": {
domProp: "MozOrient",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "horizontal" ],
other_values: [ "vertical" ],
invalid_values: [ "auto", "none" ]
},
"orphans": {
domProp: "orphans",
inherited: true,