mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 11:37:30 +09:00
Issue #2124/2662: Optimize overflow shorthand parsing and serialization
This commit is contained in:
parent
7c52fd934f
commit
7626c99ceb
2 changed files with 24 additions and 6 deletions
|
|
@ -3181,6 +3181,13 @@ static const nsCSSPropertyID gSizeLogicalGroupTable[] = {
|
||||||
eCSSProperty_UNKNOWN
|
eCSSProperty_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const nsCSSPropertyID gOverflowLogicalGroupTable[] = {
|
||||||
|
eCSSProperty_overflow_y,
|
||||||
|
eCSSProperty_overflow_x,
|
||||||
|
eCSSProperty_UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
const nsCSSPropertyID* const
|
const nsCSSPropertyID* const
|
||||||
nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = {
|
nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = {
|
||||||
#define CSS_PROP_LOGICAL_GROUP_SHORTHAND(id_) g##id_##SubpropTable,
|
#define CSS_PROP_LOGICAL_GROUP_SHORTHAND(id_) g##id_##SubpropTable,
|
||||||
|
|
|
||||||
|
|
@ -4750,16 +4750,27 @@ nsComputedDOMStyle::DoGetOverflow()
|
||||||
{
|
{
|
||||||
const nsStyleDisplay* display = StyleDisplay();
|
const nsStyleDisplay* display = StyleDisplay();
|
||||||
|
|
||||||
if (display->mOverflowX != display->mOverflowY) {
|
if (display->mOverflowX == display->mOverflowY) {
|
||||||
// No value to return. We can't express this combination of
|
|
||||||
// values as a shorthand.
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
|
||||||
nsCSSProps::kOverflowKTable));
|
nsCSSProps::kOverflowKTable));
|
||||||
return val.forget();
|
return val.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
|
nsAutoString result;
|
||||||
|
|
||||||
|
nsCSSKeyword xKeyword = nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
|
||||||
|
nsCSSProps::kOverflowKTable);
|
||||||
|
nsCSSKeyword yKeyword = nsCSSProps::ValueToKeywordEnum(display->mOverflowY,
|
||||||
|
nsCSSProps::kOverflowKTable);
|
||||||
|
|
||||||
|
result.AppendASCII(nsCSSKeywords::GetStringValue(xKeyword).get());
|
||||||
|
result.Append(char16_t(' '));
|
||||||
|
result.AppendASCII(nsCSSKeywords::GetStringValue(yKeyword).get());
|
||||||
|
|
||||||
|
val->SetString(result);
|
||||||
|
return val.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<CSSValue>
|
already_AddRefed<CSSValue>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue