mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
parent
bda560d01b
commit
f3c81fcda8
39 changed files with 160 additions and 76 deletions
|
@ -479,6 +479,11 @@ bitflags! {
|
|||
|
||||
/// Is this fragment selected?
|
||||
const SELECTED = 0x02;
|
||||
|
||||
/// Suppress line breaking between this and the previous fragment
|
||||
///
|
||||
/// This handles cases like Foo<span>bar</span>
|
||||
const SUPPRESS_LINE_BREAK_BEFORE = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1421,6 +1426,14 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn suppress_line_break_before(&self) -> bool {
|
||||
match self.specific {
|
||||
SpecificFragmentInfo::ScannedText(ref st) =>
|
||||
st.flags.contains(ScannedTextFlags::SUPPRESS_LINE_BREAK_BEFORE),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the intrinsic inline-sizes of this fragment.
|
||||
pub fn compute_intrinsic_inline_sizes(&mut self) -> IntrinsicISizesContribution {
|
||||
let mut result = self.style_specified_intrinsic_inline_size();
|
||||
|
@ -1621,6 +1634,16 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
/// Does this fragment start on a glyph run boundary?
|
||||
pub fn is_on_glyph_run_boundary(&self) -> bool {
|
||||
let text_fragment_info = match self.specific {
|
||||
SpecificFragmentInfo::ScannedText(ref text_fragment_info)
|
||||
=> text_fragment_info,
|
||||
_ => return true,
|
||||
};
|
||||
text_fragment_info.run.on_glyph_run_boundary(text_fragment_info.range.begin())
|
||||
}
|
||||
|
||||
/// Truncates this fragment to the given `max_inline_size`, using a character-based breaking
|
||||
/// strategy. The resulting fragment will have `SpecificFragmentInfo::TruncatedFragment`,
|
||||
/// preserving the original fragment for use in incremental reflow.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue