Title: [198088] trunk
Revision
198088
Author
[email protected]
Date
2016-03-13 18:09:17 -0700 (Sun, 13 Mar 2016)

Log Message

<attachment> should be a runtime-enabled feature
https://bugs.webkit.org/show_bug.cgi?id=155413
<rdar://problem/25120753>

Reviewed by Sam Weinig and Anders Carlsson.

Source/WebKit/mac:

Add an internal setting on WebPreferences
to enable the <attachment> element support.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences attachmentElementEnabled]):
(-[WebPreferences setAttachmentElementEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add an internal setting on WKWebViewConfiguration
to enable the <attachment> element support.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _attachmentElementEnabled]):
(-[WKWebViewConfiguration _setAttachmentElementEnabled:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

Now that <attachment> is disabled by default, use an
internal setting to turn them back on test by test.

* fast/attachment/attachment-default-icon-expected.html:
* fast/attachment/attachment-default-icon.html:
* fast/attachment/attachment-disabled-dom.html:
* fast/attachment/attachment-disabled-rendering.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-select-on-click-inside-user-select-all.html:
* fast/attachment/attachment-select-on-click.html:
* fast/attachment/attachment-subtitle.html:
* fast/attachment/attachment-title.html:
* fast/attachment/attachment-type-attribute-expected.html:
* fast/attachment/attachment-type-attribute.html:
* editing/pasteboard/copy-paste-attachment.html:
* editing/pasteboard/drag-and-drop-attachment-contenteditable.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198087 => 198088)


--- trunk/LayoutTests/ChangeLog	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/ChangeLog	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,3 +1,35 @@
+2016-03-13  Dean Jackson  <[email protected]>
+
+        <attachment> should be a runtime-enabled feature
+        https://bugs.webkit.org/show_bug.cgi?id=155413
+        <rdar://problem/25120753>
+
+        Reviewed by Sam Weinig and Anders Carlsson.
+
+        Now that <attachment> is disabled by default, use an
+        internal setting to turn them back on test by test.
+
+        * fast/attachment/attachment-default-icon-expected.html:
+        * fast/attachment/attachment-default-icon.html:
+        * fast/attachment/attachment-disabled-dom.html:
+        * fast/attachment/attachment-disabled-rendering.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-select-on-click-inside-user-select-all.html:
+        * fast/attachment/attachment-select-on-click.html:
+        * fast/attachment/attachment-subtitle.html:
+        * fast/attachment/attachment-title.html:
+        * fast/attachment/attachment-type-attribute-expected.html:
+        * fast/attachment/attachment-type-attribute.html:
+        * editing/pasteboard/copy-paste-attachment.html:
+        * editing/pasteboard/drag-and-drop-attachment-contenteditable.html:
+
 2016-03-13  Antti Koivisto  <[email protected]>
 
         ComposedTreeIterator fails to traverse slots if root is shadow host

Modified: trunk/LayoutTests/editing/pasteboard/copy-paste-attachment.html (198087 => 198088)


--- trunk/LayoutTests/editing/pasteboard/copy-paste-attachment.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-attachment.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,6 +1,10 @@
 <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>

Modified: trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html (198087 => 198088)


--- trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,6 +1,10 @@
 <!DOCTYPE html>
 <html>
 <head>
+<script>
+    if (window.internals)
+        window.internals.settings.setAttachmentElementEnabled(true)
+</script>
 <script src=""
 <style>
 #target {

Modified: trunk/LayoutTests/fast/attachment/attachment-default-icon-expected.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-default-icon-expected.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-default-icon-expected.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,6 +1,10 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-default-icon.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-default-icon.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,6 +1,10 @@
 <!DOCTYPE html>
 <html>
 <body>
+<script>
+    if (window.internals)
+        window.internals.settings.setAttachmentElementEnabled(true)
+</script>
 <attachment></attachment>
 </body>
 </html>

Modified: trunk/LayoutTests/fast/attachment/attachment-disabled-dom.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-disabled-dom.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-disabled-dom.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -7,9 +7,6 @@
 <body>
 <script>
 
-if (window.internals)
-    window.internals.settings.setAttachmentElementEnabled(false);
-
 description("This tests that attachments have an instance type of HTMLUnknownElement if attachments are disabled.");
 
 var attachment = document.createElement("attachment");

Modified: trunk/LayoutTests/fast/attachment/attachment-disabled-rendering.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-disabled-rendering.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-disabled-rendering.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,10 +1,4 @@
 <html>
-<head>
-    <script>
-        if (window.internals)
-            window.internals.settings.setAttachmentElementEnabled(false);
-    </script>
-</head>
 <body>
     <p>This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner.</p>
     <attachment></attachment>

Modified: trunk/LayoutTests/fast/attachment/attachment-dom.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-dom.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-dom.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -2,6 +2,10 @@
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-folder-icon-expected.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-folder-icon-expected.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-folder-icon.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-folder-icon.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <html>
+<script>
+    if (window.internals)
+        window.internals.settings.setAttachmentElementEnabled(true)
+</script>
 <body>
 <attachment type="multipart/x-folder"></attachment>
 <attachment type="application/vnd.apple.folder"></attachment>

Modified: trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension-expected.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension-expected.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension-expected.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-icon-from-file-extension.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-label-highlight.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-label-highlight.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -2,6 +2,9 @@
 <html>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setAttachmentElementEnabled(true)
+
 var attachmentShortLabel = document.createElement("attachment");
 var attachmentLongOnTopLabel = document.createElement("attachment");
 var attachmentLongOnBottomLabel = document.createElement("attachment");

Modified: trunk/LayoutTests/fast/attachment/attachment-progress.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-progress.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-progress.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-rendering.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-rendering.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <html>
 <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-select-on-click-inside-user-select-all.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-select-on-click-inside-user-select-all.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-select-on-click.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-select-on-click.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <html>
+<script>
+    if (window.internals)
+        window.internals.settings.setAttachmentElementEnabled(true)
+</script>
 <body _onload_="runTest()">
 <div>text before <attachment id="attachment"></attachment> text after</div>
 <script>

Modified: trunk/LayoutTests/fast/attachment/attachment-subtitle.html (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-subtitle.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-subtitle.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-title.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-title.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-type-attribute-expected.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-type-attribute-expected.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <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 (198087 => 198088)


--- trunk/LayoutTests/fast/attachment/attachment-type-attribute.html	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/LayoutTests/fast/attachment/attachment-type-attribute.html	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
 <html>
+<script>
+    if (window.internals)
+        window.internals.settings.setAttachmentElementEnabled(true)
+</script>
 <body>
 <attachment type="text/plain"></attachment>
 </body>

Modified: trunk/Source/WebKit/mac/ChangeLog (198087 => 198088)


--- trunk/Source/WebKit/mac/ChangeLog	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,3 +1,23 @@
+2016-03-13  Dean Jackson  <[email protected]>
+
+        <attachment> should be a runtime-enabled feature
+        https://bugs.webkit.org/show_bug.cgi?id=155413
+        <rdar://problem/25120753>
+
+        Reviewed by Sam Weinig and Anders Carlsson.
+
+        Add an internal setting on WebPreferences
+        to enable the <attachment> element support.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences attachmentElementEnabled]):
+        (-[WebPreferences setAttachmentElementEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-03-12  Sam Weinig  <[email protected]>
 
         WebKit can easily crash below NetworkSession::dataTaskForIdentifier() with NSURLSession enabled

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (198087 => 198088)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-03-14 01:09:17 UTC (rev 198088)
@@ -204,3 +204,5 @@
 #define WebKitMediaDataLoadsAutomaticallyPreferenceKey @"WebKitMediaDataLoadsAutomatically"
 #define WebKitMockCaptureDevicesEnabledPreferenceKey @"WebKitMockCaptureDevicesEnabled"
 
+#define WebKitAttachmentElementEnabledPreferenceKey @"WebKitAttachmentElementEnabled"
+

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (198087 => 198088)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-03-14 01:09:17 UTC (rev 198088)
@@ -45,6 +45,7 @@
 #import <WebCore/NetworkStorageSession.h>
 #import <WebCore/PlatformCookieJar.h>
 #import <WebCore/ResourceHandle.h>
+#import <WebCore/RuntimeApplicationChecks.h>
 #import <WebCore/Settings.h>
 #import <WebCore/TextEncodingRegistry.h>
 #import <runtime/InitializeThreading.h>
@@ -393,9 +394,11 @@
     JSC::initializeThreading();
     WTF::initializeMainThreadToProcessMainThread();
     RunLoop::initializeMainRunLoop();
+    bool attachmentElementEnabled = MacApplication::isAppleMail();
 #else
     bool allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
     bool requiresPlaysInlineAttribute = !allowsInlineMediaPlayback;
+    bool attachmentElementEnabled = IOSApplication::isMobileMail();
 #endif
     InitWebCoreSystemInterface();
 
@@ -519,6 +522,7 @@
         [NSNumber numberWithBool:YES],  WebKitAVFoundationEnabledKey,
         [NSNumber numberWithBool:YES],  WebKitAVFoundationNSURLSessionEnabledKey,
         [NSNumber numberWithBool:NO],   WebKitSuppressesIncrementalRenderingKey,
+        [NSNumber numberWithBool:attachmentElementEnabled], WebKitAttachmentElementEnabledPreferenceKey,
 #if !PLATFORM(IOS)
         [NSNumber numberWithBool:NO],   WebKitRequiresUserGestureForVideoPlaybackPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitRequiresUserGestureForAudioPlaybackPreferenceKey,
@@ -2657,6 +2661,16 @@
     [self _setBoolValue:flag forKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
 }
 
+- (BOOL)attachmentElementEnabled
+{
+    return [self _boolValueForKey:WebKitAttachmentElementEnabledPreferenceKey];
+}
+
+- (void)setAttachmentElementEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitAttachmentElementEnabledPreferenceKey];
+}
+
 - (BOOL)mockCaptureDevicesEnabled
 {
     return [self _boolValueForKey:WebKitMockCaptureDevicesEnabledPreferenceKey];

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (198087 => 198088)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-03-14 01:09:17 UTC (rev 198088)
@@ -483,5 +483,6 @@
 
 @property (nonatomic) BOOL _javascript_MarkupEnabled;
 @property (nonatomic) BOOL mediaDataLoadsAutomatically;
+@property (nonatomic) BOOL attachmentElementEnabled;
 
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (198087 => 198088)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2016-03-14 01:09:17 UTC (rev 198088)
@@ -2515,6 +2515,7 @@
 #endif
 
     settings.setMediaDataLoadsAutomatically([preferences mediaDataLoadsAutomatically]);
+    settings.setAttachmentElementEnabled([preferences attachmentElementEnabled]);
 }
 
 static inline IMP getMethod(id o, SEL s)

