Skip to content

Commit

Permalink
Remove Quirk needsToForceUserSelectAndUserDragWhenInstallingImageOverlay
Browse files Browse the repository at this point in the history
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
  • Loading branch information
karlcow committed Apr 13, 2023
1 parent 5429ef9 commit 2dd8ae9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 31 deletions.
6 changes: 0 additions & 6 deletions Source/WebCore/dom/ImageOverlay.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 0 additions & 21 deletions Source/WebCore/page/Quirks.cpp
Expand Up @@ -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
{
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/page/Quirks.h
Expand Up @@ -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
Expand Down

0 comments on commit 2dd8ae9

Please sign in to comment.