Title: [287522] trunk
Revision
287522
Author
wenson_hs...@apple.com
Date
2022-01-02 12:19:40 -0800 (Sun, 02 Jan 2022)

Log Message

[WebKit2] Camera continuity is disabled in richly editable content
https://bugs.webkit.org/show_bug.cgi?id=234773
rdar://46323417

Reviewed by Darin Adler.

Source/WebKit:

`-[WKWebView validRequestorForSendType:returnType:]` currently never returns a nonnull result when the given
send type is nil, because `WebViewImpl::validRequestorForSendAndReturnTypes` only sets `isValidSendType` to
anything other than false if `sendType` is nonnull. Instead of doing this, we should match legacy WebKit
behavior by treating the send type as "valid" if it's nil.

Test: NSResponderTests.ValidRequestorForReturnTypes

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):

Source/WebKitLegacy/mac:

Drive-by fix: add a missing `ALLOW_DEPRECATED_DECLARATIONS_END` for the unbalanced BEGIN declaration.

* WebView/WebHTMLView.mm:
(+[WebHTMLView _insertablePasteboardTypes]):

Tools:

Add an API test to verify that the result of `-validRequestorForSendType:returnType:` isn't always `nil` in the
case where there is no send type.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/NSResponderTests.mm: Added.
(TestWebKitAPI::TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (287521 => 287522)


--- trunk/Source/WebKit/ChangeLog	2022-01-02 19:05:11 UTC (rev 287521)
+++ trunk/Source/WebKit/ChangeLog	2022-01-02 20:19:40 UTC (rev 287522)
@@ -1,3 +1,21 @@
+2022-01-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [WebKit2] Camera continuity is disabled in richly editable content
+        https://bugs.webkit.org/show_bug.cgi?id=234773
+        rdar://46323417
+
+        Reviewed by Darin Adler.
+
+        `-[WKWebView validRequestorForSendType:returnType:]` currently never returns a nonnull result when the given
+        send type is nil, because `WebViewImpl::validRequestorForSendAndReturnTypes` only sets `isValidSendType` to
+        anything other than false if `sendType` is nonnull. Instead of doing this, we should match legacy WebKit
+        behavior by treating the send type as "valid" if it's nil.
+
+        Test: NSResponderTests.ValidRequestorForReturnTypes
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):
+
 2022-01-01  Jeff Miller  <je...@apple.com>
 
         Update user-visible copyright strings to include 2022

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (287521 => 287522)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-01-02 19:05:11 UTC (rev 287521)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-01-02 20:19:40 UTC (rev 287522)
@@ -2973,7 +2973,7 @@
 id WebViewImpl::validRequestorForSendAndReturnTypes(NSString *sendType, NSString *returnType)
 {
     EditorState editorState = m_page->editorState();
-    bool isValidSendType = false;
+    bool isValidSendType = !sendType;
 
     if (sendType && !editorState.selectionIsNone) {
         if (editorState.isInPlugin)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (287521 => 287522)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2022-01-02 19:05:11 UTC (rev 287521)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2022-01-02 20:19:40 UTC (rev 287522)
@@ -1,3 +1,16 @@
+2022-01-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [WebKit2] Camera continuity is disabled in richly editable content
+        https://bugs.webkit.org/show_bug.cgi?id=234773
+        rdar://46323417
+
+        Reviewed by Darin Adler.
+
+        Drive-by fix: add a missing `ALLOW_DEPRECATED_DECLARATIONS_END` for the unbalanced BEGIN declaration.
+
+        * WebView/WebHTMLView.mm:
+        (+[WebHTMLView _insertablePasteboardTypes]):
+
 2022-01-01  Jeff Miller  <je...@apple.com>
 
         Update user-visible copyright strings to include 2022

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (287521 => 287522)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2022-01-02 19:05:11 UTC (rev 287521)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2022-01-02 20:19:40 UTC (rev 287522)
@@ -1917,6 +1917,7 @@
         WebCore::legacyPDFPasteboardType(), WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(),
         WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), (NSString *)kUTTypePNG,
     ];
+ALLOW_DEPRECATED_DECLARATIONS_END
     return types.get().get();
 }
 

Modified: trunk/Tools/ChangeLog (287521 => 287522)


