Diff
Modified: trunk/LayoutTests/ChangeLog (221943 => 221944)
--- trunk/LayoutTests/ChangeLog 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/ChangeLog 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,3 +1,55 @@
+2017-09-12 Ryosuke Niwa <[email protected]>
+
+ Dragging & dropping a file creates an attachment element even when it's disabled
+ https://bugs.webkit.org/show_bug.cgi?id=176769
+
+ Reviewed by Tim Horton.
+
+ Updated the existing attachment element tests to use the newly added webkitt-test-runner flag,
+ and added a new test (drag-files-to-editable-element-as-URLs.html) to make sure we don't create
+ an attachment element when dropping a file.
+
+ * editing/pasteboard/copy-paste-attachment-expected.txt:
+ * editing/pasteboard/copy-paste-attachment.html:
+ * editing/pasteboard/drag-files-to-editable-element-as-URLs-expected.txt: Added.
+ * editing/pasteboard/drag-files-to-editable-element-as-URLs.html: Copied from
+ drag-files-to-editable-element.html.
+ * editing/pasteboard/drag-files-to-editable-element-as-attachment-expected.txt: Renamed from
+ drag-files-to-editable-element-expected.txt.
+ * editing/pasteboard/drag-files-to-editable-element-as-attachment.html: Renamed from
+ drag-files-to-editable-element.html.
+ * editing/pasteboard/drag-files-to-editable-element-expected.txt: Removed.
+ * editing/pasteboard/drag-files-to-editable-element.html: Removed.
+ * fast/attachment/attachment-action-expected.html:
+ * fast/attachment/attachment-action.html:
+ * fast/attachment/attachment-borderless-expected-mismatch.html:
+ * fast/attachment/attachment-borderless.html:
+ * fast/attachment/attachment-default-icon-expected.html:
+ * fast/attachment/attachment-default-icon.html:
+ * fast/attachment/attachment-dom.html:
+ * fast/attachment/attachment-folder-icon-expected.html:
+ * fast/attachment/attachment-folder-icon.html:
+ * fast/attachment/attachment-icon-from-file-extension-expected.html:
+ * fast/attachment/attachment-icon-from-file-extension.html:
+ * fast/attachment/attachment-label-highlight.html:
+ * fast/attachment/attachment-progress.html:
+ * fast/attachment/attachment-rendering.html:
+ * fast/attachment/attachment-respects-css-size.html:
+ * fast/attachment/attachment-select-on-click-inside-user-select-all.html:
+ * fast/attachment/attachment-select-on-click.html:
+ * fast/attachment/attachment-subtitle-resize.html:
+ * fast/attachment/attachment-subtitle.html:
+ * fast/attachment/attachment-title.html:
+ * fast/attachment/attachment-type-attribute-expected.html:
+ * fast/attachment/attachment-type-attribute.html:
+ * fast/attachment/attachment-uti-expected.html:
+ * fast/attachment/attachment-uti.html:
+ * fast/attachment/attachment-wrapping-action-expected-mismatch.html:
+ * fast/attachment/attachment-wrapping-action.html:
+ * platform/gtk/TestExpectations:
+ * platform/win/TestExpectations:
+ * platform/wk2/TestExpectations:
+
2017-09-12 Michael Catanzaro <[email protected]>
[GTK] Unreviewed, update crash expectations after r221925
Modified: trunk/LayoutTests/accessibility/attachment-element.html (221943 => 221944)
--- trunk/LayoutTests/accessibility/attachment-element.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/accessibility/attachment-element.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,13 +1,5 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<head>
-<meta charset="utf-8">
-<script src=""
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
-</head>
<body id="body">
<attachment id="attachment" title="title" subtitle="subtitle" action="" progress="0.5"></attachment>
@@ -15,6 +7,7 @@
<p id="description"></p>
<div id="console"></div>
+<script src=""
<script>
description("This tests that attachment elements are accessible.");
Modified: trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range.html (221943 => 221944)
--- trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/accessibility/ios-simulator/attributed-string-for-range.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,15 +1,5 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<head>
-<script>
-var successfullyParsed = false;
-</script>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
-<script src=""
-</head>
<body id="body">
<div id="content">
@@ -23,7 +13,7 @@
<p id="description"></p>
<div id="console"></div>
-
+<script src=""
<script>
description("This test ensures that attributed string for range works");
Modified: trunk/LayoutTests/accessibility/mac/attachment-element-replacement-character.html (221943 => 221944)
--- trunk/LayoutTests/accessibility/mac/attachment-element-replacement-character.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/accessibility/mac/attachment-element-replacement-character.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,13 +1,5 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<head>
-<meta charset="utf-8">
-<script src=""
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
-</head>
<body id="body">
some
@@ -17,6 +9,7 @@
<p id="description"></p>
<div id="console"></div>
+<script src=""
<script>
description("This tests that attachment element replacements are present in strings.");
Modified: trunk/LayoutTests/editing/pasteboard/copy-paste-attachment-expected.txt (221943 => 221944)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-attachment-expected.txt 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-attachment-expected.txt 2017-09-12 23:31:14 UTC (rev 221944)
@@ -12,3 +12,4 @@
TEST COMPLETE
This is a paragraph with an attachment and some other text.
+
Modified: trunk/LayoutTests/editing/pasteboard/copy-paste-attachment.html (221943 => 221944)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-attachment.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-attachment.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,17 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<head>
-<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
-<script src=""
-</head>
<body>
<div contenteditable="true" id="test1">This is a paragraph with an attachment
<attachment id='attachment'></attachment> and some other text.
</div>
+<script src=""
<script>
+
var file;
if (window.internals) {
var file = window.internals.createFile("../resources/abe.png");
Modified: trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html (221943 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,10 +1,6 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
<head>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<script src=""
<style>
#target {
Copied: trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-URLs-expected.txt (from rev 221943, trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-expected.txt) (0 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-URLs-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-URLs-expected.txt 2017-09-12 23:31:14 UTC (rev 221944)
@@ -0,0 +1,12 @@
+If we drag files onto an editable area, then attachments should be inserted into the editable area.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.HTMLAttachmentElement is undefined.
+PASS document.createElement("attachment") instanceof HTMLUnknownElement is true
+PASS editable.querySelector("attachment") is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-URLs.html (from rev 221943, trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element.html) (0 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-URLs.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-URLs.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -0,0 +1,38 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=false ] -->
+<html>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="editable" contentEditable=true style="width:200px; height:200px"></div>
+<script src=""
+<script>
+description('If we drag files onto an editable area, then attachments should be inserted into the editable area.');
+
+var editable = document.getElementById("editable");
+if (window.eventSender) {
+ dragFilesOntoEditable(['foo', 'bar', 'baz']);
+ shouldBeUndefined('window.HTMLAttachmentElement');
+ shouldBeTrue('document.createElement("attachment") instanceof HTMLUnknownElement');
+ shouldBe('editable.querySelector("attachment")', 'null');
+ editable.innerHTML = '';
+}
+
+function moveMouseToCenterOfElement(element)
+{
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function dragFilesOntoEditable(files)
+{
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(editable);
+ eventSender.mouseUp();
+}
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Copied: trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-attachment-expected.txt (from rev 221943, trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-expected.txt) (0 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-attachment-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-attachment-expected.txt 2017-09-12 23:31:14 UTC (rev 221944)
@@ -0,0 +1,13 @@
+If we drag files onto an editable area, then attachments should be inserted into the editable area.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS attachment.nodeName is "ATTACHMENT"
+PASS attachment.nodeName is "ATTACHMENT"
+PASS attachment.nodeName is "ATTACHMENT"
+PASS fileNames is "foo bar baz "
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-attachment.html (from rev 221943, trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element.html) (0 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-attachment.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-as-attachment.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -0,0 +1,43 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
+<html>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="editable" contentEditable=true style="width:200px; height:200px"></div>
+<script src=""
+<script>
+description('If we drag files onto an editable area, then attachments should be inserted into the editable area.');
+
+var editable = document.getElementById("editable");
+if (window.eventSender) {
+ dragFilesOntoEditable(['foo', 'bar', 'baz']);
+ var resultChildren = editable.children;
+ var fileNames = "";
+ for (var i = 0; i < resultChildren.length; i++) {
+ var attachment = resultChildren[i];
+ shouldBeEqualToString('attachment.nodeName', 'ATTACHMENT');
+ fileNames += attachment.file.name + " ";
+ }
+ shouldBeEqualToString('fileNames', 'foo bar baz ');
+ editable.innerHTML = '';
+}
+
+function moveMouseToCenterOfElement(element)
+{
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function dragFilesOntoEditable(files)
+{
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(editable);
+ eventSender.mouseUp();
+}
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Deleted: trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-expected.txt (221943 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-expected.txt 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element-expected.txt 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,13 +0,0 @@
-If we drag files onto an editable area, then attachments should be inserted into the editable area.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS attachment.nodeName is "ATTACHMENT"
-PASS attachment.nodeName is "ATTACHMENT"
-PASS attachment.nodeName is "ATTACHMENT"
-PASS fileNames is "foo bar baz "
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element.html (221943 => 221944)
--- trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/editing/pasteboard/drag-files-to-editable-element.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,44 +0,0 @@
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<div id="editable" contentEditable=true style="width:200px; height:200px"></div>
-<script>
-description('If we drag files onto an editable area, then attachments should be inserted into the editable area.');
-
-var editable = document.getElementById("editable");
-if (window.eventSender) {
- dragFilesOntoEditable(['foo', 'bar', 'baz']);
- var resultChildren = editable.children;
- var fileNames = "";
- for (var i = 0; i < resultChildren.length; i++) {
- var attachment = resultChildren[i];
- shouldBeEqualToString('attachment.nodeName', 'ATTACHMENT');
- fileNames += attachment.file.name + " ";
- }
- shouldBeEqualToString('fileNames', 'foo bar baz ');
- editable.innerHTML = '';
-}
-
-function moveMouseToCenterOfElement(element)
-{
- var centerX = element.offsetLeft + element.offsetWidth / 2;
- var centerY = element.offsetTop + element.offsetHeight / 2;
- eventSender.mouseMoveTo(centerX, centerY);
-}
-
-function dragFilesOntoEditable(files)
-{
- eventSender.beginDragWithFiles(files);
- moveMouseToCenterOfElement(editable);
- eventSender.mouseUp();
-}
-
-var successfullyParsed = true;
-</script>
-<script src=""
-</body>
-</html>
Modified: trunk/LayoutTests/fast/attachment/attachment-action-expected.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-action-expected.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-action-expected.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
-if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true);
-</script>
<style>
div {
width: 300px;
Modified: trunk/LayoutTests/fast/attachment/attachment-action.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-action.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-action.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
-if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true);
-</script>
<style>
div {
width: 300px;
Modified: trunk/LayoutTests/fast/attachment/attachment-borderless-expected-mismatch.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-borderless-expected-mismatch.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-borderless-expected-mismatch.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="attachment" title="overridden title" subtitle="1024 bytes"></attachment>
</body>
Modified: trunk/LayoutTests/fast/attachment/attachment-borderless.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-borderless.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-borderless.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="attachment" title="overridden title" subtitle="1024 bytes" style="-webkit-appearance: borderless-attachment;"></attachment>
</body>
Modified: trunk/LayoutTests/fast/attachment/attachment-default-icon-expected.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-default-icon-expected.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-default-icon-expected.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,10 +1,6 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
<body>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<attachment id="attachment" title=" "></attachment>
<script>
var file;
Modified: trunk/LayoutTests/fast/attachment/attachment-default-icon.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-default-icon.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-default-icon.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,10 +1,6 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
<body>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<attachment title=" "></attachment>
</body>
</html>
Modified: trunk/LayoutTests/fast/attachment/attachment-dom.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-dom.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-dom.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,11 +1,7 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
<head>
<meta charset="utf-8">
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<script src=""
</head>
<body>
Modified: trunk/LayoutTests/fast/attachment/attachment-folder-icon-expected.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-folder-icon-expected.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-folder-icon-expected.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment title=" "></attachment>
<attachment title=" "></attachment>
Modified: trunk/LayoutTests/fast/attachment/attachment-folder-icon.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-folder-icon.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-folder-icon.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment title=" " type="multipart/x-folder"></attachment>
<attachment title=" " type="application/vnd.apple.folder"></attachment>
Modified: trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension-expected.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension-expected.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension-expected.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment></attachment>
<script>
Modified: trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment title="test-file.txt"></attachment>
</body>
Modified: trunk/LayoutTests/fast/attachment/attachment-label-highlight.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-label-highlight.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-label-highlight.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,7 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
<body>
<script>
-if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
var attachmentShortLabel = document.createElement("attachment");
var attachmentLongOnTopLabel = document.createElement("attachment");
Modified: trunk/LayoutTests/fast/attachment/attachment-progress.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-progress.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-progress.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment progress="-1.5"></attachment>
<attachment progress="0"></attachment>
Modified: trunk/LayoutTests/fast/attachment/attachment-rendering.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-rendering.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-rendering.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<html>
+<html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<head>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
</head>
<body>
<p>This tests that attachments have a custom renderer.</p>
Modified: trunk/LayoutTests/fast/attachment/attachment-respects-css-size.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-respects-css-size.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-respects-css-size.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="attachment" title="overridden title" subtitle="1024 bytes" style="width: 500px; height: 500px;"></attachment>
</body>
Modified: trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body _onload_="runTest()">
<div style="-webkit-user-select: all;">text before <attachment id="attachment"></attachment> text after</div>
<script>
Modified: trunk/LayoutTests/fast/attachment/attachment-select-on-click.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-select-on-click.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-select-on-click.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body _onload_="runTest()">
<div>text before <attachment id="attachment"></attachment> text after</div>
<div id="result"></div>
Modified: trunk/LayoutTests/fast/attachment/attachment-subtitle-resize.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-subtitle-resize.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-subtitle-resize.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,10 +1,6 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
<script src=""
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="wideAttachment" subtitle="VERY LONG SUBTITLE THAT WILL MAKE THE ATTACHMENT VERY WIDE"></attachment>
<attachment id="skinnyAttachment" subtitle="skinny but wider than icon"></attachment>
Modified: trunk/LayoutTests/fast/attachment/attachment-subtitle.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-subtitle.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-subtitle.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="attachment" subtitle="1024 bytes"></attachment>
<script>
Modified: trunk/LayoutTests/fast/attachment/attachment-title.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-title.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-title.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="attachment" title="overridden title" subtitle="1024 bytes"></attachment>
<script>
Modified: trunk/LayoutTests/fast/attachment/attachment-type-attribute-expected.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-type-attribute-expected.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-type-attribute-expected.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment id="attachment" title=" "></attachment>
<script>
Modified: trunk/LayoutTests/fast/attachment/attachment-type-attribute.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-type-attribute.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-type-attribute.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment type="text/plain" title=" "></attachment>
</body>
Modified: trunk/LayoutTests/fast/attachment/attachment-uti-expected.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-uti-expected.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-uti-expected.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment title=" " type="image/jpeg"></attachment>
<attachment title=" " type="text/plain"></attachment>
Modified: trunk/LayoutTests/fast/attachment/attachment-uti.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-uti.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-uti.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment title=" " type="public.jpeg"></attachment>
<attachment title=" " type="public.plain-text"></attachment>
Modified: trunk/LayoutTests/fast/attachment/attachment-wrapping-action-expected-mismatch.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-wrapping-action-expected-mismatch.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-wrapping-action-expected-mismatch.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment action="" " title="title"></attachment>
</body>
Modified: trunk/LayoutTests/fast/attachment/attachment-wrapping-action.html (221943 => 221944)
--- trunk/LayoutTests/fast/attachment/attachment-wrapping-action.html 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/fast/attachment/attachment-wrapping-action.html 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,9 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
<html>
-<script>
- if (window.internals)
- window.internals.settings.setAttachmentElementEnabled(true)
-</script>
<body>
<attachment action="" " title="title"></attachment>
</body>
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (221943 => 221944)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2017-09-12 23:31:14 UTC (rev 221944)
@@ -2803,7 +2803,8 @@
webkit.org/b/122511 webkit.org/b/120401 fast/regions/selection/selecting-text-in-2-regions-vert-lr.html [ ImageOnlyFailure ]
# PasteBoard::plainText() does not support file names.
-webkit.org/b/99070 editing/pasteboard/drag-files-to-editable-element.html [ Failure ]
+webkit.org/b/99070 editing/pasteboard/drag-files-to-editable-element-as-attachment.html [ Skip ]
+webkit.org/b/99070 editing/pasteboard/drag-files-to-editable-element-as-URLs.html [ Skip ]
http/tests/images/hidpi-srcset-copy.html [ Skip ]
# Opera-submitted tests to W3C for <track>, a lot of failures still.
Modified: trunk/LayoutTests/platform/ios/fast/attachment/attachment-select-on-click-expected.txt (221943 => 221944)
--- trunk/LayoutTests/platform/ios/fast/attachment/attachment-select-on-click-expected.txt 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/platform/ios/fast/attachment/attachment-select-on-click-expected.txt 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 24: IndexSizeError: The index is not in the allowed range.
+CONSOLE MESSAGE: line 20: IndexSizeError: The index is not in the allowed range.
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x150
Modified: trunk/LayoutTests/platform/win/TestExpectations (221943 => 221944)
--- trunk/LayoutTests/platform/win/TestExpectations 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/platform/win/TestExpectations 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1159,7 +1159,8 @@
editing/pasteboard/file-drag-to-editable.html [ Skip ]
editing/pasteboard/get-data-text-plain-drop.html [ Skip ]
# TODO PasteBoard::plainText() does not support file names.
-editing/pasteboard/drag-files-to-editable-element.html [ Skip ]
+editing/pasteboard/drag-files-to-editable-element-as-attachment.html [ Skip ]
+editing/pasteboard/drag-files-to-editable-element-as-URLs.html [ Skip ]
# TODO FileInputType::receiveDroppedFiles receive relative path
webkit.org/b/90426 editing/pasteboard/file-input-files-access.html [ Failure ]
webkit.org/b/90425 [ Release ] editing/pasteboard/dataTransfer-setData-getData.html [ Failure ]
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (221943 => 221944)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2017-09-12 23:31:14 UTC (rev 221944)
@@ -135,7 +135,8 @@
editing/undo/undo-iframe-location-change.html
# PasteBoard::plainText() does not support file names.
-editing/pasteboard/drag-files-to-editable-element.html
+editing/pasteboard/drag-files-to-editable-element-as-attachment.html [ Skip ]
+editing/pasteboard/drag-files-to-editable-element-as-URLs.html [ Skip ]
# Times out
# https://bugs.webkit.org/show_bug.cgi?id=63806
Modified: trunk/Source/WebCore/ChangeLog (221943 => 221944)
--- trunk/Source/WebCore/ChangeLog 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/ChangeLog 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,3 +1,42 @@
+2017-09-12 Ryosuke Niwa <[email protected]>
+
+ Dragging & dropping a file creates an attachment element even when it's disabled
+ https://bugs.webkit.org/show_bug.cgi?id=176769
+
+ Reviewed by Tim Horton.
+
+ The bug that dropping a file always created an attachment element even when it's disabled by settings
+ was caused by WebContentReader::readFilenames always creating an attachment element. Fixed this by
+ checking the runtime flag. The fix is tested by drag-files-to-editable-element-as-URLs.html
+
+ To fix the bug that HTMLAttachmentElement is always exposed on the global object even when it's disabled
+ by settings, replaced the setting to enable attachment element by an equivalent runtime enabled flag,
+ and hid both the interface as well as the element behind it. Fixed various bugs in our code generator
+ to make this work.
+
+ Tests: editing/pasteboard/drag-files-to-editable-element-as-URLs.html
+ editing/pasteboard/drag-files-to-editable-element-as-attachment.html
+
+ * bindings/js/WebCoreBuiltinNames.h: Added symbols used in the generated code.
+ * dom/make_event_factory.pl:
+ (defaultItemFactory): Replaced "runtimeConditonal" option by "runtimeEnabled".
+ (generateImplementation):
+ * dom/make_names.pl:
+ (defaultTagPropertyHash):
+ (printConstructorInterior): Return a HTMLUnknownElement if the element is disabled by a runtime flag.
+ (printTypeHelpers): Make is<HTMLAttachmentElement>(~) returns false when the feature is disabled by
+ checking whether the given element is an instance of HTMLUnknownElement.
+ (printWrapperFunctions): Simplified this code by matching the code for settingsConditional.
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::WebContentReader::readFilenames): Fixed the bug that this code was always creating
+ an attachment element even when the feature is disabled.
+ * html/HTMLAttachmentElement.idl: Hide this behind a runtime flag.
+ * html/HTMLTagNames.in:
+ * page/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::setAttachmentElementEnabled): Added.
+ (WebCore::RuntimeEnabledFeatures::attachmentElementEnabled const): Added.
+ * page/Settings.in: Removed attachmentElementEnabled.
+
2017-09-12 Youenn Fablet <[email protected]>
Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (221943 => 221944)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2017-09-12 23:31:14 UTC (rev 221944)
@@ -35,6 +35,7 @@
macro(AnimationEffectReadOnly) \
macro(AnimationTimeline) \
macro(ApplePaySession) \
+ macro(AttachmentElement) \
macro(Audio) \
macro(Cache) \
macro(CacheStorage) \
@@ -53,6 +54,7 @@
macro(Gamepad) \
macro(GamepadButton) \
macro(GamepadEvent) \
+ macro(HTMLAttachmentElement) \
macro(HTMLAudioElement) \
macro(HTMLSlotElement) \
macro(Headers) \
Modified: trunk/Source/WebCore/dom/make_event_factory.pl (221943 => 221944)
--- trunk/Source/WebCore/dom/make_event_factory.pl 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/dom/make_event_factory.pl 2017-09-12 23:31:14 UTC (rev 221944)
@@ -45,7 +45,7 @@
return (
'interfaceName' => 0,
'conditional' => 0,
- 'runtimeConditional' => 0
+ 'runtimeEnabled' => 0
);
}
@@ -95,7 +95,7 @@
for my $eventName (sort keys %parsedEvents) {
my $conditional = $parsedEvents{$eventName}{"conditional"};
- my $runtimeConditional = $parsedEvents{$eventName}{"runtimeConditional"};
+ my $runtimeEnabled = $parsedEvents{$eventName}{"runtimeEnabled"};
my $interfaceName = $InCompiler->interfaceForItem($eventName);
# FIXME: This should pay attention to $runtimeConditional so it can support RuntimeEnabledFeatures.
Modified: trunk/Source/WebCore/dom/make_names.pl (221943 => 221944)
--- trunk/Source/WebCore/dom/make_names.pl 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/dom/make_names.pl 2017-09-12 23:31:14 UTC (rev 221944)
@@ -200,7 +200,7 @@
'wrapperOnlyIfMediaIsAvailable' => 0,
'settingsConditional' => 0,
'conditional' => 0,
- 'runtimeConditional' => 0,
+ 'runtimeEnabled' => 0,
'customTypeHelper' => 0,
);
}
@@ -420,19 +420,18 @@
;
}
- my $runtimeConditional = $enabledTags{$tagName}{runtimeConditional};
- if ($runtimeConditional) {
- print F <<END
- if (!RuntimeEnabledFeatures::sharedFeatures().${runtimeConditional}Enabled())
- return 0;
-END
-;
+ my $runtimeCondition;
+ my $settingsConditional = $enabledTags{$tagName}{settingsConditional};
+ my $runtimeEnabled = $enabledTags{$tagName}{runtimeEnabled};
+ if ($settingsConditional) {
+ $runtimeCondition = "document.settings().${settingsConditional}()";
+ } elsif ($runtimeEnabled) {
+ $runtimeCondition = "RuntimeEnabledFeatures::sharedFeatures().${runtimeEnabled}Enabled()";
}
- my $settingsConditional = $enabledTags{$tagName}{settingsConditional};
- if ($settingsConditional) {
+ if ($runtimeCondition) {
print F <<END
- if (!document.settings().${settingsConditional}())
+ if (!$runtimeCondition)
return $parameters{fallbackInterfaceName}::create($constructorTagName, document);
END
;
@@ -669,7 +668,7 @@
private:
END
;
- if ($parameters{namespace} eq "HTML" && ($parsedTags{$name}{wrapperOnlyIfMediaIsAvailable} || $parsedTags{$name}{settingsConditional})) {
+ if ($parameters{namespace} eq "HTML" && ($parsedTags{$name}{wrapperOnlyIfMediaIsAvailable} || $parsedTags{$name}{settingsConditional} || $parsedTags{$name}{runtimeEnabled})) {
print F <<END
static bool checkTagName(const WebCore::HTMLElement& element) { return !element.isHTMLUnknownElement() && element.hasTagName(WebCore::$parameters{namespace}Names::${name}Tag); }
static bool checkTagName(const WebCore::Node& node) { return is<WebCore::HTMLElement>(node) && checkTagName(downcast<WebCore::HTMLElement>(node)); }
@@ -1187,16 +1186,13 @@
END
;
- } elsif ($enabledTags{$tagName}{runtimeConditional}) {
- my $runtimeConditional = $enabledTags{$tagName}{runtimeConditional};
+ } elsif ($enabledTags{$tagName}{runtimeEnabled}) {
+ my $runtimeEnabled = $enabledTags{$tagName}{runtimeEnabled};
print F <<END
static JSDOMObject* create${JSInterfaceName}Wrapper(JSDOMGlobalObject* globalObject, Ref<$parameters{namespace}Element>&& element)
{
- if (!RuntimeEnabledFeatures::sharedFeatures().${runtimeConditional}Enabled()) {
- ASSERT(element->is$parameters{fallbackInterfaceName}());
+ if (element->is$parameters{fallbackInterfaceName}())
return createWrapper<$parameters{fallbackJSInterfaceName}>(globalObject, WTFMove(element));
- }
-
return createWrapper<${JSInterfaceName}>(globalObject, WTFMove(element));
}
END
Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (221943 => 221944)
--- trunk/Source/WebCore/editing/mac/EditorMac.mm 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm 2017-09-12 23:31:14 UTC (rev 221944)
@@ -59,6 +59,7 @@
#import "RenderBlock.h"
#import "RenderImage.h"
#import "RuntimeApplicationChecks.h"
+#import "RuntimeEnabledFeatures.h"
#import "Settings.h"
#import "StyleProperties.h"
#import "Text.h"
@@ -378,14 +379,16 @@
for (auto& text : paths) {
#if ENABLE(ATTACHMENT_ELEMENT)
- auto attachment = HTMLAttachmentElement::create(attachmentTag, document);
- attachment->setFile(File::create([[NSURL fileURLWithPath:text] path]).ptr());
- fragment->appendChild(attachment);
-#else
+ if (RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled()) {
+ auto attachment = HTMLAttachmentElement::create(attachmentTag, document);
+ attachment->setFile(File::create([[NSURL fileURLWithPath:text] path]).ptr());
+ fragment->appendChild(attachment);
+ continue;
+ }
+#endif
auto paragraph = createDefaultParagraphElement(document);
paragraph->appendChild(document.createTextNode(frame.editor().client()->userVisibleString([NSURL fileURLWithPath:text])));
fragment->appendChild(paragraph);
-#endif
}
return true;
Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.idl (221943 => 221944)
--- trunk/Source/WebCore/html/HTMLAttachmentElement.idl 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.idl 2017-09-12 23:31:14 UTC (rev 221944)
@@ -24,7 +24,8 @@
*/
[
- Conditional=ATTACHMENT_ELEMENT
+ Conditional=ATTACHMENT_ELEMENT,
+ EnabledAtRuntime=AttachmentElement,
] interface HTMLAttachmentElement : HTMLElement {
attribute File? file;
};
Modified: trunk/Source/WebCore/html/HTMLTagNames.in (221943 => 221944)
--- trunk/Source/WebCore/html/HTMLTagNames.in 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/html/HTMLTagNames.in 2017-09-12 23:31:14 UTC (rev 221944)
@@ -12,7 +12,7 @@
area
article interfaceName=HTMLElement
aside interfaceName=HTMLElement
-attachment conditional=ATTACHMENT_ELEMENT, settingsConditional=attachmentElementEnabled
+attachment conditional=ATTACHMENT_ELEMENT, runtimeEnabled=attachmentElement
audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, customTypeHelper
b interfaceName=HTMLElement
base
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (221943 => 221944)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2017-09-12 23:31:14 UTC (rev 221944)
@@ -79,6 +79,11 @@
void setDataTransferItemsEnabled(bool areEnabled) { m_areDataTransferItemsEnabled = areEnabled; }
bool dataTransferItemsEnabled() const { return m_areDataTransferItemsEnabled; }
+#if ENABLE(ATTACHMENT_ELEMENT)
+ void setAttachmentElementEnabled(bool areEnabled) { m_isAttachmentElementEnabled = areEnabled; }
+ bool attachmentElementEnabled() const { return m_isAttachmentElementEnabled; }
+#endif
+
void setModernMediaControlsEnabled(bool areEnabled) { m_areModernMediaControlsEnabled = areEnabled; }
bool modernMediaControlsEnabled() const { return m_areModernMediaControlsEnabled; }
@@ -238,6 +243,10 @@
bool m_areDataTransferItemsEnabled { false };
bool m_inputEventsEnabled { true };
+#if ENABLE(ATTACHMENT_ELEMENT)
+ bool m_isAttachmentElementEnabled { false };
+#endif
+
#if ENABLE(INDEXED_DATABASE_IN_WORKERS)
bool m_isIndexedDBWorkersEnabled { true };
#endif
Modified: trunk/Source/WebCore/page/Settings.in (221943 => 221944)
--- trunk/Source/WebCore/page/Settings.in 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebCore/page/Settings.in 2017-09-12 23:31:14 UTC (rev 221944)
@@ -242,8 +242,6 @@
appleMailPaginationQuirkEnabled initial=false
-attachmentElementEnabled initial=true, conditional=ATTACHMENT_ELEMENT
-
deferredCSSParserEnabled initial=false
repaintOutsideLayoutEnabled initial=false
Modified: trunk/Source/WebKit/ChangeLog (221943 => 221944)
--- trunk/Source/WebKit/ChangeLog 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebKit/ChangeLog 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,3 +1,17 @@
+2017-09-12 Ryosuke Niwa <[email protected]>
+
+ Dragging & dropping a file creates an attachment element even when it's disabled
+ https://bugs.webkit.org/show_bug.cgi?id=176769
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetAttachmentElementEnabled):
+ (WKPreferencesGetAttachmentElementEnabled):
+ * UIProcess/API/C/WKPreferencesRefPrivate.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
2017-09-12 Youenn Fablet <[email protected]>
Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp (221943 => 221944)
--- trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp 2017-09-12 23:31:14 UTC (rev 221944)
@@ -910,6 +910,16 @@
return toImpl(preferencesRef)->mockScrollbarsEnabled();
}
+void WKPreferencesSetAttachmentElementEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setAttachmentElementEnabled(flag);
+}
+
+bool WKPreferencesGetAttachmentElementEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->attachmentElementEnabled();
+}
+
void WKPreferencesSetWebAudioEnabled(WKPreferencesRef preferencesRef, bool enabled)
{
toImpl(preferencesRef)->setWebAudioEnabled(enabled);
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h (221943 => 221944)
--- trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h 2017-09-12 23:31:14 UTC (rev 221944)
@@ -457,6 +457,10 @@
WK_EXPORT void WKPreferencesSetAllowsPictureInPictureMediaPlayback(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetAllowsPictureInPictureMediaPlayback(WKPreferencesRef);
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetAttachmentElementEnabled(WKPreferencesRef preferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetAttachmentElementEnabled(WKPreferencesRef preferencesRef);
+
// Defaults to false
WK_EXPORT void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (221943 => 221944)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-09-12 23:31:14 UTC (rev 221944)
@@ -3132,9 +3132,6 @@
settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(store.getBoolValueForKey(WebPreferencesKey::inlineMediaPlaybackRequiresPlaysInlineAttributeKey()));
settings.setInvisibleAutoplayNotPermitted(store.getBoolValueForKey(WebPreferencesKey::invisibleAutoplayNotPermittedKey()));
settings.setMediaDataLoadsAutomatically(store.getBoolValueForKey(WebPreferencesKey::mediaDataLoadsAutomaticallyKey()));
-#if ENABLE(ATTACHMENT_ELEMENT)
- settings.setAttachmentElementEnabled(store.getBoolValueForKey(WebPreferencesKey::attachmentElementEnabledKey()));
-#endif
settings.setAllowsPictureInPictureMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey()));
settings.setMediaControlsScaleWithPageZoom(store.getBoolValueForKey(WebPreferencesKey::mediaControlsScaleWithPageZoomKey()));
settings.setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
@@ -3330,6 +3327,10 @@
RuntimeEnabledFeatures::sharedFeatures().setDataTransferItemsEnabled(store.getBoolValueForKey(WebPreferencesKey::dataTransferItemsEnabledKey()));
+#if ENABLE(ATTACHMENT_ELEMENT)
+ RuntimeEnabledFeatures::sharedFeatures().setAttachmentElementEnabled(store.getBoolValueForKey(WebPreferencesKey::attachmentElementEnabledKey()));
+#endif
+
#if ENABLE(WEBGL2)
RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(store.getBoolValueForKey(WebPreferencesKey::webGL2EnabledKey()));
#endif
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (221943 => 221944)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,3 +1,13 @@
+2017-09-12 Ryosuke Niwa <[email protected]>
+
+ Dragging & dropping a file creates an attachment element even when it's disabled
+ https://bugs.webkit.org/show_bug.cgi?id=176769
+
+ Reviewed by Tim Horton.
+
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]):
+
2017-09-11 Wenson Hsieh <[email protected]>
[iOS DnD] Support DataTransfer.setDragImage when starting a drag on iOS
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (221943 => 221944)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2017-09-12 23:31:14 UTC (rev 221944)
@@ -2995,6 +2995,10 @@
RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]);
RuntimeEnabledFeatures::sharedFeatures().setDataTransferItemsEnabled([preferences dataTransferItemsEnabled]);
+#if ENABLE(ATTACHMENT_ELEMENT)
+ RuntimeEnabledFeatures::sharedFeatures().setAttachmentElementEnabled([preferences attachmentElementEnabled]);
+#endif
+
RuntimeEnabledFeatures::sharedFeatures().setInteractiveFormValidationEnabled([self interactiveFormValidationEnabled]);
RuntimeEnabledFeatures::sharedFeatures().setModernMediaControlsEnabled([preferences modernMediaControlsEnabled]);
@@ -3069,10 +3073,6 @@
settings.setMediaDataLoadsAutomatically([preferences mediaDataLoadsAutomatically]);
-#if ENABLE(ATTACHMENT_ELEMENT)
- settings.setAttachmentElementEnabled([preferences attachmentElementEnabled]);
-#endif
-
settings.setAllowContentSecurityPolicySourceStarToMatchAnyProtocol(shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol());
settings.setShouldConvertInvalidURLsToBlank(shouldConvertInvalidURLsToBlank());
Modified: trunk/Tools/ChangeLog (221943 => 221944)
--- trunk/Tools/ChangeLog 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/ChangeLog 2017-09-12 23:31:14 UTC (rev 221944)
@@ -1,3 +1,27 @@
+2017-09-12 Ryosuke Niwa <[email protected]>
+
+ Dragging & dropping a file creates an attachment element even when it's disabled
+ https://bugs.webkit.org/show_bug.cgi?id=176769
+
+ Reviewed by Tim Horton.
+
+ Added a webkit-test-runner flag to enable attachment element via runtime flag since this feature is now hidden
+ behind a runtime-enabled flag which needs to be set at the time of global object initialization.
+
+ * DumpRenderTree/TestOptions.h:
+ (TestOptions): Added.
+ * DumpRenderTree/TestOptions.mm:
+ (TestOptions::TestOptions):
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (setWebPreferencesForTestOptions):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::resetPreferencesToConsistentValues):
+ (WTR::updateTestOptionsFromTestHeader):
+ * WebKitTestRunner/TestOptions.h:
+ (WTR::TestOptions::hasSameInitializationOptions const):
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::platformCreateWebView):
+
2017-09-11 Filip Pizlo <[email protected]>
WSL should allow you to say "protocol Foo : Bar { ... }"
Modified: trunk/Tools/DumpRenderTree/TestOptions.h (221943 => 221944)
--- trunk/Tools/DumpRenderTree/TestOptions.h 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/DumpRenderTree/TestOptions.h 2017-09-12 23:31:14 UTC (rev 221944)
@@ -29,6 +29,7 @@
@class NSURL;
struct TestOptions {
+ bool enableAttachmentElement { false };
bool enableIntersectionObserver { false };
bool enableModernMediaControls { true };
bool enablePointerLock { false };
Modified: trunk/Tools/DumpRenderTree/TestOptions.mm (221943 => 221944)
--- trunk/Tools/DumpRenderTree/TestOptions.mm 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/DumpRenderTree/TestOptions.mm 2017-09-12 23:31:14 UTC (rev 221944)
@@ -78,7 +78,9 @@
}
auto key = pairString.substr(pairStart, equalsLocation - pairStart);
auto value = pairString.substr(equalsLocation + 1, pairEnd - (equalsLocation + 1));
- if (key == "enableIntersectionObserver")
+ if (key == "enableAttachmentElement")
+ this->enableAttachmentElement = parseBooleanTestHeaderValue(value);
+ else if (key == "enableIntersectionObserver")
this->enableIntersectionObserver = parseBooleanTestHeaderValue(value);
else if (key == "enableModernMediaControls")
this->enableModernMediaControls = parseBooleanTestHeaderValue(value);
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (221943 => 221944)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-09-12 23:31:14 UTC (rev 221944)
@@ -980,6 +980,7 @@
{
WebPreferences *preferences = [WebPreferences standardPreferences];
+ preferences.attachmentElementEnabled = options.enableAttachmentElement;
preferences.intersectionObserverEnabled = options.enableIntersectionObserver;
preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
preferences.credentialManagementEnabled = options.enableCredentialManagement;
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (221943 => 221944)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2017-09-12 23:31:14 UTC (rev 221944)
@@ -684,6 +684,7 @@
WKPreferencesSetMockScrollbarsEnabled(preferences, options.useMockScrollbars);
WKPreferencesSetNeedsSiteSpecificQuirks(preferences, options.needsSiteSpecificQuirks);
+ WKPreferencesSetAttachmentElementEnabled(preferences, options.enableAttachmentElement);
WKPreferencesSetIntersectionObserverEnabled(preferences, options.enableIntersectionObserver);
WKPreferencesSetModernMediaControlsEnabled(preferences, options.enableModernMediaControls);
WKPreferencesSetCredentialManagementEnabled(preferences, options.enableCredentialManagement);
@@ -1024,6 +1025,8 @@
testOptions.ignoresViewportScaleLimits = parseBooleanTestHeaderValue(value);
if (key == "useCharacterSelectionGranularity")
testOptions.useCharacterSelectionGranularity = parseBooleanTestHeaderValue(value);
+ if (key == "enableAttachmentElement")
+ testOptions.enableAttachmentElement = parseBooleanTestHeaderValue(value);
if (key == "enableIntersectionObserver")
testOptions.enableIntersectionObserver = parseBooleanTestHeaderValue(value);
if (key == "enableModernMediaControls")
Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (221943 => 221944)
--- trunk/Tools/WebKitTestRunner/TestOptions.h 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h 2017-09-12 23:31:14 UTC (rev 221944)
@@ -43,6 +43,7 @@
bool needsSiteSpecificQuirks { false };
bool ignoresViewportScaleLimits { false };
bool useCharacterSelectionGranularity { false };
+ bool enableAttachmentElement { false };
bool enableIntersectionObserver { false };
bool enableModernMediaControls { true };
bool enablePointerLock { false };
@@ -66,6 +67,7 @@
|| useMockScrollbars != options.useMockScrollbars
|| needsSiteSpecificQuirks != options.needsSiteSpecificQuirks
|| useCharacterSelectionGranularity != options.useCharacterSelectionGranularity
+ || enableAttachmentElement != options.enableAttachmentElement
|| enableIntersectionObserver != options.enableIntersectionObserver
|| enableModernMediaControls != options.enableModernMediaControls
|| enablePointerLock != options.enablePointerLock
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (221943 => 221944)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2017-09-12 23:20:54 UTC (rev 221943)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2017-09-12 23:31:14 UTC (rev 221944)
@@ -138,8 +138,13 @@
[copiedConfiguration setIgnoresViewportScaleLimits:YES];
if (options.useCharacterSelectionGranularity)
[copiedConfiguration setSelectionGranularity:WKSelectionGranularityCharacter];
+ if (options.useCharacterSelectionGranularity)
+ [copiedConfiguration setSelectionGranularity:WKSelectionGranularityCharacter];
#endif
+ if (options.enableAttachmentElement)
+ [copiedConfiguration _setAttachmentElementEnabled: YES];
+
m_mainWebView = std::make_unique<PlatformWebView>(copiedConfiguration.get(), options);
#else
m_mainWebView = std::make_unique<PlatformWebView>(globalWebViewConfiguration, options);