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'.