From c3590da576ed174d320e0cd4e23c90a4e5fe4ce5 Mon Sep 17 00:00:00 2001 From: erixreyes Date: Tue, 8 Jul 2025 00:46:07 +0800 Subject: [PATCH] Issue #2780: Add back the mismatch overflow handling in nsRuleNode.cpp --- layout/style/nsRuleNode.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 27f3e6f5f5..f4a0b82753 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -6427,6 +6427,15 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, 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; + } + } // When 'contain: paint', update overflow from 'visible' to 'clip'.