LibWeb: Clear grapheme segmenter when invalidating TextNode text
We only set the grapheme segmenter's text once after creating a new segmenter, so we also need to clear it whenever we invalidate the text.
This commit is contained in:
parent
4fcaeabe1a
commit
25516e351e
Notes:
github-actions[bot]
2024-10-09 21:08:10 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/25516e351e4 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1702 Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 12 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html><textarea>a
|
||||
b</textarea>
|
9
Tests/LibWeb/Ref/textnode-segmenter-invalidation.html
Normal file
9
Tests/LibWeb/Ref/textnode-segmenter-invalidation.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<head><link rel="match" href="reference/textnode-segmenter-invalidation.html" /></head>
|
||||
<textarea id="output"></textarea>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.body.offsetWidth // Force layout
|
||||
document.getElementById('output').value = 'a\nb';
|
||||
});
|
||||
</script>
|
|
@ -304,6 +304,7 @@ static ErrorOr<String> apply_text_transform(String const& string, CSS::TextTrans
|
|||
void TextNode::invalidate_text_for_rendering()
|
||||
{
|
||||
m_text_for_rendering = {};
|
||||
m_grapheme_segmenter.clear();
|
||||
}
|
||||
|
||||
String const& TextNode::text_for_rendering() const
|
||||
|
|
Loading…
Add table
Reference in a new issue