mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 08:07:30 +09:00
Issue #2136 - Part 1: Implement CSS inset property
This commit is contained in:
parent
ad929c5dd5
commit
21d468ee65
7 changed files with 59 additions and 8 deletions
|
|
@ -643,6 +643,7 @@ Declaration::GetPropertyValueInternal(
|
||||||
|
|
||||||
nsCSSCompressedDataBlock *data = importantCount ? mImportantData : mData;
|
nsCSSCompressedDataBlock *data = importantCount ? mImportantData : mData;
|
||||||
switch (aProperty) {
|
switch (aProperty) {
|
||||||
|
case eCSSProperty_inset:
|
||||||
case eCSSProperty_margin:
|
case eCSSProperty_margin:
|
||||||
case eCSSProperty_padding:
|
case eCSSProperty_padding:
|
||||||
case eCSSProperty_border_color:
|
case eCSSProperty_border_color:
|
||||||
|
|
@ -650,14 +651,18 @@ Declaration::GetPropertyValueInternal(
|
||||||
case eCSSProperty_border_width: {
|
case eCSSProperty_border_width: {
|
||||||
const nsCSSPropertyID* subprops =
|
const nsCSSPropertyID* subprops =
|
||||||
nsCSSProps::SubpropertyEntryFor(aProperty);
|
nsCSSProps::SubpropertyEntryFor(aProperty);
|
||||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") !=
|
// These assertions don't apply to the inset shorthand because
|
||||||
kNotFound, "first subprop must be top");
|
// they don't start with a dash and are simply just the sides.
|
||||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[1]).Find("-right") !=
|
if (aProperty != eCSSProperty_inset) {
|
||||||
kNotFound, "second subprop must be right");
|
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") !=
|
||||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") !=
|
kNotFound, "first subprop must be top");
|
||||||
kNotFound, "third subprop must be bottom");
|
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[1]).Find("-right") !=
|
||||||
MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[3]).Find("-left") !=
|
kNotFound, "second subprop must be right");
|
||||||
kNotFound, "fourth subprop must be left");
|
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] = {
|
const nsCSSValue* vals[4] = {
|
||||||
data->ValueFor(subprops[0]),
|
data->ValueFor(subprops[0]),
|
||||||
data->ValueFor(subprops[1]),
|
data->ValueFor(subprops[1]),
|
||||||
|
|
|
||||||
|
|
@ -1045,6 +1045,7 @@ protected:
|
||||||
bool ParseFontSrc(nsCSSValue& aValue);
|
bool ParseFontSrc(nsCSSValue& aValue);
|
||||||
bool ParseFontSrcFormat(InfallibleTArray<nsCSSValue>& values);
|
bool ParseFontSrcFormat(InfallibleTArray<nsCSSValue>& values);
|
||||||
bool ParseFontRanges(nsCSSValue& aValue);
|
bool ParseFontRanges(nsCSSValue& aValue);
|
||||||
|
bool ParseInset();
|
||||||
bool ParseListStyle();
|
bool ParseListStyle();
|
||||||
bool ParseListStyleType(nsCSSValue& aValue);
|
bool ParseListStyleType(nsCSSValue& aValue);
|
||||||
bool ParseMargin();
|
bool ParseMargin();
|
||||||
|
|
@ -11815,6 +11816,8 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID)
|
||||||
return ParseInitialLetter();
|
return ParseInitialLetter();
|
||||||
case eCSSProperty_justify_items:
|
case eCSSProperty_justify_items:
|
||||||
return ParseJustifyItems();
|
return ParseJustifyItems();
|
||||||
|
case eCSSProperty_inset:
|
||||||
|
return ParseInset();
|
||||||
case eCSSProperty_list_style:
|
case eCSSProperty_list_style:
|
||||||
return ParseListStyle();
|
return ParseListStyle();
|
||||||
case eCSSProperty_margin:
|
case eCSSProperty_margin:
|
||||||
|
|
@ -15243,6 +15246,19 @@ CSSParserImpl::ParseListStyle()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CSSParserImpl::ParseInset()
|
||||||
|
{
|
||||||
|
static const nsCSSPropertyID kInsetSideIDs[] = {
|
||||||
|
eCSSProperty_top,
|
||||||
|
eCSSProperty_right,
|
||||||
|
eCSSProperty_bottom,
|
||||||
|
eCSSProperty_left
|
||||||
|
};
|
||||||
|
|
||||||
|
return ParseBoxProperties(kInsetSideIDs);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CSSParserImpl::ParseListStyleType(nsCSSValue& aValue)
|
CSSParserImpl::ParseListStyleType(nsCSSValue& aValue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2334,6 +2334,13 @@ CSS_PROP_LOGICAL(
|
||||||
Position,
|
Position,
|
||||||
CSS_PROP_NO_OFFSET,
|
CSS_PROP_NO_OFFSET,
|
||||||
eStyleAnimType_None)
|
eStyleAnimType_None)
|
||||||
|
CSS_PROP_SHORTHAND(
|
||||||
|
inset,
|
||||||
|
inset,
|
||||||
|
Inset,
|
||||||
|
CSS_PROPERTY_PARSE_FUNCTION |
|
||||||
|
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||||
|
"")
|
||||||
CSS_PROP_DISPLAY(
|
CSS_PROP_DISPLAY(
|
||||||
isolation,
|
isolation,
|
||||||
isolation,
|
isolation,
|
||||||
|
|
|
||||||
|
|
@ -2902,6 +2902,15 @@ static const nsCSSPropertyID gFontVariantSubpropTable[] = {
|
||||||
eCSSProperty_UNKNOWN
|
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[] = {
|
static const nsCSSPropertyID gListStyleSubpropTable[] = {
|
||||||
eCSSProperty_list_style_type,
|
eCSSProperty_list_style_type,
|
||||||
eCSSProperty_list_style_image,
|
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
|
// FIXME: This is missing the margin shorthand and the logical versions of
|
||||||
// the margin properties, see bug 1266287.
|
// the margin properties, see bug 1266287.
|
||||||
if (aPropID == eCSSProperty_opacity || aPropID == eCSSProperty_transform ||
|
if (aPropID == eCSSProperty_opacity || aPropID == eCSSProperty_transform ||
|
||||||
|
aPropID == eCSSProperty_inset ||
|
||||||
aPropID == eCSSProperty_left || aPropID == eCSSProperty_top ||
|
aPropID == eCSSProperty_left || aPropID == eCSSProperty_top ||
|
||||||
aPropID == eCSSProperty_right || aPropID == eCSSProperty_bottom ||
|
aPropID == eCSSProperty_right || aPropID == eCSSProperty_bottom ||
|
||||||
aPropID == eCSSProperty_margin_left || aPropID == eCSSProperty_margin_top ||
|
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_x:
|
||||||
case eCSSProperty_background_position_y:
|
case eCSSProperty_background_position_y:
|
||||||
case eCSSProperty_transform:
|
case eCSSProperty_transform:
|
||||||
|
case eCSSProperty_inset:
|
||||||
case eCSSProperty_top:
|
case eCSSProperty_top:
|
||||||
case eCSSProperty_left:
|
case eCSSProperty_left:
|
||||||
case eCSSProperty_bottom:
|
case eCSSProperty_bottom:
|
||||||
|
|
|
||||||
|
|
@ -5403,6 +5403,18 @@ var gCSSProperties = {
|
||||||
],
|
],
|
||||||
invalid_values: [ "none", "5" ]
|
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": {
|
"inset-block-end": {
|
||||||
domProp: "insetBlockEnd",
|
domProp: "insetBlockEnd",
|
||||||
inherited: false,
|
inherited: false,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue