mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Avoid wrapping line at the start of text run with text-wrap-mode: nowrap
(#33848)
When computing the min-content size of an inline formatting context, we could allow a soft wrap opportunity at the start of a text run. This shouldn't happen with `text-wrap-mode: nowrap`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
0a71c736f0
commit
103d3aa7bb
3 changed files with 25 additions and 5 deletions
|
@ -2245,17 +2245,17 @@ impl<'layout_data> ContentSizesComputation<'layout_data> {
|
|||
},
|
||||
InlineItem::TextRun(text_run) => {
|
||||
for segment in text_run.shaped_text.iter() {
|
||||
let style_text = text_run.parent_style.get_inherited_text();
|
||||
let can_wrap = style_text.text_wrap_mode == TextWrapMode::Wrap;
|
||||
|
||||
// TODO: This should take account whether or not the first and last character prevent
|
||||
// linebreaks after atomics as in layout.
|
||||
if segment.break_at_start {
|
||||
if can_wrap && segment.break_at_start {
|
||||
self.line_break_opportunity()
|
||||
}
|
||||
|
||||
for run in segment.runs.iter() {
|
||||
let advance = run.glyph_store.total_advance();
|
||||
let style_text = text_run.parent_style.get_inherited_text();
|
||||
let can_wrap = style_text.text_wrap_mode == TextWrapMode::Wrap;
|
||||
|
||||
if run.glyph_store.is_whitespace() {
|
||||
// If this run is a forced line break, we *must* break the line
|
||||
// and start measuring from the inline origin once more.
|
||||
|
|
2
tests/wpt/meta/MANIFEST.json
vendored
2
tests/wpt/meta/MANIFEST.json
vendored
|
@ -570815,7 +570815,7 @@
|
|||
]
|
||||
],
|
||||
"white-space-intrinsic-size-021.html": [
|
||||
"f9c246d4899b58dbcf2dc08655c8bc1f39995e5a",
|
||||
"9c63117d087932fb7c4788ff58c251d60dc1bf17",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
|
|
|
@ -166,6 +166,16 @@ x-br::before {
|
|||
<div class="break-spaces wrap" data-expected-client-width="20" data-expected-client-height="20">X <x-br></x-br>É</div>
|
||||
<div class="break-spaces nowrap" data-expected-client-width="20" data-expected-client-height="20">X <x-br></x-br>É</div>
|
||||
</div>
|
||||
<div class="container narrow">
|
||||
<div class="collapse wrap" data-expected-client-width="10" data-expected-client-height="20">X <a>É</a></div>
|
||||
<div class="collapse nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="preserve wrap" data-expected-client-width="10" data-expected-client-height="20">X <a>É</a></div>
|
||||
<div class="preserve nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="preserve-breaks wrap" data-expected-client-width="10" data-expected-client-height="20">X <a>É</a></div>
|
||||
<div class="preserve-breaks nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="break-spaces wrap" data-expected-client-width="20" data-expected-client-height="20">X <a>É</a></div>
|
||||
<div class="break-spaces nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
@ -279,6 +289,16 @@ x-br::before {
|
|||
<div class="break-spaces wrap" data-expected-client-width="20" data-expected-client-height="20">X <x-br></x-br>É</div>
|
||||
<div class="break-spaces nowrap" data-expected-client-width="20" data-expected-client-height="20">X <x-br></x-br>É</div>
|
||||
</div>
|
||||
<div class="container wide">
|
||||
<div class="collapse wrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="collapse nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="preserve wrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="preserve nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="preserve-breaks wrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="preserve-breaks nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="break-spaces wrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
<div class="break-spaces nowrap" data-expected-client-width="30" data-expected-client-height="10">X <a>É</a></div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue