Title: [226148] trunk/Source/WebKitLegacy/mac
- Revision
- 226148
- Author
- [email protected]
- Date
- 2017-12-19 15:12:00 -0800 (Tue, 19 Dec 2017)
Log Message
API test WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments is failing on El Capitan and Sierra
https://bugs.webkit.org/show_bug.cgi?id=180977
Reviewed by Tim Horton.
Fixes a failing API test by updating markup deserialization codepaths in WebKitLegacy to behave like the modern
WebCore counterpart. When determining element tags to exclude when generating markup from an attributed string,
don't add "object" as an element to exclude if the attachment element runtime feature is enabled.
* WebCoreSupport/WebEditorClient.mm:
(attributesForAttributedStringConversion):
* WebView/WebHTMLView.mm:
(+[WebHTMLView _excludedElementsForAttributedStringConversion]):
Modified Paths
Diff
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (226147 => 226148)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-12-19 23:01:30 UTC (rev 226147)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-12-19 23:12:00 UTC (rev 226148)
@@ -1,3 +1,19 @@
+2017-12-19 Wenson Hsieh <[email protected]>
+
+ API test WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments is failing on El Capitan and Sierra
+ https://bugs.webkit.org/show_bug.cgi?id=180977
+
+ Reviewed by Tim Horton.
+
+ Fixes a failing API test by updating markup deserialization codepaths in WebKitLegacy to behave like the modern
+ WebCore counterpart. When determining element tags to exclude when generating markup from an attributed string,
+ don't add "object" as an element to exclude if the attachment element runtime feature is enabled.
+
+ * WebCoreSupport/WebEditorClient.mm:
+ (attributesForAttributedStringConversion):
+ * WebView/WebHTMLView.mm:
+ (+[WebHTMLView _excludedElementsForAttributedStringConversion]):
+
2017-12-18 David Kilzer <[email protected]>
BUILD FIX: Ignore NSWindow deprecation warnings from the mysterious future
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (226147 => 226148)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm 2017-12-19 23:01:30 UTC (rev 226147)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm 2017-12-19 23:12:00 UTC (rev 226148)
@@ -68,6 +68,7 @@
#import <WebCore/LegacyWebArchive.h>
#import <WebCore/Page.h>
#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/RuntimeEnabledFeatures.h>
#import <WebCore/Settings.h>
#import <WebCore/SpellChecker.h>
#import <WebCore/StyleProperties.h>
@@ -433,7 +434,7 @@
static NSDictionary *attributesForAttributedStringConversion()
{
// This function needs to be kept in sync with identically named one in WebCore, which is used on newer OS versions.
- NSArray *excludedElements = [[NSArray alloc] initWithObjects:
+ NSMutableArray *excludedElements = [[NSMutableArray alloc] initWithObjects:
// Omit style since we want style to be inline so the fragment can be easily inserted.
@"style",
// Omit xml so the result is not XHTML.
@@ -442,9 +443,17 @@
@"doctype", @"html", @"head", @"body",
// Omit deprecated tags.
@"applet", @"basefont", @"center", @"dir", @"font", @"menu", @"s", @"strike", @"u",
+#if !ENABLE(ATTACHMENT_ELEMENT)
// Omit object so no file attachments are part of the fragment.
- @"object", nil];
+ @"object",
+#endif
+ nil];
+#if ENABLE(ATTACHMENT_ELEMENT)
+ if (!RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled())
+ [excludedElements addObject:@"object"];
+#endif
+
#if PLATFORM(IOS)
static NSString * const NSExcludedElementsDocumentAttribute = @"ExcludedElements";
#endif
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (226147 => 226148)
--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2017-12-19 23:01:30 UTC (rev 226147)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2017-12-19 23:12:00 UTC (rev 226148)
@@ -114,6 +114,7 @@
#import <WebCore/RenderView.h>
#import <WebCore/RenderWidget.h>
#import <WebCore/RuntimeApplicationChecks.h>
+#import <WebCore/RuntimeEnabledFeatures.h>
#import <WebCore/SharedBuffer.h>
#import <WebCore/StyleProperties.h>
#import <WebCore/StyleScope.h>
@@ -1115,7 +1116,7 @@
+ (NSArray *)_excludedElementsForAttributedStringConversion
{
- static NSArray *elements = [[NSArray alloc] initWithObjects:
+ NSMutableArray *elements = [[NSMutableArray alloc] initWithObjects:
// Omit style since we want style to be inline so the fragment can be easily inserted.
@"style",
// Omit xml so the result is not XHTML.
@@ -1125,8 +1126,18 @@
// Omit deprecated tags.
@"applet", @"basefont", @"center", @"dir", @"font", @"menu", @"s", @"strike", @"u",
// Omit object so no file attachments are part of the fragment.
- @"object", nil];
- return elements;
+#if !ENABLE(ATTACHMENT_ELEMENT)
+ // Omit object so no file attachments are part of the fragment.
+ @"object",
+#endif
+ nil];
+
+#if ENABLE(ATTACHMENT_ELEMENT)
+ if (!RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled())
+ [elements addObject:@"object"];
+#endif
+
+ return [elements autorelease];
}
- (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes