Diff
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog 2019-05-28 04:06:02 UTC (rev 245805)
@@ -1,3 +1,7 @@
+2019-05-27 Babak Shafiei <[email protected]>
+
+ Revert r245637. rdar://problem/35205373
+
2019-05-26 Babak Shafiei <[email protected]>
Cherry-pick r245637. rdar://problem/35205373
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/WebContentReader.h 2019-05-28 04:06:02 UTC (rev 245805)
@@ -76,7 +76,7 @@
bool readHTML(const String&) override;
bool readRTFD(SharedBuffer&) override;
bool readRTF(SharedBuffer&) override;
- bool readImage(Ref<SharedBuffer>&&, const String& type, Optional<FloatSize> preferredPresentationSize = { }) override;
+ bool readImage(Ref<SharedBuffer>&&, const String& type) override;
bool readURL(const URL&, const String& title) override;
bool readDataBuffer(SharedBuffer&, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize = { }) override;
#endif
@@ -100,7 +100,7 @@
bool readHTML(const String&) override;
bool readRTFD(SharedBuffer&) override;
bool readRTF(SharedBuffer&) override;
- bool readImage(Ref<SharedBuffer>&&, const String&, Optional<FloatSize> = { }) override { return false; }
+ bool readImage(Ref<SharedBuffer>&&, const String&) override { return false; }
bool readURL(const URL&, const String&) override { return false; }
bool readDataBuffer(SharedBuffer&, const String&, const String&, Optional<FloatSize> = { }) override { return false; }
#endif
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2019-05-28 04:06:02 UTC (rev 245805)
@@ -246,7 +246,7 @@
#endif
-static Ref<DocumentFragment> createFragmentForImageAttachment(Frame& frame, Document& document, Ref<SharedBuffer>&& buffer, const String& contentType, Optional<FloatSize> preferredSize)
+static Ref<DocumentFragment> createFragmentForImageAttachment(Frame& frame, Document& document, Ref<SharedBuffer>&& buffer, const String& contentType)
{
#if ENABLE(ATTACHMENT_ELEMENT)
auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document);
@@ -260,10 +260,6 @@
auto image = HTMLImageElement::create(document);
image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, Blob::create(buffer.get(), contentType)));
image->setAttachmentElement(WTFMove(attachment));
- if (preferredSize) {
- image->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomicString::number(preferredSize->width()));
- image->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomicString::number(preferredSize->height()));
- }
fragment->appendChild(WTFMove(image));
} else {
attachment->updateAttributes(buffer->size(), contentType, defaultImageAttachmentName);
@@ -680,14 +676,14 @@
return true;
}
-bool WebContentReader::readImage(Ref<SharedBuffer>&& buffer, const String& type, Optional<FloatSize> preferredPresentationSize)
+bool WebContentReader::readImage(Ref<SharedBuffer>&& buffer, const String& type)
{
ASSERT(frame.document());
auto& document = *frame.document();
if (shouldReplaceRichContentWithAttachments())
- addFragment(createFragmentForImageAttachment(frame, document, WTFMove(buffer), type, preferredPresentationSize));
+ addFragment(createFragmentForImageAttachment(frame, document, WTFMove(buffer), type));
else
- addFragment(createFragmentForImageAndURL(document, DOMURL::createObjectURL(document, Blob::create(buffer.get(), type)), preferredPresentationSize));
+ addFragment(createFragmentForImageAndURL(document, DOMURL::createObjectURL(document, Blob::create(buffer.get(), type))));
return fragment;
}
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/gtk/EditorGtk.cpp (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/gtk/EditorGtk.cpp 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/gtk/EditorGtk.cpp 2019-05-28 04:06:02 UTC (rev 245805)
@@ -69,7 +69,7 @@
auto blob = Blob::create(WTFMove(buffer), "image/png");
if (!frame.document())
return nullptr;
- return createFragmentForImageAndURL(*frame.document(), DOMURL::createObjectURL(*frame.document(), blob), { });
+ return createFragmentForImageAndURL(*frame.document(), DOMURL::createObjectURL(*frame.document(), blob));
}
}
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/markup.cpp (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/markup.cpp 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/markup.cpp 2019-05-28 04:06:02 UTC (rev 245805)
@@ -1226,14 +1226,10 @@
return fragment;
}
-Ref<DocumentFragment> createFragmentForImageAndURL(Document& document, const String& url, Optional<FloatSize> preferredSize)
+Ref<DocumentFragment> createFragmentForImageAndURL(Document& document, const String& url)
{
auto imageElement = HTMLImageElement::create(document);
imageElement->setAttributeWithoutSynchronization(HTMLNames::srcAttr, url);
- if (preferredSize) {
- imageElement->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomicString::number(preferredSize->width()));
- imageElement->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomicString::number(preferredSize->height()));
- }
auto fragment = document.createDocumentFragment();
fragment->appendChild(imageElement);
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/editing/markup.h (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/editing/markup.h 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/editing/markup.h 2019-05-28 04:06:02 UTC (rev 245805)
@@ -59,7 +59,7 @@
WEBCORE_EXPORT Ref<DocumentFragment> createFragmentFromMarkup(Document&, const String& markup, const String& baseURL, ParserContentPolicy = AllowScriptingContent);
ExceptionOr<Ref<DocumentFragment>> createFragmentForInnerOuterHTML(Element&, const String& markup, ParserContentPolicy);
RefPtr<DocumentFragment> createFragmentForTransformToFragment(Document&, const String& sourceString, const String& sourceMIMEType);
-Ref<DocumentFragment> createFragmentForImageAndURL(Document&, const String&, Optional<FloatSize> preferredSize);
+Ref<DocumentFragment> createFragmentForImageAndURL(Document&, const String&);
ExceptionOr<Ref<DocumentFragment>> createContextualFragment(Element&, const String& markup, ParserContentPolicy);
bool isPlainTextMarkup(Node*);
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/platform/Pasteboard.h 2019-05-28 04:06:02 UTC (rev 245805)
@@ -141,7 +141,7 @@
virtual bool readHTML(const String&) = 0;
virtual bool readRTFD(SharedBuffer&) = 0;
virtual bool readRTF(SharedBuffer&) = 0;
- virtual bool readImage(Ref<SharedBuffer>&&, const String& type, Optional<FloatSize> preferredPresentationSize = { }) = 0;
+ virtual bool readImage(Ref<SharedBuffer>&&, const String& type) = 0;
virtual bool readURL(const URL&, const String& title) = 0;
virtual bool readDataBuffer(SharedBuffer&, const String& type, const String& name, Optional<FloatSize> preferredPresentationSize = { }) = 0;
#endif
@@ -289,7 +289,7 @@
DidNotReadType,
PasteboardWasChangedExternally
};
- ReaderResult readPasteboardWebContentDataForType(PasteboardWebContentReader&, PasteboardStrategy&, NSString *type, const PasteboardItemInfo&, int itemIndex);
+ ReaderResult readPasteboardWebContentDataForType(PasteboardWebContentReader&, PasteboardStrategy&, NSString *type, int itemIndex);
#endif
#if PLATFORM(WIN)
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/platform/PasteboardItemInfo.h (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/platform/PasteboardItemInfo.h 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/platform/PasteboardItemInfo.h 2019-05-28 04:06:02 UTC (rev 245805)
@@ -42,7 +42,6 @@
Vector<String> contentTypesForFileUpload;
Vector<String> contentTypesByFidelity;
String suggestedFileName;
- Optional<FloatSize> preferredPresentationSize;
bool isNonTextType { false };
bool containsFileURLAndFileUploadContent { false };
PasteboardItemPresentationStyle preferredPresentationStyle { PasteboardItemPresentationStyle::Unspecified };
@@ -98,7 +97,7 @@
template<class Encoder>
void PasteboardItemInfo::encode(Encoder& encoder) const
{
- encoder << pathsForFileUpload << contentTypesForFileUpload << contentTypesByFidelity << suggestedFileName << preferredPresentationSize << isNonTextType << containsFileURLAndFileUploadContent;
+ encoder << pathsForFileUpload << contentTypesForFileUpload << contentTypesByFidelity << suggestedFileName << isNonTextType << containsFileURLAndFileUploadContent;
encoder.encodeEnum(preferredPresentationStyle);
}
@@ -118,9 +117,6 @@
if (!decoder.decode(result.suggestedFileName))
return WTF::nullopt;
- if (!decoder.decode(result.preferredPresentationSize))
- return WTF::nullopt;
-
if (!decoder.decode(result.isNonTextType))
return WTF::nullopt;
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PasteboardIOS.mm 2019-05-28 04:06:02 UTC (rev 245805)
@@ -181,7 +181,7 @@
|| [type isEqualToString:(__bridge NSString *)kUTTypeFlatRTFD];
}
-Pasteboard::ReaderResult Pasteboard::readPasteboardWebContentDataForType(PasteboardWebContentReader& reader, PasteboardStrategy& strategy, NSString *type, const PasteboardItemInfo& itemInfo, int itemIndex)
+Pasteboard::ReaderResult Pasteboard::readPasteboardWebContentDataForType(PasteboardWebContentReader& reader, PasteboardStrategy& strategy, NSString *type, int itemIndex)
{
if ([type isEqualToString:WebArchivePboardType] || [type isEqualToString:(__bridge NSString *)kUTTypeWebArchive]) {
auto buffer = strategy.readBufferFromPasteboard(itemIndex, type, m_pasteboardName);
@@ -225,7 +225,7 @@
RefPtr<SharedBuffer> buffer = strategy.readBufferFromPasteboard(itemIndex, type, m_pasteboardName);
if (m_changeCount != changeCount())
return ReaderResult::PasteboardWasChangedExternally;
- return buffer && reader.readImage(buffer.releaseNonNull(), type, itemInfo.preferredPresentationSize) ? ReaderResult::ReadType : ReaderResult::DidNotReadType;
+ return buffer && reader.readImage(buffer.releaseNonNull(), type) ? ReaderResult::ReadType : ReaderResult::DidNotReadType;
}
if ([type isEqualToString:(__bridge NSString *)kUTTypeURL]) {
@@ -318,7 +318,7 @@
if (!isTypeAllowedByReadingPolicy(type, policy))
continue;
- auto itemResult = readPasteboardWebContentDataForType(reader, strategy, type, info, i);
+ auto itemResult = readPasteboardWebContentDataForType(reader, strategy, type, i);
if (itemResult == ReaderResult::PasteboardWasChangedExternally)
return;
@@ -358,7 +358,7 @@
if (!isTypeAllowedByReadingPolicy(type, policy))
continue;
- result = readPasteboardWebContentDataForType(reader, strategy, type, info, index);
+ result = readPasteboardWebContentDataForType(reader, strategy, type, index);
if (result == ReaderResult::PasteboardWasChangedExternally)
return;
if (result == ReaderResult::ReadType)
Modified: branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-05-28 04:06:02 UTC (rev 245805)
@@ -155,8 +155,6 @@
#if PASTEBOARD_SUPPORTS_PRESENTATION_STYLE_AND_TEAM_DATA
info.preferredPresentationStyle = pasteboardItemPresentationStyle(itemProvider.preferredPresentationStyle);
#endif
- if (!CGSizeEqualToSize(itemProvider.preferredPresentationSize, CGSizeZero))
- info.preferredPresentationSize = FloatSize { itemProvider.preferredPresentationSize };
info.containsFileURLAndFileUploadContent = itemProvider.web_containsFileURLAndFileUploadContent;
info.suggestedFileName = itemProvider.suggestedName;
NSArray<NSString *> *registeredTypeIdentifiers = itemProvider.registeredTypeIdentifiers;
Modified: branches/safari-608.1.24.20-branch/Source/WebKit/ChangeLog (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Source/WebKit/ChangeLog 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Source/WebKit/ChangeLog 2019-05-28 04:06:02 UTC (rev 245805)
@@ -1,5 +1,9 @@
2019-05-27 Babak Shafiei <[email protected]>
+ Revert r245637. rdar://problem/35205373
+
+2019-05-27 Babak Shafiei <[email protected]>
+
Cherry-pick r245803. rdar://problem/51145977
[iOS] Dropping in an editable element should result in a ranged selection
Modified: branches/safari-608.1.24.20-branch/Tools/ChangeLog (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Tools/ChangeLog 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Tools/ChangeLog 2019-05-28 04:06:02 UTC (rev 245805)
@@ -1,5 +1,9 @@
2019-05-27 Babak Shafiei <[email protected]>
+ Revert r245637. rdar://problem/35205373
+
+2019-05-27 Babak Shafiei <[email protected]>
+
Cherry-pick r245803. rdar://problem/51145977
[iOS] Dropping in an editable element should result in a ranged selection
Modified: branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm (245804 => 245805)
--- branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm 2019-05-28 01:36:11 UTC (rev 245804)
+++ branches/safari-608.1.24.20-branch/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm 2019-05-28 04:06:02 UTC (rev 245805)
@@ -302,52 +302,6 @@
EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"textData.textContent"]);
}
-TEST(UIPasteboardTests, ValidPreferredPresentationSizeForImage)
-{
- auto webView = setUpWebViewForPasteboardTests(@"autofocus-contenteditable");
- auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
- [itemProvider setPreferredPresentationSize:CGSizeMake(10, 20)];
- [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypePNG visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[] (DataLoadCompletionBlock completionHandler) -> NSProgress * {
- completionHandler([NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"icon" withExtension:@"png" subdirectory:@"TestWebKitAPI.resources"]], nil);
- return nil;
- }];
- [UIPasteboard generalPasteboard].itemProviders = @[ itemProvider.get() ];
- [webView paste:nil];
-
- EXPECT_WK_STREQ("10", [webView stringByEvaluatingJavaScript:@"document.querySelector('img').width"]);
- EXPECT_WK_STREQ("20", [webView stringByEvaluatingJavaScript:@"document.querySelector('img').height"]);
-}
-
-TEST(UIPasteboardTests, InvalidPreferredPresentationSizeForImage)
-{
- auto webView = setUpWebViewForPasteboardTests(@"autofocus-contenteditable");
- auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
- [itemProvider setPreferredPresentationSize:CGSizeMake(-10, -20)];
- [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypePNG visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[] (DataLoadCompletionBlock completionHandler) -> NSProgress * {
- completionHandler([NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"icon" withExtension:@"png" subdirectory:@"TestWebKitAPI.resources"]], nil);
- return nil;
- }];
- [UIPasteboard generalPasteboard].itemProviders = @[ itemProvider.get() ];
- [webView paste:nil];
-
- EXPECT_WK_STREQ("0", [webView stringByEvaluatingJavaScript:@"document.querySelector('img').width"]);
- EXPECT_WK_STREQ("174", [webView stringByEvaluatingJavaScript:@"document.querySelector('img').height"]);
-}
-
-TEST(UIPasteboardTests, MissingPreferredPresentationSizeForImage)
-{
- auto webView = setUpWebViewForPasteboardTests(@"autofocus-contenteditable");
- auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
- [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypePNG visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[] (DataLoadCompletionBlock completionHandler) -> NSProgress * {
- completionHandler([NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"icon" withExtension:@"png" subdirectory:@"TestWebKitAPI.resources"]], nil);
- return nil;
- }];
- [UIPasteboard generalPasteboard].itemProviders = @[ itemProvider.get() ];
- [webView paste:nil];
-
- EXPECT_WK_STREQ("0", [webView stringByEvaluatingJavaScript:@"document.querySelector('img').width"]);
- EXPECT_WK_STREQ("174", [webView stringByEvaluatingJavaScript:@"document.querySelector('img').height"]);
-}
#endif // PLATFORM(IOS)
} // namespace TestWebKitAPI