[webkit-changes] [WebKit/WebKit] c48d71: REGRESSION(259904 at main): Comment editor on huffpos...

Ryosuke Niwa noreply at github.com
Tue Apr 4 01:23:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c48d7192b1295bb453bb8a0d3e1af78812967eca
      https://github.com/WebKit/WebKit/commit/c48d7192b1295bb453bb8a0d3e1af78812967eca
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2023-04-04 (Tue, 04 Apr 2023)

  Changed paths:
    A LayoutTests/fast/shadow-dom/selection-collapse-expected.txt
    A LayoutTests/fast/shadow-dom/selection-collapse.html
    M Source/WebCore/page/DOMSelection.cpp

  Log Message:
  -----------
  REGRESSION(259904 at main): Comment editor on huffpost.com doesn't update the caret position after inserting new line
https://bugs.webkit.org/show_bug.cgi?id=254957
<rdar://106426103>

Reviewed by Wenson Hsieh.

The bug was caused by DOMSelection::collapse exiting early due to the node being inside a shadow tree.
When live range selection is enabled, we exit early if frame->document()->contains(*node) isn’t true.
Fixed the bug by relaxing this restriction to allow a connected node of the same document.

This patch also relaxes the same restriction on DOMSelection::extend.

* LayoutTests/fast/shadow-dom/selection-collapse-expected.txt: Added.
* LayoutTests/fast/shadow-dom/selection-collapse.html: Added.
* Source/WebCore/page/DOMSelection.cpp:
(WebCore::DOMSelection::collapse): Fixed the bug by relaxing the condition for an early exit when
selectionAPIForShadowDOMEnabled returns true. Also made the check slightly more efficient by avoiding
the tree walk to find the root node in most cases.
(WebCore::DOMSelection::extend): Ditto.

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




More information about the webkit-changes mailing list