Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5387029f37335aefb7c6a2fa4fec42b58a0f1aef
      
https://github.com/WebKit/WebKit/commit/5387029f37335aefb7c6a2fa4fec42b58a0f1aef
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M Source/WebCore/editing/TextManipulationController.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm

  Log Message:
  -----------
  [Webpage Translation] Text fields are incorrectly translated after invoking 
AutoFill
https://bugs.webkit.org/show_bug.cgi?id=275878
rdar://130413693

Reviewed by Abrar Rahman Protyasha.

Make a couple of minor adjustments to avoid extracting text within text fields, 
in the case where
the user has inserted text in those fields via AutoFill. See below for more 
details.

Test: TextManipulation.CompleteTextManipulationDoesNotFillAutoFilledField

* Source/WebCore/editing/TextManipulationController.cpp:
(WebCore::shouldExtractValueForTextManipulation):

Add a FIXME regarding how we directly check against for `type='text'` instead 
of using the effective
`type()`.

(WebCore::shouldIgnoreNodeInTextField):

Add a helper function to check whether a node is inside of an AutoFilled or 
user-edited text field,
and deploy it in several places below.

(WebCore::TextManipulationController::scheduleObservationUpdate):

Check whether the node should be ignored, before observing it.

(WebCore::TextManipulationController::replace):

Run another check right before replacement, to ensure that we don't replace 
text in the node if:

1. An observation update runs.
2. The node is AutoFilled.
3. Replacement results arrive.

We bail early with `ContentChanged`, since the node has become AutoFilled in 
between the observation
and replacement.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TestWebKitAPI::TEST(TextManipulation, 
CompleteTextManipulationDoesNotFillAutoFilledField)):

Add an API test to exercise the change.

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



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

Reply via email to