From 2dd8ae90d50536ab77acd3bcbb065220c44066db Mon Sep 17 00:00:00 2001 From: Karl Dubost Date: Thu, 13 Apr 2023 00:22:53 -0700 Subject: [PATCH] Remove Quirk needsToForceUserSelectAndUserDragWhenInstallingImageOverlay https://bugs.webkit.org/show_bug.cgi?id=254973 rdar://107576605 Reviewed by Wenson Hsieh. On YouTube and Google search, it was impossible to select the text appearing in images. The quirk solved this issue. It has been retested by Zohreh Momeni and it's working without the Quirk. This commit removes the quirk for both sites. google.com rdar://107617904 youtube.come rdar://107576605 * Source/WebCore/dom/ImageOverlay.cpp: (WebCore::ImageOverlay::updateSubtree): * Source/WebCore/page/Quirks.cpp: (WebCore::Quirks::needsToForceUserSelectAndUserDragWhenInstallingImageOverlay const): Deleted. * Source/WebCore/page/Quirks.h: Canonical link: https://commits.webkit.org/262907@main --- Source/WebCore/dom/ImageOverlay.cpp | 6 ------ Source/WebCore/page/Quirks.cpp | 21 --------------------- Source/WebCore/page/Quirks.h | 4 ---- 3 files changed, 31 deletions(-) diff --git a/Source/WebCore/dom/ImageOverlay.cpp b/Source/WebCore/dom/ImageOverlay.cpp index 51bcb3afd508..587e4ec38d82 100644 --- a/Source/WebCore/dom/ImageOverlay.cpp +++ b/Source/WebCore/dom/ImageOverlay.cpp @@ -47,7 +47,6 @@ #include "ImageOverlayController.h" #include "MediaControlsHost.h" #include "Page.h" -#include "Quirks.h" #include "RenderImage.h" #include "RenderText.h" #include "ShadowRoot.h" @@ -439,11 +438,6 @@ static Elements updateSubtree(HTMLElement& element, const TextRecognitionResult& elements.root->appendChild(blockContainer); elements.blocks.uncheckedAppend(WTFMove(blockContainer)); } - - if (document->quirks().needsToForceUserSelectAndUserDragWhenInstallingImageOverlay()) { - element.setInlineStyleProperty(CSSPropertyWebkitUserSelect, CSSValueText); - element.setInlineStyleProperty(CSSPropertyWebkitUserDrag, CSSValueAuto); - } } if (!hadExistingElements) diff --git a/Source/WebCore/page/Quirks.cpp b/Source/WebCore/page/Quirks.cpp index e1c38c275a20..78953e95ee8b 100644 --- a/Source/WebCore/page/Quirks.cpp +++ b/Source/WebCore/page/Quirks.cpp @@ -1411,27 +1411,6 @@ bool Quirks::shouldAllowNavigationToCustomProtocolWithoutUserGesture(StringView return protocol == "msteams"_s && (requesterOrigin.host() == "teams.live.com"_s || requesterOrigin.host() == "teams.microsoft.com"_s); } -#if ENABLE(IMAGE_ANALYSIS) -// google.com rdar://76500331 -// youtube.com https://bugs.webkit.org/show_bug.cgi?id=233670 -bool Quirks::needsToForceUserSelectAndUserDragWhenInstallingImageOverlay() const -{ - if (!needsQuirks()) - return false; - - auto& url = m_document->topDocument().url(); - if (topPrivatelyControlledDomain(url.host().toString()).startsWith("google."_s) && url.path() == "/search"_s) - return true; - - auto host = url.host(); - if (equalLettersIgnoringASCIICase(host, "youtube.com"_s) || host.endsWithIgnoringASCIICase(".youtube.com"_s)) - return true; - - return false; -} - -#endif // ENABLE(IMAGE_ANALYSIS) - #if PLATFORM(IOS) bool Quirks::allowLayeredFullscreenVideos() const { diff --git a/Source/WebCore/page/Quirks.h b/Source/WebCore/page/Quirks.h index 52f659c73400..5a12902c3037 100644 --- a/Source/WebCore/page/Quirks.h +++ b/Source/WebCore/page/Quirks.h @@ -147,10 +147,6 @@ class Quirks { static bool shouldOmitHTMLDocumentSupportedPropertyNames(); -#if ENABLE(IMAGE_ANALYSIS) - bool needsToForceUserSelectAndUserDragWhenInstallingImageOverlay() const; -#endif - #if PLATFORM(IOS) WEBCORE_EXPORT bool allowLayeredFullscreenVideos() const; #endif