Bug 966992 - Implement the overflow-clip-box property in the style system. r=cam

This commit is contained in:
Mats Palmgren 2014-02-19 14:14:52 +00:00
parent 4c31b88289
commit cf8fad51d8
12 changed files with 62 additions and 3 deletions

View File

@ -2479,6 +2479,18 @@ CSS_PROP_SHORTHAND(
Overflow,
CSS_PROPERTY_PARSE_FUNCTION,
"")
CSS_PROP_DISPLAY(
overflow-clip-box,
overflow_clip_box,
OverflowClipBox,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.overflow-clip-box.enabled",
VARIANT_HK,
kOverflowClipBoxKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_DISPLAY(
overflow-x,
overflow_x,

View File

@ -1422,6 +1422,12 @@ const KTableValue nsCSSProps::kOverflowKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const KTableValue nsCSSProps::kOverflowClipBoxKTable[] = {
eCSSKeyword_padding_box, NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX,
eCSSKeyword_content_box, NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX,
eCSSKeyword_UNKNOWN,-1
};
const KTableValue nsCSSProps::kOverflowSubKTable[] = {
eCSSKeyword_auto, NS_STYLE_OVERFLOW_AUTO,
eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE,

View File

@ -549,6 +549,7 @@ public:
static const KTableValue kOutlineColorKTable[];
static const KTableValue kOverflowKTable[];
static const KTableValue kOverflowSubKTable[];
static const KTableValue kOverflowClipBoxKTable[];
static const KTableValue kPageBreakKTable[];
static const KTableValue kPageBreakInsideKTable[];
static const KTableValue kPageMarksKTable[];

View File

@ -3752,6 +3752,16 @@ nsComputedDOMStyle::DoGetOverflowY()
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetOverflowClipBox()
{
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowClipBox,
nsCSSProps::kOverflowClipBoxKTable));
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetResize()
{

View File

@ -398,6 +398,7 @@ private:
mozilla::dom::CSSValue* DoGetOverflow();
mozilla::dom::CSSValue* DoGetOverflowX();
mozilla::dom::CSSValue* DoGetOverflowY();
mozilla::dom::CSSValue* DoGetOverflowClipBox();
mozilla::dom::CSSValue* DoGetResize();
mozilla::dom::CSSValue* DoGetPageBreakAfter();
mozilla::dom::CSSValue* DoGetPageBreakBefore();

View File

@ -162,6 +162,7 @@ COMPUTED_STYLE_PROP(outline_offset, OutlineOffset)
COMPUTED_STYLE_PROP(outline_style, OutlineStyle)
COMPUTED_STYLE_PROP(outline_width, OutlineWidth)
COMPUTED_STYLE_PROP(overflow, Overflow)
COMPUTED_STYLE_PROP(overflow_clip_box, OverflowClipBox)
COMPUTED_STYLE_PROP(overflow_x, OverflowX)
COMPUTED_STYLE_PROP(overflow_y, OverflowY)
//// COMPUTED_STYLE_PROP(padding, Padding)

View File

@ -5304,6 +5304,12 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
display->mOverflowY = NS_STYLE_OVERFLOW_AUTO;
}
SetDiscrete(*aRuleData->ValueForOverflowClipBox(), display->mOverflowClipBox,
canStoreInRuleTree,
SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
parentDisplay->mOverflowClipBox,
NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX, 0, 0, 0, 0);
SetDiscrete(*aRuleData->ValueForResize(), display->mResize, canStoreInRuleTree,
SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
parentDisplay->mResize,

View File

@ -569,14 +569,14 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_WIDTH_FIT_CONTENT 2
#define NS_STYLE_WIDTH_AVAILABLE 3
// See nsStylePosition.mPosition
// See nsStyleDisplay.mPosition
#define NS_STYLE_POSITION_STATIC 0
#define NS_STYLE_POSITION_RELATIVE 1
#define NS_STYLE_POSITION_ABSOLUTE 2
#define NS_STYLE_POSITION_FIXED 3
#define NS_STYLE_POSITION_STICKY 4
// See nsStylePosition.mClip
// See nsStyleDisplay.mClip
#define NS_STYLE_CLIP_AUTO 0x00
#define NS_STYLE_CLIP_RECT 0x01
#define NS_STYLE_CLIP_TYPE_MASK 0x0F
@ -597,7 +597,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_FRAME_SCROLL 7
#define NS_STYLE_FRAME_NOSCROLL 8
// See nsStylePosition.mOverflow
// See nsStyleDisplay.mOverflow
#define NS_STYLE_OVERFLOW_VISIBLE 0
#define NS_STYLE_OVERFLOW_HIDDEN 1
#define NS_STYLE_OVERFLOW_SCROLL 2
@ -606,6 +606,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL 5
#define NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL 6
// See nsStyleDisplay.mOverflowClipBox
#define NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX 0
#define NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX 1
// See nsStyleList
#define NS_STYLE_LIST_STYLE_NONE 0
#define NS_STYLE_LIST_STYLE_DISC 1

View File

@ -2278,6 +2278,7 @@ nsStyleDisplay::nsStyleDisplay()
mBreakAfter = false;
mOverflowX = NS_STYLE_OVERFLOW_VISIBLE;
mOverflowY = NS_STYLE_OVERFLOW_VISIBLE;
mOverflowClipBox = NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX;
mResize = NS_STYLE_RESIZE_NONE;
mClipFlags = NS_STYLE_CLIP_AUTO;
mClip.SetRect(0,0,0,0);
@ -2334,6 +2335,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
, mBreakAfter(aSource.mBreakAfter)
, mOverflowX(aSource.mOverflowX)
, mOverflowY(aSource.mOverflowY)
, mOverflowClipBox(aSource.mOverflowClipBox)
, mResize(aSource.mResize)
, mClipFlags(aSource.mClipFlags)
, mOrient(aSource.mOrient)
@ -2412,6 +2414,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mBreakAfter != aOther.mBreakAfter
|| mAppearance != aOther.mAppearance
|| mOrient != aOther.mOrient
|| mOverflowClipBox != aOther.mOverflowClipBox
|| mClipFlags != aOther.mClipFlags || !mClip.IsEqualInterior(aOther.mClip))
NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_AllReflowHints,
nsChangeHint_RepaintFrame));

View File

@ -1797,6 +1797,7 @@ struct nsStyleDisplay {
bool mBreakAfter; // [reset]
uint8_t mOverflowX; // [reset] see nsStyleConsts.h
uint8_t mOverflowY; // [reset] see nsStyleConsts.h
uint8_t mOverflowClipBox; // [reset] see nsStyleConsts.h
uint8_t mResize; // [reset] see nsStyleConsts.h
uint8_t mClipFlags; // [reset] see nsStyleConsts.h
uint8_t mOrient; // [reset] see nsStyleConsts.h

View File

@ -4915,6 +4915,17 @@ if (SpecialPowers.getBoolPref("layout.css.will-change.enabled")) {
};
}
if (SpecialPowers.getBoolPref("layout.css.overflow-clip-box.enabled")) {
gCSSProperties["overflow-clip-box"] = {
domProp: "overflowClipBox",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "padding-box" ],
other_values: [ "content-box" ],
invalid_values: [ "none", "auto", "border-box", "0" ]
};
}
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");

View File

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