Bug 613659 - Implement box-decoration-break in the style system. r=cam

This commit is contained in:
Mats Palmgren 2014-04-17 12:11:07 +00:00
Родитель fcd7542b90
Коммит c2691dbe6c
12 изменённых файлов: 60 добавлений и 1 удалений

Просмотреть файл

@ -208,6 +208,7 @@ CSS_KEY(circle, circle)
CSS_KEY(cjk-decimal, cjk_decimal)
CSS_KEY(cjk-ideographic, cjk_ideographic)
CSS_KEY(clip, clip)
CSS_KEY(clone, clone)
CSS_KEY(close-quote, close_quote)
CSS_KEY(closest-corner, closest_corner)
CSS_KEY(closest-side, closest_side)
@ -496,6 +497,7 @@ CSS_KEY(skew, skew)
CSS_KEY(skewx, skewx)
CSS_KEY(skewy, skewy)
CSS_KEY(slashed-zero, slashed_zero)
CSS_KEY(slice, slice)
CSS_KEY(small, small)
CSS_KEY(small-caps, small_caps)
CSS_KEY(small-caption, small_caption)

Просмотреть файл

@ -1365,6 +1365,16 @@ CSS_PROP_POSITION(
nullptr,
offsetof(nsStylePosition, mOffset),
eStyleAnimType_Sides_Bottom)
CSS_PROP_BORDER(
box-decoration-break,
box_decoration_break,
BoxDecorationBreak,
CSS_PROPERTY_PARSE_VALUE,
"layout.css.box-decoration-break.enabled",
VARIANT_HK,
kBoxDecorationBreakKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_BORDER(
box-shadow,
box_shadow,

Просмотреть файл

@ -796,6 +796,12 @@ const KTableValue nsCSSProps::kBoxPropSourceKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const KTableValue nsCSSProps::kBoxDecorationBreakKTable[] = {
eCSSKeyword_slice, NS_STYLE_BOX_DECORATION_BREAK_SLICE,
eCSSKeyword_clone, NS_STYLE_BOX_DECORATION_BREAK_CLONE,
eCSSKeyword_UNKNOWN,-1
};
const KTableValue nsCSSProps::kBoxShadowTypeKTable[] = {
eCSSKeyword_inset, NS_STYLE_BOX_SHADOW_INSET,
eCSSKeyword_UNKNOWN,-1

Просмотреть файл

@ -520,6 +520,7 @@ public:
static const KTableValue kBorderStyleKTable[];
static const KTableValue kBorderWidthKTable[];
static const KTableValue kBoxAlignKTable[];
static const KTableValue kBoxDecorationBreakKTable[];
static const KTableValue kBoxDirectionKTable[];
static const KTableValue kBoxOrientKTable[];
static const KTableValue kBoxPackKTable[];

Просмотреть файл

@ -2980,6 +2980,16 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray,
return valueList;
}
CSSValue*
nsComputedDOMStyle::DoGetBoxDecorationBreak()
{
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleBorder()->mBoxDecorationBreak,
nsCSSProps::kBoxDecorationBreakKTable));
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetBoxShadow()
{

Просмотреть файл

@ -222,6 +222,7 @@ private:
/* Box properties */
mozilla::dom::CSSValue* DoGetBoxAlign();
mozilla::dom::CSSValue* DoGetBoxDecorationBreak();
mozilla::dom::CSSValue* DoGetBoxDirection();
mozilla::dom::CSSValue* DoGetBoxFlex();
mozilla::dom::CSSValue* DoGetBoxOrdinalGroup();

Просмотреть файл

@ -6445,6 +6445,13 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
{
COMPUTE_START_RESET(Border, (mPresContext), border, parentBorder)
// box-decoration-break: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForBoxDecorationBreak(),
border->mBoxDecorationBreak, canStoreInRuleTree,
SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
parentBorder->mBoxDecorationBreak,
NS_STYLE_BOX_DECORATION_BREAK_SLICE, 0, 0, 0, 0);
// box-shadow: none, list, inherit, initial
const nsCSSValue* boxShadowValue = aRuleData->ValueForBoxShadow();
switch (boxShadowValue->GetUnit()) {

Просмотреть файл

@ -117,6 +117,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_BOX_PACK_END 2
#define NS_STYLE_BOX_PACK_JUSTIFY 3
// box-decoration-break
#define NS_STYLE_BOX_DECORATION_BREAK_SLICE 0
#define NS_STYLE_BOX_DECORATION_BREAK_CLONE 1
// box-direction
#define NS_STYLE_BOX_DIRECTION_NORMAL 0
#define NS_STYLE_BOX_DIRECTION_REVERSE 1

Просмотреть файл

@ -388,6 +388,7 @@ nsStyleBorder::nsStyleBorder(nsPresContext* aPresContext)
mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH),
mBorderImageRepeatV(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH),
mFloatEdge(NS_STYLE_FLOAT_EDGE_CONTENT),
mBoxDecorationBreak(NS_STYLE_BOX_DECORATION_BREAK_SLICE),
mComputedBorder(0, 0, 0, 0)
{
MOZ_COUNT_CTOR(nsStyleBorder);
@ -439,6 +440,7 @@ nsStyleBorder::nsStyleBorder(const nsStyleBorder& aSrc)
mBorderImageRepeatH(aSrc.mBorderImageRepeatH),
mBorderImageRepeatV(aSrc.mBorderImageRepeatV),
mFloatEdge(aSrc.mFloatEdge),
mBoxDecorationBreak(aSrc.mBoxDecorationBreak),
mComputedBorder(aSrc.mComputedBorder),
mBorder(aSrc.mBorder),
mTwipsPerPixel(aSrc.mTwipsPerPixel)
@ -528,7 +530,8 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
GetComputedBorder() != aOther.GetComputedBorder() ||
mFloatEdge != aOther.mFloatEdge ||
mBorderImageOutset != aOther.mBorderImageOutset ||
(shadowDifference & nsChangeHint_NeedReflow))
(shadowDifference & nsChangeHint_NeedReflow) ||
mBoxDecorationBreak != aOther.mBoxDecorationBreak)
return NS_STYLE_HINT_REFLOW;
NS_FOR_CSS_SIDES(ix) {

Просмотреть файл

@ -986,6 +986,7 @@ public:
uint8_t mBorderImageRepeatH; // [reset] see nsStyleConsts.h
uint8_t mBorderImageRepeatV; // [reset]
uint8_t mFloatEdge; // [reset]
uint8_t mBoxDecorationBreak; // [reset] see nsStyleConsts.h
protected:
// mComputedBorder holds the CSS2.1 computed border-width values.

Просмотреть файл

@ -5387,6 +5387,17 @@ if (SpecialPowers.getBoolPref("layout.css.overflow-clip-box.enabled")) {
};
}
if (SpecialPowers.getBoolPref("layout.css.box-decoration-break.enabled")) {
gCSSProperties["box-decoration-break"] = {
domProp: "boxDecorationBreak",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "slice" ],
other_values: [ "clone" ],
invalid_values: [ "auto", "none", "1px" ]
};
}
if (SpecialPowers.getBoolPref("layout.css.unset-value.enabled")) {
gCSSProperties["animation-direction"].invalid_values.push("normal, unset");
gCSSProperties["animation-name"].invalid_values.push("bounce, unset", "unset, bounce");

Просмотреть файл

@ -1900,6 +1900,9 @@ pref("layout.css.variables.enabled", true);
// Is support for CSS overflow-clip-box enabled for non-UA sheets?
pref("layout.css.overflow-clip-box.enabled", false);
// Is support for CSS box-decoration-break enabled?
pref("layout.css.box-decoration-break.enabled", false);
// pref for which side vertical scrollbars should be on
// 0 = end-side in UI direction
// 1 = end-side in document/content direction