aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/main/layout/flow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/main/layout/flow.rs')
-rw-r--r--src/components/main/layout/flow.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/components/main/layout/flow.rs b/src/components/main/layout/flow.rs
index 9abd29ab934..953a008ad0a 100644
--- a/src/components/main/layout/flow.rs
+++ b/src/components/main/layout/flow.rs
@@ -6,20 +6,20 @@
//! layout constraints to obtain positions and display attributes of tree nodes. Positions are
//! computed in several tree traversals driven by the fundamental data dependencies required by
/// inline and block layout.
-///
+///
/// Flows are interior nodes in the layout tree and correspond closely to *flow contexts* in the
/// CSS specification. Flows are responsible for positioning their child flow contexts and boxes.
/// Flows have purpose-specific fields, such as auxiliary line box structs, out-of-flow child
/// lists, and so on.
///
/// Currently, the important types of flows are:
-///
+///
/// * `BlockFlow`: A flow that establishes a block context. It has several child flows, each of
/// which are positioned according to block formatting context rules (CSS block boxes). Block
/// flows also contain a single `GenericBox` to represent their rendered borders, padding, etc.
/// The BlockFlow at the root of the tree has special behavior: it stretches to the boundaries of
/// the viewport.
-///
+///
/// * `InlineFlow`: A flow that establishes an inline context. It has a flat list of child
/// boxes/flows that are subject to inline layout and line breaking and structs to represent
/// line breaks and mapping to CSS boxes, for the purpose of handling `getClientRects()` and
@@ -698,6 +698,11 @@ impl<'a> MutableFlowUtils for &'a mut Flow {
mut_base(self).overflow = overflow
}
+ /// Push display items for current flow and its children onto `list`.
+ ///
+ /// For InlineFlow, add display items for all its boxes onto list`.
+ /// For BlockFlow, add a ClipDisplayItemClass for itself and its children,
+ /// plus any other display items like border.
fn build_display_lists<E:ExtraDisplayListData>(
self,
builder: &DisplayListBuilder,
@@ -723,6 +728,11 @@ impl<'a> MutableFlowUtils for &'a mut Flow {
}
let mut child_lists = Some(child_lists.unwrap());
+ // Find parent ClipDisplayItemClass and push all child display items
+ // under it
+ // FIXME: Once we have children for InlineFlow, this might lead to
+ // children display items being pushed under the ClipDisplayItemClass
+ // created by the last box of the InlineFlow. Fix the logic.
lists.with_mut(|lists| {
let mut child_lists = child_lists.take_unwrap();
let result = lists.lists[index].list.mut_rev_iter().position(|item| {
@@ -848,4 +858,3 @@ impl FlowLeafSet {
self.set.iter()
}
}
-