Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b84c3ea8c264bb4451e08e0060d664212097c3b
      
https://github.com/WebKit/WebKit/commit/4b84c3ea8c264bb4451e08e0060d664212097c3b
  Author: Tyler Wilcock <[email protected]>
  Date:   2024-07-18 (Thu, 18 Jul 2024)

  Changed paths:
    A 
LayoutTests/accessibility/mixed-contenteditable-double-br-visible-character-range-hang-expected.txt
    A 
LayoutTests/accessibility/mixed-contenteditable-double-br-visible-character-range-hang.html
    A 
LayoutTests/accessibility/mixed-contenteditable-visible-character-range-hang-expected.txt
    A 
LayoutTests/accessibility/mixed-contenteditable-visible-character-range-hang.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/ios/TestExpectations
    A 
LayoutTests/platform/ios/accessibility/mixed-contenteditable-double-br-visible-character-range-hang-expected.txt
    A 
LayoutTests/platform/ios/accessibility/mixed-contenteditable-visible-character-range-hang-expected.txt
    M LayoutTests/platform/mac-wk1/TestExpectations
    M Source/WebCore/accessibility/AccessibilityObject.cpp

  Log Message:
  -----------
  AX: WebCore::endOfLine can return the same position it started with, causing 
an infinite loop when iterating over `AccessibilityObject::nextLineEndPosition`s
https://bugs.webkit.org/show_bug.cgi?id=276656
rdar://131837344

Reviewed by Andres Gonzalez.

In `WebCore::endOfLine(const VisiblePosition& input)`, the input position is 
taken, and an `endPositionForLine` is
computed. It then checks to ensure that `inSameLine(input, computedEnd)`, and 
if not, it walks `previous()` one position
from `input` and gets the `endPositionForLine` of that position.

This all makes sense on the surface. `endOfLine`s job is to find the end 
position of the line `input` belongs to. The
problem is that `inSameLine` does not arguably work intuitively — it returns 
false if position A is editable, while
position B is not, even if they are rendered on the same line.

This mixed editability is present in markup on Google Docs documents:

<span class="text-style">Line of text</span><span contenteditable="false"> <br 
role="presentation"/></span>

There is a single space character before the br element, and if that position 
is compared with any earlier one,
`inSameLine` will return false.

I did try passing a flag through to `isSameLine` that ignored this editability 
requirement, but there are other ways
to trigger this behavior too, so the bug persisted. Instead, I've made 
nextLineEndPosition resilient to this issue
by looping until we have moved off the start position.

Two testcases added — these hang indefinitely without the changes in this 
commit.

* 
LayoutTests/accessibility/mixed-contenteditable-double-br-visible-character-range-hang-expected.txt:
 Added.
* 
LayoutTests/accessibility/mixed-contenteditable-double-br-visible-character-range-hang.html:
 Added.
* 
LayoutTests/accessibility/mixed-contenteditable-visible-character-range-hang-expected.txt:
 Added.
* 
LayoutTests/accessibility/mixed-contenteditable-visible-character-range-hang.html:
 Added.
* LayoutTests/platform/glib/TestExpectations: Disable new tests.
* LayoutTests/platform/ios/TestExpectations: Enable new tests.
* 
LayoutTests/platform/ios/accessibility/mixed-contenteditable-double-br-visible-character-range-hang-expected.txt:
 Added.
* 
LayoutTests/platform/ios/accessibility/mixed-contenteditable-visible-character-range-hang-expected.txt:
 Added.
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::nextLineEndPosition const):

Canonical link: https://commits.webkit.org/281089@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to