Diff
Modified: trunk/LayoutTests/ChangeLog (274697 => 274698)
--- trunk/LayoutTests/ChangeLog 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/LayoutTests/ChangeLog 2021-03-19 02:56:02 UTC (rev 274698)
@@ -1,3 +1,18 @@
+2021-03-18 Aditya Keerthi <[email protected]>
+
+ [iOS] Update strings and icons in the file upload panel
+ https://bugs.webkit.org/show_bug.cgi?id=223463
+ <rdar://problem/74999459>
+
+ Reviewed by Tim Horton.
+
+ Updated existing tests to use async/await rather than promise chaining,
+ and added new tests that exercise the "multiple" attribute on file
+ inputs.
+
+ * fast/forms/ios/file-upload-panel-expected.txt:
+ * fast/forms/ios/file-upload-panel.html:
+
2021-03-18 Imanol Fernandez <[email protected]>
Implement WebXR Opaque Framebuffer
Modified: trunk/LayoutTests/fast/forms/ios/file-upload-panel-expected.txt (274697 => 274698)
--- trunk/LayoutTests/fast/forms/ios/file-upload-panel-expected.txt 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/LayoutTests/fast/forms/ios/file-upload-panel-expected.txt 2021-03-19 02:56:02 UTC (rev 274698)
@@ -4,35 +4,41 @@
* accept =
-PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Choose File"]) is true
* accept = image/*
-PASS areArraysEqual(items, ["Photo Library", "Take Photo", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Photo", "Choose File"]) is true
* accept = video/*
-PASS areArraysEqual(items, ["Photo Library", "Take Video", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Video", "Choose File"]) is true
* accept = image/*, video/*
-PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Choose File"]) is true
* accept = .PNG, .GIF
-PASS areArraysEqual(items, ["Photo Library", "Take Photo", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Photo", "Choose File"]) is true
* accept = .PNG, .GIF, .MOV
-PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Choose File"]) is true
* accept = audio/*
-PASS areArraysEqual(items, ["Photo Library", "Take Video", "Browse"]) is true
+PASS areArraysEqual(items, ["Photo Library", "Take Video", "Choose File"]) is true
* accept = .TXT
-PASS areArraysEqual(items, ["Browse"]) is true
+PASS areArraysEqual(items, ["Choose File"]) is true
* accept = .PDF
-PASS areArraysEqual(items, ["Browse"]) is true
+PASS areArraysEqual(items, ["Choose File"]) is true
* accept = .PDF, .TXT
-PASS areArraysEqual(items, ["Browse"]) is true
+PASS areArraysEqual(items, ["Choose File"]) is true
+* multiple = false
+PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Choose File"]) is true
+
+* multiple = true
+PASS areArraysEqual(items, ["Photo Library", "Take Photo or Video", "Choose Files"]) is true
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/forms/ios/file-upload-panel.html (274697 => 274698)
--- trunk/LayoutTests/fast/forms/ios/file-upload-panel.html 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/LayoutTests/fast/forms/ios/file-upload-panel.html 2021-03-19 02:56:02 UTC (rev 274698)
@@ -21,16 +21,6 @@
})();`
}
-function dismissFilePickerScript()
-{
- return `
- (function() {
- uiController.dismissFilePicker(function() {
- uiController.uiScriptComplete();
- });
- })();`
-}
-
function getFileUploadPickerMenuItems()
{
return new Promise((resolve) => {
@@ -40,28 +30,31 @@
});
}
-function dismissFilePicker()
+async function verifyMenuItems(expectedMenuItems) {
+ await UIHelper.activateElement(testInput);
+ items = await getFileUploadPickerMenuItems();
+ shouldBeTrue("areArraysEqual(items, " + expectedMenuItems + ")");
+
+ debug("");
+ await UIHelper.dismissFilePicker();
+}
+
+async function runAcceptTest(accept, expectedMenuItems)
{
- const uiScript = `uiController.dismissFilePicker(() => uiController.uiScriptComplete())`;
- return new Promise(resolve => testRunner.runUIScript(uiScript, resolve));
+ debug("* accept = " + accept);
+ testInput.accept = accept;
+ testInput.multiple = false;
+
+ await verifyMenuItems(expectedMenuItems);
}
-function runAcceptTest(accept, expectedMenuItems)
+async function runMultipleTest(multiple, expectedMenuItems)
{
- return new Promise((resolve) => {
- debug("* accept = " + accept);
- testInput.accept = accept;
+ debug("* multiple = " + multiple)
+ testInput.accept = "";
+ testInput.multiple = multiple;
- UIHelper.activateElement(testInput).then(() => {
- getFileUploadPickerMenuItems().then((_items) => {
- items = _items;
- shouldBeTrue("areArraysEqual(items, " + expectedMenuItems + ")");
-
- debug("");
- dismissFilePicker().then(() => { resolve(); });
- });
- });
- });
+ await verifyMenuItems(expectedMenuItems);
}
async function runTests()
@@ -68,17 +61,20 @@
{
document.getElementById("console").style = "display: none";
- await runAcceptTest("", '["Photo Library", "Take Photo or Video", "Browse"]');
- await runAcceptTest("image/*", '["Photo Library", "Take Photo", "Browse"]');
- await runAcceptTest("video/*", '["Photo Library", "Take Video", "Browse"]');
- await runAcceptTest("image/*, video/*", '["Photo Library", "Take Photo or Video", "Browse"]');
- await runAcceptTest(".PNG, .GIF", '["Photo Library", "Take Photo", "Browse"]');
- await runAcceptTest(".PNG, .GIF, .MOV", '["Photo Library", "Take Photo or Video", "Browse"]');
- await runAcceptTest("audio/*", '["Photo Library", "Take Video", "Browse"]');
- await runAcceptTest(".TXT", '["Browse"]');
- await runAcceptTest(".PDF", '["Browse"]');
- await runAcceptTest(".PDF, .TXT", '["Browse"]');
+ await runAcceptTest("", '["Photo Library", "Take Photo or Video", "Choose File"]');
+ await runAcceptTest("image/*", '["Photo Library", "Take Photo", "Choose File"]');
+ await runAcceptTest("video/*", '["Photo Library", "Take Video", "Choose File"]');
+ await runAcceptTest("image/*, video/*", '["Photo Library", "Take Photo or Video", "Choose File"]');
+ await runAcceptTest(".PNG, .GIF", '["Photo Library", "Take Photo", "Choose File"]');
+ await runAcceptTest(".PNG, .GIF, .MOV", '["Photo Library", "Take Photo or Video", "Choose File"]');
+ await runAcceptTest("audio/*", '["Photo Library", "Take Video", "Choose File"]');
+ await runAcceptTest(".TXT", '["Choose File"]');
+ await runAcceptTest(".PDF", '["Choose File"]');
+ await runAcceptTest(".PDF, .TXT", '["Choose File"]');
+ await runMultipleTest(false, '["Photo Library", "Take Photo or Video", "Choose File"]');
+ await runMultipleTest(true, '["Photo Library", "Take Photo or Video", "Choose Files"]');
+
document.getElementById("console").style = "";
finishJSTest();
}
Modified: trunk/Source/WebCore/ChangeLog (274697 => 274698)
--- trunk/Source/WebCore/ChangeLog 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/Source/WebCore/ChangeLog 2021-03-19 02:56:02 UTC (rev 274698)
@@ -1,3 +1,20 @@
+2021-03-18 Aditya Keerthi <[email protected]>
+
+ [iOS] Update strings and icons in the file upload panel
+ https://bugs.webkit.org/show_bug.cgi?id=223463
+ <rdar://problem/74999459>
+
+ Reviewed by Tim Horton.
+
+ * en.lproj/Localizable.strings:
+
+ Removed unused string.
+
+ * platform/LocalizedStrings.h:
+
+ WEBCORE_EXPORT the "Choose File" and "Choose Files" strings so that
+ they can be used in the WebKit layer.
+
2021-03-18 Imanol Fernandez <[email protected]>
Implement WebXR Opaque Framebuffer
Modified: trunk/Source/WebCore/en.lproj/Localizable.strings (274697 => 274698)
--- trunk/Source/WebCore/en.lproj/Localizable.strings 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/Source/WebCore/en.lproj/Localizable.strings 2021-03-19 02:56:02 UTC (rev 274698)
@@ -190,9 +190,6 @@
/* Label for the book with Apple Pay button. */
"Book with Apple Pay" = "Book with Apple Pay";
-/* File Upload alert sheet button string for choosing an existing file from the file brower */
-"Browse (file upload action sheet)" = "Browse";
-
/* Option in segmented control for inserting a bulleted list in text editing */
"Bulleted list" = "Bulleted list";
Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (274697 => 274698)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2021-03-19 02:56:02 UTC (rev 274698)
@@ -41,8 +41,8 @@
String resetButtonDefaultLabel();
String searchableIndexIntroduction();
String submitButtonDefaultLabel();
- String fileButtonChooseFileLabel();
- String fileButtonChooseMultipleFilesLabel();
+ WEBCORE_EXPORT String fileButtonChooseFileLabel();
+ WEBCORE_EXPORT String fileButtonChooseMultipleFilesLabel();
String fileButtonNoFileSelectedLabel();
String fileButtonNoFilesSelectedLabel();
String defaultDetailsSummaryText();
Modified: trunk/Source/WebKit/ChangeLog (274697 => 274698)
--- trunk/Source/WebKit/ChangeLog 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/Source/WebKit/ChangeLog 2021-03-19 02:56:02 UTC (rev 274698)
@@ -1,3 +1,21 @@
+2021-03-18 Aditya Keerthi <[email protected]>
+
+ [iOS] Update strings and icons in the file upload panel
+ https://bugs.webkit.org/show_bug.cgi?id=223463
+ <rdar://problem/74999459>
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/ios/forms/WKFileUploadPanel.mm:
+ (-[WKFileUploadPanel currentAvailableActionTitles]):
+
+ Expose the new string for testing.
+
+ (-[WKFileUploadPanel _chooseFilesButtonLabel]):
+ (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
+
+ Use the "folder" SF symbol as the icon for the "Choose File" action.
+
2021-03-18 BJ Burg <[email protected]>
[Cocoa] Web Inspector: load inspector resources using a custom scheme handler
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (274697 => 274698)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2021-03-19 02:37:52 UTC (rev 274697)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2021-03-19 02:56:02 UTC (rev 274698)
@@ -340,7 +340,7 @@
else
[actionTitles addObject:@"Take Photo"];
}
- [actionTitles addObject:@"Browse"];
+ [actionTitles addObject:[self _chooseFilesButtonLabel]];
return actionTitles;
}
@@ -405,9 +405,12 @@
#pragma mark - Source selection menu
-- (NSString *)_browseFilesButtonLabel
+- (NSString *)_chooseFilesButtonLabel
{
- return WEB_UI_STRING_KEY("Browse", "Browse (file upload action sheet)", "File Upload alert sheet button string for choosing an existing file from the file brower");
+ if (_allowMultipleFiles)
+ return WebCore::fileButtonChooseMultipleFilesLabel();
+
+ return WebCore::fileButtonChooseFileLabel();
}
- (NSString *)_photoLibraryButtonLabel
@@ -452,7 +455,7 @@
return nil;
self->_isPresentingSubMenu = NO;
- UIAction *browseAction = [UIAction actionWithTitle:[strongSelf _browseFilesButtonLabel] image:[UIImage systemImageNamed:@"ellipsis"] identifier:@"browse" handler:^(__kindof UIAction *action) {
+ UIAction *chooseAction = [UIAction actionWithTitle:[strongSelf _chooseFilesButtonLabel] image:[UIImage systemImageNamed:@"folder"] identifier:@"choose" handler:^(__kindof UIAction *action) {
self->_isPresentingSubMenu = YES;
[self showFilePickerMenu];
}];
@@ -469,9 +472,9 @@
self->_isPresentingSubMenu = YES;
[self _showPhotoPickerWithSourceType:UIImagePickerControllerSourceTypeCamera];
}];
- actions = @[photoAction, cameraAction, browseAction];
+ actions = @[photoAction, cameraAction, chooseAction];
} else
- actions = @[photoAction, browseAction];
+ actions = @[photoAction, chooseAction];
return [UIMenu menuWithTitle:@"" children:actions];
};