Modified: trunk/Source/WebKit2/ChangeLog (198087 => 198088)


--- trunk/Source/WebKit2/ChangeLog	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-14 01:09:17 UTC (rev 198088)
@@ -1,3 +1,26 @@
+2016-03-13  Dean Jackson  <[email protected]>
+
+        <attachment> should be a runtime-enabled feature
+        https://bugs.webkit.org/show_bug.cgi?id=155413
+        <rdar://problem/25120753>
+
+        Reviewed by Sam Weinig and Anders Carlsson.
+
+        Add an internal setting on WKWebViewConfiguration
+        to enable the <attachment> element support.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration _attachmentElementEnabled]):
+        (-[WKWebViewConfiguration _setAttachmentElementEnabled:]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-03-12  Sam Weinig  <[email protected]>
 
         WebKit can easily crash below NetworkSession::dataTaskForIdentifier() with NSURLSession enabled

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (198087 => 198088)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-03-14 01:09:17 UTC (rev 198088)
@@ -163,6 +163,7 @@
     macro(ShowsToolTipOverTruncatedText, showsToolTipOverTruncatedText, Bool, bool, false) \
     macro(MockScrollbarsEnabled, mockScrollbarsEnabled, Bool, bool, false) \
     macro(WebAudioEnabled, webAudioEnabled, Bool, bool, true) \
+    macro(AttachmentElementEnabled, attachmentElementEnabled, Bool, bool, false) \
     macro(SuppressesIncrementalRendering, suppressesIncrementalRendering, Bool, bool, false) \
     macro(BackspaceKeyNavigationEnabled, backspaceKeyNavigationEnabled, Bool, bool, DEFAULT_BACKSPACE_KEY_NAVIGATION_ENABLED) \
     macro(CaretBrowsingEnabled, caretBrowsingEnabled, Bool, bool, false) \

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (198087 => 198088)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-03-14 01:09:17 UTC (rev 198088)
@@ -85,6 +85,7 @@
 #import <WebCore/IOSurface.h>
 #import <WebCore/JSDOMBinding.h>
 #import <WebCore/NSTextFinderSPI.h>
+#import <WebCore/RuntimeApplicationChecks.h>
 #import <wtf/HashMap.h>
 #import <wtf/MathExtras.h>
 #import <wtf/NeverDestroyed.h>
@@ -434,6 +435,13 @@
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::invisibleAutoplayNotPermittedKey(), WebKit::WebPreferencesStore::Value(!![_configuration _invisibleAutoplayNotPermitted]));
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::mediaDataLoadsAutomaticallyKey(), WebKit::WebPreferencesStore::Value(!![_configuration _mediaDataLoadsAutomatically]));
 
