[webkit-changes] [WebKit/WebKit] 786e20: VisibleSelection::nonBoundaryShadowTreeRootNode sh...

Chris Dumez noreply at github.com
Tue Aug 1 21:21:27 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 786e20b521453e0fc5c7ee7734aaa3a3e04e19ba
      https://github.com/WebKit/WebKit/commit/786e20b521453e0fc5c7ee7734aaa3a3e04e19ba
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-08-01 (Tue, 01 Aug 2023)

  Changed paths:
    A LayoutTests/fast/forms/ua-shadow-select-all-behavior-expected.txt
    A LayoutTests/fast/forms/ua-shadow-select-all-behavior.html
    A LayoutTests/fast/forms/ua-shadow-select-all-crash-expected.txt
    A LayoutTests/fast/forms/ua-shadow-select-all-crash.html
    M LayoutTests/platform/mac-wk1/TestExpectations
    M Source/WebCore/editing/VisibleSelection.cpp

  Log Message:
  -----------
  VisibleSelection::nonBoundaryShadowTreeRootNode should return null when its anchor is a shadow root
https://bugs.webkit.org/show_bug.cgi?id=249862
rdar://103683388

Reviewed by Ryosuke Niwa.

Cherry-pick the following fix from Blink:
https://src.chromium.org/viewvc/blink?view=revision&revision=188788

While WebKit doesn't crash in release with the Blink test case, it does
hit the `ASSERT(!isShadowRoot());` assertion inside `Node::nonBoundaryShadowTreeRootNode()`
on debug builds. Also, our selection behavior was vastly different from Chrome and Firefox.
We would end up with a caret while Blink and Gecko would end up with a proper range
selection. This patch aligns our behavior with Blink.

* LayoutTests/fast/forms/ua-shadow-select-all-behavior-expected.txt: Added.
* LayoutTests/fast/forms/ua-shadow-select-all-behavior.html: Added.
* LayoutTests/fast/forms/ua-shadow-select-all-crash.html: Added.
* LayoutTests/fast/forms/ua-shadow-select-all-crash-expected.txt: Added.
* Source/WebCore/editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::nonBoundaryShadowTreeRootNode const):

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




More information about the webkit-changes mailing list