From abaea77ccbc3658186b2027d2721451e8acb34a3 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Thu, 3 Sep 2020 18:55:28 -0500 Subject: Issue #1641 - Implement CSS flow-root keyword This is just a clean port of 1322191 and follow-up 1325970. It really seems to add create a new way to access existing code relating to block formatting and floating elements rather than implementing new functionality, and it is mercifully straightforwards. --- layout/style/nsCSSKeywordList.h | 1 + layout/style/nsCSSProps.cpp | 3 +++ layout/style/nsRuleNode.cpp | 2 ++ layout/style/nsStyleConsts.h | 1 + layout/style/nsStyleStruct.h | 6 ++++-- layout/style/test/property_database.js | 4 ++++ 6 files changed, 15 insertions(+), 2 deletions(-) (limited to 'layout/style') diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 34a46ffce..9045da9ff 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -285,6 +285,7 @@ CSS_KEY(flex, flex) CSS_KEY(flex-end, flex_end) CSS_KEY(flex-start, flex_start) CSS_KEY(flip, flip) +CSS_KEY(flow-root, flow_root) CSS_KEY(forwards, forwards) CSS_KEY(fraktur, fraktur) CSS_KEY(from-image, from_image) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index ac2978c27..24c97cf33 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1345,6 +1345,9 @@ KTableEntry nsCSSProps::kDisplayKTable[] = { // The next entry is controlled by the layout.css.display-contents.enabled // pref. { eCSSKeyword_contents, StyleDisplay::Contents }, + // The next entry is controlled by the layout.css.display-flow-root.enabled + // pref. + { eCSSKeyword_flow_root, StyleDisplay::FlowRoot }, { eCSSKeyword_UNKNOWN, -1 } }; diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 1a451a2ef..036d97f86 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -250,6 +250,7 @@ nsRuleNode::EnsureBlockDisplay(StyleDisplay& display, case StyleDisplay::Flex: case StyleDisplay::WebkitBox: case StyleDisplay::Grid: + case StyleDisplay::FlowRoot: // do not muck with these at all - already blocks // This is equivalent to nsStyleDisplay::IsBlockOutside. (XXX Maybe we // should just call that?) @@ -293,6 +294,7 @@ nsRuleNode::EnsureInlineDisplay(StyleDisplay& display) // see if the display value is already inline switch (display) { case StyleDisplay::Block: + case StyleDisplay::FlowRoot: display = StyleDisplay::InlineBlock; break; case StyleDisplay::Table: diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index 6d207aec9..f54387aa8 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -524,6 +524,7 @@ enum class FillMode : uint32_t; enum class StyleDisplay : uint8_t { None = 0, Block, + FlowRoot, Inline, InlineBlock, ListItem, diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 4bda817dd..f49cdc43e 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2890,7 +2890,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay return mozilla::StyleDisplay::Block == mDisplay || mozilla::StyleDisplay::ListItem == mDisplay || mozilla::StyleDisplay::InlineBlock == mDisplay || - mozilla::StyleDisplay::TableCaption == mDisplay; + mozilla::StyleDisplay::TableCaption == mDisplay || + mozilla::StyleDisplay::FlowRoot == mDisplay; // Should TABLE_CELL be included here? They have // block frames nested inside of them. // (But please audit all callers before changing.) @@ -2902,7 +2903,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay mozilla::StyleDisplay::WebkitBox == mDisplay || mozilla::StyleDisplay::Grid == mDisplay || mozilla::StyleDisplay::ListItem == mDisplay || - mozilla::StyleDisplay::Table == mDisplay; + mozilla::StyleDisplay::Table == mDisplay || + mozilla::StyleDisplay::FlowRoot == mDisplay; } static bool IsDisplayTypeInlineOutside(mozilla::StyleDisplay aDisplay) { diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index c75f7b498..2d6352148 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -7892,6 +7892,10 @@ if (IsCSSPropertyPrefEnabled("layout.css.background-clip-text.enabled")) { ); } +if (IsCSSPropertyPrefEnabled("layout.css.display-flow-root.enabled")) { + gCSSProperties["display"].other_values.push("flow-root"); +} + // Copy aliased properties' fields from their alias targets. for (var prop in gCSSProperties) { var entry = gCSSProperties[prop]; -- cgit v1.2.3