mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
layout: Consider vertical alignment of fragments during line breaking.
This makes the line breaker determine the final block positions of each line rather than doing it in a separate pass afterward. Not only does this simplify the code, it makes `vertical-align` and float placement interact properly.
This commit is contained in:
parent
04f05349b1
commit
b7c9674044
2 changed files with 171 additions and 275 deletions
|
@ -11,7 +11,7 @@ use canvas_traits::CanvasMsg;
|
|||
use context::LayoutContext;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use floats::ClearType;
|
||||
use flow::{self, Flow};
|
||||
use flow::{self, Flow, ImmutableFlowUtils};
|
||||
use flow_ref::{self, FlowRef};
|
||||
use gfx;
|
||||
use gfx::display_list::{BLUR_INFLATION_FACTOR, FragmentType, OpaqueNode, StackingContextId};
|
||||
|
@ -38,7 +38,7 @@ use std::sync::{Arc, Mutex};
|
|||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{border_collapse, clear, display, mix_blend_mode, overflow_wrap};
|
||||
use style::computed_values::{overflow_x, position, text_decoration, transform_style};
|
||||
use style::computed_values::{white_space, word_break, z_index};
|
||||
use style::computed_values::{vertical_align, white_space, word_break, z_index};
|
||||
use style::dom::TRestyleDamage;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
|
@ -2558,6 +2558,24 @@ impl Fragment {
|
|||
LayerId::new_of_type(LayerType::OverflowScroll, self.node.id() as usize)
|
||||
}
|
||||
|
||||
/// Returns true if any of the inline styles associated with this fragment have
|
||||
/// `vertical-align` set to `top` or `bottom`.
|
||||
pub fn is_vertically_aligned_to_top_or_bottom(&self) -> bool {
|
||||
match self.style.get_box().vertical_align {
|
||||
vertical_align::T::top | vertical_align::T::bottom => return true,
|
||||
_ => {}
|
||||
}
|
||||
if let Some(ref inline_context) = self.inline_context {
|
||||
for node in &inline_context.nodes {
|
||||
match node.style.get_box().vertical_align {
|
||||
vertical_align::T::top | vertical_align::T::bottom => return true,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_text_or_replaced(&self) -> bool {
|
||||
match self.specific {
|
||||
SpecificFragmentInfo::Generic |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue