summaryrefslogtreecommitdiff
path: root/layout/generic
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2020-09-03 18:55:28 -0500
committerathenian200 <athenian200@outlook.com>2020-09-03 18:55:28 -0500
commite75ee9df13ce73c612f55f7dca426ab870f55c0c (patch)
treebd30f18df9a1d98b88a24c5e9482551ec84ff8ec /layout/generic
parente23247adfaeedf5d924ded4f5f105e79c40e3961 (diff)
downloaduxp-e75ee9df13ce73c612f55f7dca426ab870f55c0c.tar.gz
Issue mcp-graveyard/UXP#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.
Diffstat (limited to 'layout/generic')
-rw-r--r--layout/generic/ReflowInput.cpp1
-rw-r--r--layout/generic/nsBlockFrame.cpp7
-rw-r--r--layout/generic/nsFrameStateBits.h3
-rw-r--r--layout/generic/nsHTMLParts.h3
4 files changed, 9 insertions, 5 deletions
diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp
index 9f7b4368c3..077c68b5be 100644
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -844,6 +844,7 @@ ReflowInput::InitFrameType(nsIAtom* aFrameType)
case StyleDisplay::Flex:
case StyleDisplay::WebkitBox:
case StyleDisplay::Grid:
+ case StyleDisplay::FlowRoot:
case StyleDisplay::RubyTextContainer:
frameType = NS_CSS_FRAME_TYPE_BLOCK;
break;
diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
index 4742db07e6..152b3d06ad 100644
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -305,7 +305,7 @@ NS_NewBlockFormattingContext(nsIPresShell* aPresShell,
nsStyleContext* aStyleContext)
{
nsBlockFrame* blockFrame = NS_NewBlockFrame(aPresShell, aStyleContext);
- blockFrame->AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
+ blockFrame->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
return blockFrame;
}
@@ -6893,10 +6893,11 @@ nsBlockFrame::Init(nsIContent* aContent,
// (http://dev.w3.org/csswg/css-writing-modes/#block-flow)
// If the box has contain: paint (or contain: strict), then it should also
// establish a formatting context.
- if ((GetParent() && StyleVisibility()->mWritingMode !=
+ if (StyleDisplay()->mDisplay == mozilla::StyleDisplay::FlowRoot ||
+ (GetParent() && StyleVisibility()->mWritingMode !=
GetParent()->StyleVisibility()->mWritingMode) ||
StyleDisplay()->IsContainPaint()) {
- AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
+ AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
}
if ((GetStateBits() &
diff --git a/layout/generic/nsFrameStateBits.h b/layout/generic/nsFrameStateBits.h
index f8b1e541c1..ba43e37d45 100644
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -483,6 +483,9 @@ FRAME_STATE_BIT(Block, 22, NS_BLOCK_MARGIN_ROOT)
// used to reserve space for the floated frames.
FRAME_STATE_BIT(Block, 23, NS_BLOCK_FLOAT_MGR)
+// For setting the relevant bits on a block formatting context:
+#define NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS (NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT)
+
FRAME_STATE_BIT(Block, 24, NS_BLOCK_HAS_LINE_CURSOR)
FRAME_STATE_BIT(Block, 25, NS_BLOCK_HAS_OVERFLOW_LINES)
diff --git a/layout/generic/nsHTMLParts.h b/layout/generic/nsHTMLParts.h
index 243c432b2f..97edaf75c1 100644
--- a/layout/generic/nsHTMLParts.h
+++ b/layout/generic/nsHTMLParts.h
@@ -28,8 +28,7 @@ class nsTableColFrame;
// These are all the block specific frame bits, they are copied from
// the prev-in-flow to a newly created next-in-flow, except for the
// NS_BLOCK_FLAGS_NON_INHERITED_MASK bits below.
-#define NS_BLOCK_FLAGS_MASK (NS_BLOCK_MARGIN_ROOT | \
- NS_BLOCK_FLOAT_MGR | \
+#define NS_BLOCK_FLAGS_MASK (NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS | \
NS_BLOCK_CLIP_PAGINATED_OVERFLOW | \
NS_BLOCK_HAS_FIRST_LETTER_STYLE | \
NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \