Title: [286366] trunk/Source/WebCore
Revision
286366
Author
wenson_hs...@apple.com
Date
2021-12-01 09:09:44 -0800 (Wed, 01 Dec 2021)

Log Message

Adjust a Live Text quirk so that it applies to YouTube image thumbnails
https://bugs.webkit.org/show_bug.cgi?id=233670

Reviewed by Devin Rousso.

Augment this existing quirk so that it (1) applies to YouTube as well, and (2) also forces `-webkit-user-drag`
to be `auto`.

* dom/ImageOverlay.cpp:
(WebCore::ImageOverlay::updateSubtree):
* page/Quirks.cpp:
(WebCore::Quirks::needsToForceUserSelectAndUserDragWhenInstallingImageOverlay const):
(WebCore::Quirks::needsToForceUserSelectWhenInstallingImageOverlay const): Deleted.
* page/Quirks.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286365 => 286366)


--- trunk/Source/WebCore/ChangeLog	2021-12-01 17:04:27 UTC (rev 286365)
+++ trunk/Source/WebCore/ChangeLog	2021-12-01 17:09:44 UTC (rev 286366)
@@ -1,3 +1,20 @@
+2021-12-01  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Adjust a Live Text quirk so that it applies to YouTube image thumbnails
+        https://bugs.webkit.org/show_bug.cgi?id=233670
+
+        Reviewed by Devin Rousso.
+
+        Augment this existing quirk so that it (1) applies to YouTube as well, and (2) also forces `-webkit-user-drag`
+        to be `auto`.
+
+        * dom/ImageOverlay.cpp:
+        (WebCore::ImageOverlay::updateSubtree):
+        * page/Quirks.cpp:
+        (WebCore::Quirks::needsToForceUserSelectAndUserDragWhenInstallingImageOverlay const):
+        (WebCore::Quirks::needsToForceUserSelectWhenInstallingImageOverlay const): Deleted.
+        * page/Quirks.h:
+
 2021-12-01  Antti Koivisto  <an...@apple.com>
 
         [:has() pseudo-class] Sibling combinator invalidation

Modified: trunk/Source/WebCore/dom/ImageOverlay.cpp (286365 => 286366)


--- trunk/Source/WebCore/dom/ImageOverlay.cpp	2021-12-01 17:04:27 UTC (rev 286365)
+++ trunk/Source/WebCore/dom/ImageOverlay.cpp	2021-12-01 17:09:44 UTC (rev 286366)
@@ -351,8 +351,10 @@
             elements.blocks.uncheckedAppend(WTFMove(blockContainer));
         }
 
-        if (document->quirks().needsToForceUserSelectWhenInstallingImageOverlay())
+        if (document->quirks().needsToForceUserSelectAndUserDragWhenInstallingImageOverlay()) {
             element.setInlineStyleProperty(CSSPropertyWebkitUserSelect, CSSValueText);
+            element.setInlineStyleProperty(CSSPropertyWebkitUserDrag, CSSValueAuto);
+        }
     }
 
     if (!hadExistingElements) {

Modified: trunk/Source/WebCore/page/Quirks.cpp (286365 => 286366)


--- trunk/Source/WebCore/page/Quirks.cpp	2021-12-01 17:04:27 UTC (rev 286365)
+++ trunk/Source/WebCore/page/Quirks.cpp	2021-12-01 17:09:44 UTC (rev 286366)
@@ -1448,7 +1448,7 @@
 
 #if ENABLE(IMAGE_ANALYSIS)
 
-bool Quirks::needsToForceUserSelectWhenInstallingImageOverlay() const
+bool Quirks::needsToForceUserSelectAndUserDragWhenInstallingImageOverlay() const
 {
     if (!needsQuirks())
         return false;
@@ -1457,6 +1457,10 @@
     if (topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path() == "/search")
         return true;
 
+    auto host = url.host();
+    if (equalLettersIgnoringASCIICase(host, "youtube.com") || host.endsWithIgnoringASCIICase(".youtube.com"))
+        return true;
+
     return false;
 }
 

Modified: trunk/Source/WebCore/page/Quirks.h (286365 => 286366)


--- trunk/Source/WebCore/page/Quirks.h	2021-12-01 17:04:27 UTC (rev 286365)
+++ trunk/Source/WebCore/page/Quirks.h	2021-12-01 17:09:44 UTC (rev 286366)
@@ -154,7 +154,7 @@
     static bool shouldOmitHTMLDocumentSupportedPropertyNames();
 
 #if ENABLE(IMAGE_ANALYSIS)
-    bool needsToForceUserSelectWhenInstallingImageOverlay() const;
+    bool needsToForceUserSelectAndUserDragWhenInstallingImageOverlay() const;
 #endif
 
 private:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to