+// FIXME: <rdar://problem/25135244> Remove bundle checks for attachmentElementEnabled
+#if PLATFORM(IOS)
+    pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::attachmentElementEnabledKey(), WebKit::WebPreferencesStore::Value(WebCore::IOSApplication::isMobileMail() ? true : !![_configuration _attachmentElementEnabled]));
+#else
+    pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::attachmentElementEnabledKey(), WebKit::WebPreferencesStore::Value(WebCore::MacApplication::isAppleMail() ? true : !![_configuration _attachmentElementEnabled]));
+#endif
+
 #if ENABLE(DATA_DETECTION)
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::dataDetectorTypesKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(fromWKDataDetectorTypes([_configuration dataDetectorTypes]))));
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (198087 => 198088)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2016-03-14 01:09:17 UTC (rev 198088)
@@ -36,6 +36,7 @@
 #import "WeakObjCPtr.h"
 #import "_WKVisitedLinkProvider.h"
 #import "_WKWebsiteDataStoreInternal.h"
+#import <WebCore/RuntimeApplicationChecks.h>
 #import <wtf/RetainPtr.h>
 
 #if PLATFORM(IOS)
@@ -43,6 +44,8 @@
 #import <WebCore/Device.h>
 #endif
 
+using namespace WebCore;
+
 template<typename T> class LazyInitialized {
 public:
     typedef typename WTF::GetPtrHelper<T>::PtrType PtrType;
@@ -108,6 +111,7 @@
 
     BOOL _invisibleAutoplayNotPermitted;
     BOOL _mediaDataLoadsAutomatically;
+    BOOL _attachmentElementEnabled;
     BOOL _requiresUserActionForVideoPlayback;
     BOOL _requiresUserActionForAudioPlayback;
     BOOL _mainContentUserGestureOverrideEnabled;
@@ -142,7 +146,14 @@
     _mainContentUserGestureOverrideEnabled = NO;
     _invisibleAutoplayNotPermitted = NO;
 
+// FIXME: <rdar://problem/25135244> Should default to NO once clients have adopted the setting.
 #if PLATFORM(IOS)
+    _attachmentElementEnabled = IOSApplication::isMobileMail();
+#else
+    _attachmentElementEnabled = MacApplication::isAppleMail();
+#endif
+
+#if PLATFORM(IOS)
     _respectsImageOrientation = YES;
     _printsBackgrounds = YES;
 #endif
@@ -249,6 +260,7 @@
 
     configuration->_invisibleAutoplayNotPermitted = self->_invisibleAutoplayNotPermitted;
     configuration->_mediaDataLoadsAutomatically = self->_mediaDataLoadsAutomatically;
+    configuration->_attachmentElementEnabled = self->_attachmentElementEnabled;
     configuration->_requiresUserActionForVideoPlayback = self->_requiresUserActionForVideoPlayback;
     configuration->_requiresUserActionForAudioPlayback = self->_requiresUserActionForAudioPlayback;
     configuration->_mainContentUserGestureOverrideEnabled = self->_mainContentUserGestureOverrideEnabled;
@@ -565,6 +577,16 @@
     _mediaDataLoadsAutomatically = mediaDataLoadsAutomatically;
 }
 
