core: Fix bullet append with box_count check
This commit is contained in:
parent
b7273e038c
commit
0c853082dd
|
@ -221,7 +221,6 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
|
|||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
only_line: bool,
|
||||
final_line_of_para: bool,
|
||||
empty_text_line: Option<bool>,
|
||||
) {
|
||||
if self.boxes.get_mut(self.current_line..).is_none() {
|
||||
return;
|
||||
|
@ -279,7 +278,7 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
|
|||
} else {
|
||||
self.font_leading_adjustment()
|
||||
};
|
||||
if self.current_line_span.bullet && self.is_first_line && empty_text_line.unwrap_or(false) {
|
||||
if self.current_line_span.bullet && self.is_first_line && box_count > 0 {
|
||||
self.append_bullet(context, &self.current_line_span.clone());
|
||||
}
|
||||
|
||||
|
@ -322,12 +321,8 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
|
|||
///
|
||||
/// This function will also adjust any layout boxes on the current line to
|
||||
/// their correct alignment and indentation.
|
||||
fn explicit_newline(
|
||||
&mut self,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
empty_text_line: Option<bool>,
|
||||
) {
|
||||
self.fixup_line(context, false, true, empty_text_line);
|
||||
fn explicit_newline(&mut self, context: &mut UpdateContext<'_, 'gc, '_>) {
|
||||
self.fixup_line(context, false, true);
|
||||
|
||||
self.cursor.set_x(Twips::from_pixels(0.0));
|
||||
self.cursor += (
|
||||
|
@ -345,7 +340,7 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
|
|||
/// This function will also adjust any layout boxes on the current line to
|
||||
/// their correct alignment and indentation.
|
||||
fn newline(&mut self, context: &mut UpdateContext<'_, 'gc, '_>) {
|
||||
self.fixup_line(context, false, false, None);
|
||||
self.fixup_line(context, false, false);
|
||||
|
||||
self.cursor.set_x(Twips::from_pixels(0.0));
|
||||
self.cursor += (
|
||||
|
@ -542,7 +537,7 @@ impl<'a, 'gc> LayoutContext<'a, 'gc> {
|
|||
mut self,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
) -> (Vec<LayoutBox<'gc>>, BoxBounds<Twips>) {
|
||||
self.fixup_line(context, !self.has_line_break, true, None);
|
||||
self.fixup_line(context, !self.has_line_break, true);
|
||||
|
||||
(self.boxes, self.exterior_bounds.unwrap_or_default())
|
||||
}
|
||||
|
@ -698,9 +693,7 @@ impl<'gc> LayoutBox<'gc> {
|
|||
};
|
||||
|
||||
match delimiter {
|
||||
Some(b'\n' | b'\r') => {
|
||||
layout_context.explicit_newline(context, Some(text.is_empty()))
|
||||
}
|
||||
Some(b'\n' | b'\r') => layout_context.explicit_newline(context),
|
||||
Some(b'\t') => layout_context.tab(),
|
||||
_ => {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue