Skip to content

Commit

Permalink
Keyboard incorrectly duplicates certain text corrections/fill
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271076
rdar://123642870

Reviewed by Abrar Rahman Protyasha.

Add a quirk to disable the `writingsuggestions` web API for the affected sites.

* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isWritingSuggestionsEnabled const):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldDisableWritingSuggestionsQuirk const):
* Source/WebCore/page/Quirks.h:

Canonical link: https://commits.webkit.org/276317@main
  • Loading branch information
rr-codes committed Mar 19, 2024
1 parent c52386b commit 215a08d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/WebCore/dom/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4795,6 +4795,9 @@ bool Element::isWritingSuggestionsEnabled() const
return false;
}

if (protectedDocument()->quirks().shouldDisableWritingSuggestionsByDefaultQuirk())
return false;

// Otherwise, return `true`.
return true;
}
Expand Down
14 changes: 14 additions & 0 deletions Source/WebCore/page/Quirks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,20 @@ bool Quirks::shouldDisableElementFullscreenQuirk() const
#endif
}

// rdar://123642870
bool Quirks::shouldDisableWritingSuggestionsByDefaultQuirk() const
{
if (!needsQuirks())
return false;

return isDomain("reddit.com"_s)
|| isDomain("discord.com"_s)
|| isDomain("twitch.tv"_s)
|| isDomain("godbolt.org"_s)
|| m_document->url().host().endsWith("officeapps.live.com"_s)
|| m_document->url().host().endsWith("onedrive.live.com"_s);
}

#if ENABLE(TOUCH_EVENTS)
bool Quirks::isAmazon() const
{
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/page/Quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class Quirks {
bool needsDisableDOMPasteAccessQuirk() const;

bool shouldDisableElementFullscreenQuirk() const;
bool shouldDisableWritingSuggestionsByDefaultQuirk() const;
bool shouldIgnorePlaysInlineRequirementQuirk() const;
WEBCORE_EXPORT bool shouldUseEphemeralPartitionedStorageForDOMCookies(const URL&) const;

Expand Down

2 comments on commit 215a08d

@loloismail
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loloismail
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404

Please sign in to comment.