+- (BOOL)_attachmentElementEnabled
+{
+    return _attachmentElementEnabled;
+}
+
+- (void)_setAttachmentElementEnabled:(BOOL)attachmentElementEnabled
+{
+    _attachmentElementEnabled = attachmentElementEnabled;
+}
+
 - (BOOL)_requiresUserActionForVideoPlayback
 {
     return _requiresUserActionForVideoPlayback;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (198087 => 198088)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2016-03-14 01:09:17 UTC (rev 198088)
@@ -55,6 +55,7 @@
 @property (nonatomic, setter=_setMainContentUserGestureOverrideEnabled:) BOOL _mainContentUserGestureOverrideEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 @property (nonatomic, setter=_setInvisibleAutoplayNotPermitted:) BOOL _invisibleAutoplayNotPermitted WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 @property (nonatomic, setter=_setMediaDataLoadsAutomatically:) BOOL _mediaDataLoadsAutomatically WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+@property (nonatomic, setter=_setAttachmentElementEnabled:) BOOL _attachmentElementEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 #if TARGET_OS_IPHONE
 @property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_AVAILABLE(NA, 9_0);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (198087 => 198088)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-03-13 22:54:12 UTC (rev 198087)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-03-14 01:09:17 UTC (rev 198088)
@@ -2904,6 +2904,9 @@
     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()));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to