aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/Cargo.toml2
-rw-r--r--components/layout/block.rs7
-rw-r--r--components/layout/construct.rs20
-rw-r--r--components/layout/inline.rs2
4 files changed, 23 insertions, 8 deletions
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index eb1c968b581..8a782d1ae77 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -35,7 +35,7 @@ range = {path = "../range"}
rayon = "0.6"
script_layout_interface = {path = "../script_layout_interface"}
script_traits = {path = "../script_traits"}
-selectors = "0.15"
+selectors = "0.15.1"
serde = "0.8"
serde_derive = "0.8"
servo_geometry = {path = "../geometry"}
diff --git a/components/layout/block.rs b/components/layout/block.rs
index a4eb30ce606..7859cb9a9f8 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -567,7 +567,7 @@ impl BlockFlow {
} else {
BlockType::FloatNonReplaced
}
- } else if self.is_inline_block() {
+ } else if self.is_inline_block_or_inline_flex() {
if self.fragment.is_replaced() {
BlockType::InlineBlockReplaced
} else {
@@ -1558,8 +1558,9 @@ impl BlockFlow {
debug_assert_eq!(self.fragment.margin_box_inline_size(), self.base.position.size.inline);
}
- fn is_inline_block(&self) -> bool {
- self.fragment.style().get_box().display == display::T::inline_block
+ fn is_inline_block_or_inline_flex(&self) -> bool {
+ self.fragment.style().get_box().display == display::T::inline_block ||
+ self.fragment.style().get_box().display == display::T::inline_flex
}
/// Computes the content portion (only) of the intrinsic inline sizes of this flow. This is
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 6671a07b4ad..95603f8dea7 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -937,9 +937,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
ConstructionResult::ConstructionItem(construction_item)
}
- fn build_fragment_for_inline_block(&mut self, node: &ConcreteThreadSafeLayoutNode)
- -> ConstructionResult {
- let block_flow_result = self.build_flow_for_block(node, None);
+ /// Build the fragment for an inline-block or inline-flex, based on the `display` flag
+ fn build_fragment_for_inline_block_or_inline_flex(&mut self, node: &ConcreteThreadSafeLayoutNode,
+ display: display::T) -> ConstructionResult {
+ let block_flow_result = match display {
+ display::T::inline_block => self.build_flow_for_block(node, None),
+ display::T::inline_flex => self.build_flow_for_flex(node, None),
+ _ => panic!("The flag should be inline-block or inline-flex")
+ };
let (block_flow, abs_descendants) = match block_flow_result {
ConstructionResult::Flow(block_flow, abs_descendants) => (block_flow, abs_descendants),
_ => unreachable!()
@@ -1548,7 +1553,8 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
// Inline-block items contribute inline fragment construction results.
(display::T::inline_block, float::T::none, _) => {
- let construction_result = self.build_fragment_for_inline_block(node);
+ let construction_result = self.build_fragment_for_inline_block_or_inline_flex(node,
+ display::T::inline_block);
self.set_flow_construction_result(node, construction_result)
}
@@ -1597,6 +1603,12 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
self.set_flow_construction_result(node, construction_result)
}
+ (display::T::inline_flex, _, _) => {
+ let construction_result = self.build_fragment_for_inline_block_or_inline_flex(node,
+ display::T::inline_flex);
+ self.set_flow_construction_result(node, construction_result)
+ }
+
// Block flows that are not floated contribute block flow construction results.
//
// TODO(pcwalton): Make this only trigger for blocks and handle the other `display`
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index 8a086d34320..d255b030963 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -1151,6 +1151,7 @@ impl InlineFlow {
match (display_value, vertical_align_value) {
(display::T::inline, vertical_align::T::top) |
(display::T::block, vertical_align::T::top) |
+ (display::T::inline_flex, vertical_align::T::top) |
(display::T::inline_block, vertical_align::T::top) if
inline_metrics.space_above_baseline >= Au(0) => {
*largest_block_size_for_top_fragments = max(
@@ -1159,6 +1160,7 @@ impl InlineFlow {
}
(display::T::inline, vertical_align::T::bottom) |
(display::T::block, vertical_align::T::bottom) |
+ (display::T::inline_flex, vertical_align::T::bottom) |
(display::T::inline_block, vertical_align::T::bottom) if
inline_metrics.space_below_baseline >= Au(0) => {
*largest_block_size_for_bottom_fragments = max(