Issue #2499 - Part 2: Fix overflow shorthand serialization for mixed clip values

This commit is contained in:
MeladJM 2025-07-06 05:56:06 +08:00 committed by roytam1
commit 205ea844f4
2 changed files with 14 additions and 23 deletions

View file

@ -6407,35 +6407,16 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
NS_STYLE_OVERFLOW_VISIBLE);
// CSS3 overflow-x and overflow-y require some fixup as well in some
// cases. NS_STYLE_OVERFLOW_VISIBLE and NS_STYLE_OVERFLOW_CLIP are
// meaningful only when used in both dimensions.
// cases. NS_STYLE_OVERFLOW_VISIBLE is meaningful only when used in both dimensions.
// NS_STYLE_OVERFLOW_CLIP is now a standard value and should be preserved.
if (display->mOverflowX != display->mOverflowY &&
(display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE ||
display->mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE ||
display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)) {
display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE)) {
// We can't store in the rule tree since a more specific rule might
// change these conditions.
conditions.SetUncacheable();
// NS_STYLE_OVERFLOW_CLIP is a deprecated value, so if it's specified
// in only one dimension, convert it to NS_STYLE_OVERFLOW_HIDDEN.
if (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP) {
display->mOverflowX = NS_STYLE_OVERFLOW_HIDDEN;
}
if (display->mOverflowY == NS_STYLE_OVERFLOW_CLIP) {
display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN;
}
// If 'visible' is specified but doesn't match the other dimension, it
// turns into 'auto'.
if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
display->mOverflowX = NS_STYLE_OVERFLOW_AUTO;
}
if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
display->mOverflowY = NS_STYLE_OVERFLOW_AUTO;
}
// Note: clip values are now preserved as-is when axes differ
}
// When 'contain: paint', update overflow from 'visible' to 'clip'.