Skip to content
Permalink
Browse files
RunIterator::traverseNext/PreviousOnLineIgnoringLineBreak should skip…
… over WBRs

https://bugs.webkit.org/show_bug.cgi?id=224545
rdar://76101143

Reviewed by Zalan Bujtas.
Source/WebCore:

Test: fast/editing/wbr-iterator-crash.html

* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::traverseNextOnLineIgnoringLineBreak):
(WebCore::LayoutIntegration::RunIterator::traversePreviousOnLineIgnoringLineBreak):

Skip over (instead of bailing) runs with isLineBreak() set. It is true for <WBR> so there can be multiple on a line.

LayoutTests:

* fast/editing/wbr-iterator-crash-expected.txt: Added.
* fast/editing/wbr-iterator-crash.html: Added.


Canonical link: https://commits.webkit.org/236530@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
anttijk committed Apr 14, 2021
1 parent 84ba367 commit 5ae9cbe9de2f8574a96ac971783b8f6a90b0c15f
Showing 5 changed files with 53 additions and 6 deletions.
@@ -1,3 +1,14 @@
2021-04-14 Antti Koivisto <antti@apple.com>

RunIterator::traverseNext/PreviousOnLineIgnoringLineBreak should skip over WBRs
https://bugs.webkit.org/show_bug.cgi?id=224545
rdar://76101143

Reviewed by Zalan Bujtas.

* fast/editing/wbr-iterator-crash-expected.txt: Added.
* fast/editing/wbr-iterator-crash.html: Added.

2021-04-14 Robert Jenner <jenner@apple.com>

[ wk2 ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html is flakey crashing
@@ -0,0 +1,2 @@
This test passes if it doesn't crash

@@ -0,0 +1,18 @@
This test passes if it doesn't crash
<script>
if (window.testRunner)
testRunner.dumpAsText();

onload = () => {
document.body.appendChild(document.createElement('br'));
let n0 = document.createElement('span');
document.body.appendChild(n0);
n0.appendChild(document.createElement('tr'));
document.body.appendChild(document.createElement('wbr'));
document.body.appendChild(document.createElement('wbr'));
document.execCommand('SelectAll');
document.designMode = 'on';
getSelection().modify('move', 'right', 'line');
};
</script>

@@ -1,3 +1,19 @@
2021-04-14 Antti Koivisto <antti@apple.com>

RunIterator::traverseNext/PreviousOnLineIgnoringLineBreak should skip over WBRs
https://bugs.webkit.org/show_bug.cgi?id=224545
rdar://76101143

Reviewed by Zalan Bujtas.

Test: fast/editing/wbr-iterator-crash.html

* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::RunIterator::traverseNextOnLineIgnoringLineBreak):
(WebCore::LayoutIntegration::RunIterator::traversePreviousOnLineIgnoringLineBreak):

Skip over (instead of bailing) runs with isLineBreak() set. It is true for <WBR> so there can be multiple on a line.

2021-04-14 Lauro Moura <lmoura@igalia.com>

REGRESSION(r275948) Wrap sh::ShaderVariable into UniqueRef to fit in HashMap
@@ -131,17 +131,17 @@ RunIterator& RunIterator::traversePreviousOnLine()

RunIterator& RunIterator::traverseNextOnLineIgnoringLineBreak()
{
traverseNextOnLine();
if (!atEnd() && m_run.isLineBreak())
setAtEnd();
do {
traverseNextOnLine();
} while (!atEnd() && m_run.isLineBreak());
return *this;
}

RunIterator& RunIterator::traversePreviousOnLineIgnoringLineBreak()
{
traversePreviousOnLine();
if (!atEnd() && m_run.isLineBreak())
setAtEnd();
do {
traversePreviousOnLine();
} while (!atEnd() && m_run.isLineBreak());
return *this;
}

0 comments on commit 5ae9cbe

Please sign in to comment.