mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2136 - Part 1: Implement CSS inset property
This commit is contained in:
@@ -643,6 +643,7 @@ Declaration::GetPropertyValueInternal(
|
||||
|
||||
nsCSSCompressedDataBlock *data = importantCount ? mImportantData : mData;
|
||||
switch (aProperty) {
|
||||
case eCSSProperty_inset:
|
||||
case eCSSProperty_margin:
|
||||
case eCSSProperty_padding:
|
||||
case eCSSProperty_border_color:
|
||||
@@ -650,14 +651,18 @@ Declaration::GetPropertyValueInternal(
|
||||
case eCSSProperty_border_width: {
|
||||
const nsCSSPropertyID* subprops =
|
||||
nsCSSProps::SubpropertyEntryFor(aProperty);
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") !=
|
||||
kNotFound, "first subprop must be top");
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[1]).Find("-right") !=
|
||||
kNotFound, "second subprop must be right");
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") !=
|
||||
kNotFound, "third subprop must be bottom");
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[3]).Find("-left") !=
|
||||
kNotFound, "fourth subprop must be left");
|
||||
// These assertions don't apply to the inset shorthand because
|
||||
// they don't start with a dash and are simply just the sides.
|
||||
if (aProperty != eCSSProperty_inset) {
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") !=
|
||||
kNotFound, "first subprop must be top");
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[1]).Find("-right") !=
|
||||
kNotFound, "second subprop must be right");
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") !=
|
||||
kNotFound, "third subprop must be bottom");
|
||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[3]).Find("-left") !=
|
||||
kNotFound, "fourth subprop must be left");
|
||||
}
|
||||
const nsCSSValue* vals[4] = {
|
||||
data->ValueFor(subprops[0]),
|
||||
data->ValueFor(subprops[1]),
|
||||
|
||||
@@ -1045,6 +1045,7 @@ protected:
|
||||
bool ParseFontSrc(nsCSSValue& aValue);
|
||||
bool ParseFontSrcFormat(InfallibleTArray<nsCSSValue>& values);
|
||||
bool ParseFontRanges(nsCSSValue& aValue);
|
||||
bool ParseInset();
|
||||
bool ParseListStyle();
|
||||
bool ParseListStyleType(nsCSSValue& aValue);
|
||||
bool ParseMargin();
|
||||
@@ -11815,6 +11816,8 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID)
|
||||
return ParseInitialLetter();
|
||||
case eCSSProperty_justify_items:
|
||||
return ParseJustifyItems();
|
||||
case eCSSProperty_inset:
|
||||
return ParseInset();
|
||||
case eCSSProperty_list_style:
|
||||
return ParseListStyle();
|
||||
case eCSSProperty_margin:
|
||||
@@ -15243,6 +15246,19 @@ CSSParserImpl::ParseListStyle()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseInset()
|
||||
{
|
||||
static const nsCSSPropertyID kInsetSideIDs[] = {
|
||||
eCSSProperty_top,
|
||||
eCSSProperty_right,
|
||||
eCSSProperty_bottom,
|
||||
eCSSProperty_left
|
||||
};
|
||||
|
||||
return ParseBoxProperties(kInsetSideIDs);
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseListStyleType(nsCSSValue& aValue)
|
||||
{
|
||||
|
||||
@@ -2334,6 +2334,13 @@ CSS_PROP_LOGICAL(
|
||||
Position,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_SHORTHAND(
|
||||
inset,
|
||||
inset,
|
||||
Inset,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
"")
|
||||
CSS_PROP_DISPLAY(
|
||||
isolation,
|
||||
isolation,
|
||||
|
||||
@@ -2902,6 +2902,15 @@ static const nsCSSPropertyID gFontVariantSubpropTable[] = {
|
||||
eCSSProperty_UNKNOWN
|
||||
};
|
||||
|
||||
static const nsCSSPropertyID gInsetSubpropTable[] = {
|
||||
// Code relies on these being in top-right-bottom-left order.
|
||||
eCSSProperty_top,
|
||||
eCSSProperty_right,
|
||||
eCSSProperty_bottom,
|
||||
eCSSProperty_left,
|
||||
eCSSProperty_UNKNOWN
|
||||
};
|
||||
|
||||
static const nsCSSPropertyID gListStyleSubpropTable[] = {
|
||||
eCSSProperty_list_style_type,
|
||||
eCSSProperty_list_style_image,
|
||||
|
||||
@@ -199,6 +199,7 @@ nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID,
|
||||
// FIXME: This is missing the margin shorthand and the logical versions of
|
||||
// the margin properties, see bug 1266287.
|
||||
if (aPropID == eCSSProperty_opacity || aPropID == eCSSProperty_transform ||
|
||||
aPropID == eCSSProperty_inset ||
|
||||
aPropID == eCSSProperty_left || aPropID == eCSSProperty_top ||
|
||||
aPropID == eCSSProperty_right || aPropID == eCSSProperty_bottom ||
|
||||
aPropID == eCSSProperty_margin_left || aPropID == eCSSProperty_margin_top ||
|
||||
|
||||
@@ -64,6 +64,7 @@ nsDOMCSSDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID,
|
||||
case eCSSProperty_background_position_x:
|
||||
case eCSSProperty_background_position_y:
|
||||
case eCSSProperty_transform:
|
||||
case eCSSProperty_inset:
|
||||
case eCSSProperty_top:
|
||||
case eCSSProperty_left:
|
||||
case eCSSProperty_bottom:
|
||||
|
||||
@@ -5403,6 +5403,18 @@ var gCSSProperties = {
|
||||
],
|
||||
invalid_values: [ "none", "5" ]
|
||||
},
|
||||
"inset": {
|
||||
domProp: "inset",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_TRUE_SHORTHAND,
|
||||
subproperties: [ "top", "right", "bottom", "left" ],
|
||||
/* FIXME: run tests with multiple prerequisites */
|
||||
prerequisites: { "position": "relative" },
|
||||
initial_values: [ "auto" ],
|
||||
other_values: [ "3px 0", "2em 4px 2pt", "1em 2em 3px 4px", "1em calc(2em + 3px) 4ex 5cm" ],
|
||||
invalid_values: [ "1px calc(nonsense)", "1px red", "3" ],
|
||||
unbalanced_values: [ "1px calc(" ],
|
||||
},
|
||||
"inset-block-end": {
|
||||
domProp: "insetBlockEnd",
|
||||
inherited: false,
|
||||
|
||||
Reference in New Issue
Block a user