[webkit-changes] [WebKit/WebKit] 01527b: Cannot select text within a label element that is ...

Ahmad Saleem noreply at github.com
Wed Apr 26 11:15:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 01527bde393728d7c127bcc2b777baa4397c75c0
      https://github.com/WebKit/WebKit/commit/01527bde393728d7c127bcc2b777baa4397c75c0
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-04-26 (Wed, 26 Apr 2023)

  Changed paths:
    A LayoutTests/fast/forms/label/label-selection-expected.txt
    A LayoutTests/fast/forms/label/label-selection.html
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/html/HTMLLabelElement.cpp

  Log Message:
  -----------
  Cannot select text within a label element that is linked to an input field

https://bugs.webkit.org/show_bug.cgi?id=96734

Reviewed by Aditya Keerthi.

This patch aligns WebKit with Blink / Chromium and Gecko / Firefox.

Merge - https://src.chromium.org/viewvc/blink?view=revision&revision=174296 &
https://src.chromium.org/viewvc/blink?view=revision&revision=174818

Any click event on label goes to its control element. So, if
we tried to select the text inside label by dragging the mouse
or by double clicking on the text, it went to its control
element. This patch checks whether there is selection or not,
after the click is happened. If there is selection then do
nothing else continue.

If document is detached and click event is generated on
a label element, it causes a crash as the document doesn't
have frame. So adding additional check for LocalFrame.

* Source/WebCore/html/HTMLLabelElement.cpp:
(HTMLLabelElement::isEventTargetedAtInteractiveDescendants):
* LayoutTests/fast/forms/label/label-selection.html: Add Test Case
* LayoutTests/fast/forms/label/label-selection-expected.txt: Add Test Case Expectation
* LayoutTests/platform/ios/TestExpectations: Skip test due to lack of MouseEvent support on iOS platform

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




More information about the webkit-changes mailing list