--- trunk/Tools/ChangeLog	2022-01-02 19:05:11 UTC (rev 287521)
+++ trunk/Tools/ChangeLog	2022-01-02 20:19:40 UTC (rev 287522)
@@ -1,3 +1,18 @@
+2022-01-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [WebKit2] Camera continuity is disabled in richly editable content
+        https://bugs.webkit.org/show_bug.cgi?id=234773
+        rdar://46323417
+
+        Reviewed by Darin Adler.
+
+        Add an API test to verify that the result of `-validRequestorForSendType:returnType:` isn't always `nil` in the
+        case where there is no send type.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/mac/NSResponderTests.mm: Added.
+        (TestWebKitAPI::TEST):
+
 2022-01-01  Jean-Yves Avenard  <j...@apple.com>
 
         make SharedBuffer::copy() return a contiguous SharedBuffer

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (287521 => 287522)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-01-02 19:05:11 UTC (rev 287521)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-01-02 20:19:40 UTC (rev 287522)
@@ -1066,6 +1066,7 @@
 		F46A095B1ED8A6E600D4AA55 /* gif-and-file-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */; };
 		F46BD56924870643008282D6 /* dragstart-data.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46BD5682487062D008282D6 /* dragstart-data.html */; };
 		F46D43AB26D7092800969E5E /* test.jpg in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46D43AA26D7090300969E5E /* test.jpg */; };
+		F472874727816BCE003EBE7F /* NSResponderTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F43C3823278133190099ABCE /* NSResponderTests.mm */; };
 		F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; };
 		F47DFB2621A878DF00021FB6 /* data-detectors.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47DFB2421A8704A00021FB6 /* data-detectors.html */; };
 		F4856CA31E649EA8009D7EE7 /* attachment-element.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4856CA21E6498A8009D7EE7 /* attachment-element.html */; };
@@ -2974,6 +2975,7 @@
 		F42F081727449FFD007E0D90 /* ImageAnalysisTestingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageAnalysisTestingUtilities.h; path = cocoa/ImageAnalysisTestingUtilities.h; sourceTree = "<group>"; };
 		F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollToRevealSelection.mm; sourceTree = "<group>"; };
 		F4352F9E26D4037000E605E4 /* editable-responsive-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-responsive-body.html"; sourceTree = "<group>"; };
+		F43C3823278133190099ABCE /* NSResponderTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NSResponderTests.mm; sourceTree = "<group>"; };
 		F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKScrollViewTests.mm; sourceTree = "<group>"; };
 		F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "fixed-nav-bar.html"; sourceTree = "<group>"; };
 		F442851B2140DF2900CCDA22 /* NSFontPanelTesting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSFontPanelTesting.h; sourceTree = "<group>"; };
@@ -4813,6 +4815,7 @@
 				5C0BF88C1DD5957400B00328 /* MemoryPressureHandler.mm */,
 				7A99D9931AD4A29D00373141 /* MenuTypesForMouseEvents.mm */,
 				83F22C6320B355EB0034277E /* NoPolicyDelegateResponse.mm */,
+				F43C3823278133190099ABCE /* NSResponderTests.mm */,
 				A57A34EF16AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm */,
 				37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */,
 				3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */,
@@ -5607,6 +5610,7 @@
 				83F22C6420B355F80034277E /* NoPolicyDelegateResponse.mm in Sources */,
 				5159F267260D43E300B2DA3C /* NowPlayingInfoTests.cpp in Sources */,
 				F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */,
+				F472874727816BCE003EBE7F /* NSResponderTests.mm in Sources */,
 				2D70059921EDA4D0003463CB /* OffscreenWindow.mm in Sources */,
 				1CB2F27C24F88379000A5BC1 /* OrthogonalFlowAvailableSize.mm in Sources */,
 				0F34077623037FDC0060A1A0 /* OverflowScrollViewTests.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/mac/NSResponderTests.mm (0 => 287522)


--- trunk/Tools/TestWebKitAPI/Tests/mac/NSResponderTests.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/NSResponderTests.mm	2022-01-02 20:19:40 UTC (rev 287522)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "Test.h"
+
+#import "TestWKWebView.h"
+#import <WebKit/WKWebViewPrivate.h>
+
+namespace TestWebKitAPI {
+
+TEST(NSResponderTests, ValidRequestorForReturnTypes)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] init]);
+    [webView _setEditable:YES];
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+    [webView stringByEvaluatingJavaScript:@"getSelection().setPosition(document.body)"];
+    [webView waitForNextPresentationUpdate];
+
+    EXPECT_EQ(webView.get(), [webView validRequestorForSendType:nil returnType:(__bridge NSString *)kUTTypePNG]);
+    EXPECT_NULL([webView validRequestorForSendType:nil returnType:(__bridge NSString *)kUTTypeAppleScript]);
+}
+
+} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to