aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/inline.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r--components/layout/inline.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index a934b95bafe..c5be5b33390 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -554,7 +554,6 @@ impl LineBreaker {
layout_context: &LayoutContext) {
// Undo any whitespace stripping from previous reflows.
fragment.reset_text_range_and_inline_size();
-
// Determine initial placement for the fragment if we need to.
//
// Also, determine whether we can legally break the line before, or
@@ -566,7 +565,21 @@ impl LineBreaker {
self.pending_line.green_zone = line_bounds.size;
false
} else {
- fragment.white_space().allow_wrap()
+ // In case of Foo<span style="...">bar</span>, the line breaker will
+ // set the "suppress line break before" flag for the second fragment.
+ //
+ // In case of Foo<span>bar</span> the second fragment ("bar") will
+ // start _within_ a glyph run, so we also avoid breaking there
+ //
+ // is_on_glyph_run_boundary does a binary search, but this is ok
+ // because the result will be cached and reused in
+ // `calculate_split_position` later
+ if fragment.suppress_line_break_before() ||
+ !fragment.is_on_glyph_run_boundary() {
+ false
+ } else {
+ fragment.white_space().allow_wrap()
+ }
};
debug!("LineBreaker: trying to append to line {} \