WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-19893-20161024124204.patch (text/plain), 11.22 KB, created by
Chris Dumez
on 2016-10-24 12:45:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2016-10-24 12:45:49 PDT
Size:
11.22 KB
patch
obsolete
>Subversion Revision: 207762 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0e3d32da241ec1873dd05c58950ec2b1c656a044..e4a4550d923831905f8b6531c709839a9f7000e8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2016-10-24 Chris Dumez <cdumez@apple.com> >+ >+ event.(dataTransfer|clipboardData).getData('text/html') (onpaste, ondrop) >+ https://bugs.webkit.org/show_bug.cgi?id=19893 >+ <rdar://problem/6055546> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We now write selection as HTML as well to the pasteboard so that >+ event.(dataTransfer|clipboardData).getData('text/html') now works. >+ >+ I have verified manually that it is still possible to copy text from >+ Safari and paste it to Excel 2011 Mac after this change. The text is >+ now pasted as HTML instead of text, which is fine because Excel can >+ display HTML. >+ >+ No new tests, unskipped existing tests. >+ >+ * editing/Editor.h: >+ * editing/mac/EditorMac.mm: >+ (WebCore::Editor::selectionInHTMLFormat): >+ (WebCore::Editor::writeSelectionToPasteboard): >+ * platform/Pasteboard.h: >+ * platform/mac/PasteboardMac.mm: >+ (WebCore::Pasteboard::write): >+ > 2016-10-24 Youenn Fablet <youenn@apple.com> > > Activate WEB_RTC compilation flags for Mac bots >diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h >index d77f1cd7fcd46e957ce10544687c0b9931b30f07..5f11e35c64d11ee81389a59f3c3793f6495096e1 100644 >--- a/Source/WebCore/editing/Editor.h >+++ b/Source/WebCore/editing/Editor.h >@@ -509,6 +509,7 @@ private: > > #if PLATFORM(COCOA) > RefPtr<SharedBuffer> selectionInWebArchiveFormat(); >+ String selectionInHTMLFormat(); > RefPtr<SharedBuffer> imageInWebArchiveFormat(Element&); > RefPtr<Range> adjustedSelectionRange(); > RefPtr<DocumentFragment> createFragmentForImageResourceAndAddResource(RefPtr<ArchiveResource>&&); >diff --git a/Source/WebCore/editing/mac/EditorMac.mm b/Source/WebCore/editing/mac/EditorMac.mm >index 1d664b731b88ad75ee8fb35d84cccf6d4d891383..75db2eb1ee00cb3f97bf67215b76a98f580944bd 100644 >--- a/Source/WebCore/editing/mac/EditorMac.mm >+++ b/Source/WebCore/editing/mac/EditorMac.mm >@@ -310,6 +310,11 @@ RefPtr<SharedBuffer> Editor::selectionInWebArchiveFormat() > return SharedBuffer::wrapCFData(archive->rawDataRepresentation().get()); > } > >+String Editor::selectionInHTMLFormat() >+{ >+ return createMarkup(*selectedRange(), nullptr, AnnotateForInterchange, false, ResolveNonLocalURLs); >+} >+ > RefPtr<SharedBuffer> Editor::imageInWebArchiveFormat(Element& imageElement) > { > RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(imageElement); >@@ -393,6 +398,7 @@ void Editor::writeSelectionToPasteboard(Pasteboard& pasteboard) > content.dataInWebArchiveFormat = selectionInWebArchiveFormat(); > content.dataInRTFDFormat = [attributedString containsAttachments] ? dataInRTFDFormat(attributedString) : 0; > content.dataInRTFFormat = dataInRTFFormat(attributedString); >+ content.dataInHTMLFormat = selectionInHTMLFormat(); > content.dataInStringFormat = stringSelectionForPasteboardWithImageAltText(); > client()->getClientPasteboardDataForRange(selectedRange().get(), content.clientTypes, content.clientData); > >diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h >index 56d0b758dc736ce90dd2fe5b1083ae5e03203af9..ce9ae8e028d2235353c9d7bc6165b911f4c2795a 100644 >--- a/Source/WebCore/platform/Pasteboard.h >+++ b/Source/WebCore/platform/Pasteboard.h >@@ -70,6 +70,7 @@ struct PasteboardWebContent { > RefPtr<SharedBuffer> dataInWebArchiveFormat; > RefPtr<SharedBuffer> dataInRTFDFormat; > RefPtr<SharedBuffer> dataInRTFFormat; >+ String dataInHTMLFormat; > String dataInStringFormat; > Vector<String> clientTypes; > Vector<RefPtr<SharedBuffer>> clientData; >diff --git a/Source/WebCore/platform/mac/PasteboardMac.mm b/Source/WebCore/platform/mac/PasteboardMac.mm >index 22a276dbb169d4524d24e6cef20064d09aa84cd4..1469f4a784fa6bc95cef70d03f02df1f35219ff6 100644 >--- a/Source/WebCore/platform/mac/PasteboardMac.mm >+++ b/Source/WebCore/platform/mac/PasteboardMac.mm >@@ -153,6 +153,8 @@ void Pasteboard::write(const PasteboardWebContent& content) > types.append(String(NSRTFDPboardType)); > if (content.dataInRTFFormat) > types.append(String(NSRTFPboardType)); >+ if (!content.dataInHTMLFormat.isNull()) >+ types.append(String(NSHTMLPboardType)); > if (!content.dataInStringFormat.isNull()) > types.append(String(NSStringPboardType)); > types.appendVector(content.clientTypes); >@@ -170,6 +172,8 @@ void Pasteboard::write(const PasteboardWebContent& content) > m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInRTFDFormat.get(), NSRTFDPboardType, m_pasteboardName); > if (content.dataInRTFFormat) > m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInRTFFormat.get(), NSRTFPboardType, m_pasteboardName); >+ if (!content.dataInHTMLFormat.isNull()) >+ m_changeCount = platformStrategies()->pasteboardStrategy()->setStringForType(content.dataInHTMLFormat, NSHTMLPboardType, m_pasteboardName); > if (!content.dataInStringFormat.isNull()) > m_changeCount = platformStrategies()->pasteboardStrategy()->setStringForType(content.dataInStringFormat, NSStringPboardType, m_pasteboardName); > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 3f753e443bdbfdad78c40170a197e3dfa2d08855..77d77dc4734c16c261f20b4468be470220355d05 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2016-10-24 Chris Dumez <cdumez@apple.com> >+ >+ event.(dataTransfer|clipboardData).getData('text/html') (onpaste, ondrop) >+ https://bugs.webkit.org/show_bug.cgi?id=19893 >+ <rdar://problem/6055546> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Unskip corresponding tests on Mac. >+ >+ * editing/pasteboard/onpaste-text-html-expected.txt: >+ * fast/events/ondrop-text-html-expected.txt: >+ * platform/mac/TestExpectations: >+ * platform/wk2/TestExpectations: >+ > 2016-10-24 Youenn Fablet <youenn@apple.com> > > Activate WEB_RTC compilation flags for Mac bots >diff --git a/LayoutTests/editing/pasteboard/onpaste-text-html-expected.txt b/LayoutTests/editing/pasteboard/onpaste-text-html-expected.txt >index 9c048b8995dc9ff768637fe718f16d5897cf11d9..35bf0c797bc7425b0c6b248b026b9bae09e72968 100644 >--- a/LayoutTests/editing/pasteboard/onpaste-text-html-expected.txt >+++ b/LayoutTests/editing/pasteboard/onpaste-text-html-expected.txt >@@ -1,5 +1,5 @@ > CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the clipboard during an onpaste event. >-CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space"> </span></span> >+CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space"> </span></span> > This test verifies that we can get text/html from the clipboard during an onpaste event. This test requires DRT. > Paste content in this div.This test verifies that we can get text/html from the clipboard during an onpaste event. > PASS >diff --git a/LayoutTests/fast/events/ondrop-text-html-expected.txt b/LayoutTests/fast/events/ondrop-text-html-expected.txt >index c622027636e33a9aa4c59e66165c0ffce48512e0..9a68043c0ee0f0b9b2a44e710ecf33011ccb8e58 100644 >--- a/LayoutTests/fast/events/ondrop-text-html-expected.txt >+++ b/LayoutTests/fast/events/ondrop-text-html-expected.txt >@@ -1,4 +1,4 @@ > CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the drag object during an ondrop event. >-CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the drag object during an ondrop event.<span class="Apple-converted-space"> </span></span> >+CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the drag object during an ondrop event.<span class="Apple-converted-space"> </span></span> > This test verifies that we can get text/html from the drag object during an ondrop event. This test requires DRT. > PASS >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index 248f0469ef0ae666cafbf1341aeb337f813f63c8..1cb200cb1efeca7aa4cb6c863581fec2bb7329ee 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -96,11 +96,6 @@ webkit.org/b/36642 fast/replaced/border-radius-clip.html [ Pass Failure ] > # Need to add functionality to DumpRenderTree to handle scrollbar policy changes > fast/overflow/scrollbar-restored-and-then-locked.html > >-# Mac port doesn't put text/html on the pasteboard for app compatibility: https://bugs.webkit.org/show_bug.cgi?id=19893 >-editing/pasteboard/onpaste-text-html-types.html >-editing/pasteboard/onpaste-text-html.html >-fast/events/ondrop-text-html.html >- > # EventSendingController does not send events on areas outside the WebView. > scrollbars/scrollbar-click-does-not-blur-content.html > >diff --git a/LayoutTests/platform/wk2/TestExpectations b/LayoutTests/platform/wk2/TestExpectations >index 9480583d10ac4502d0bed162072ad87c628739ec..c4a95fbb7e1fc39fc52358400b87f91c42522c82 100644 >--- a/LayoutTests/platform/wk2/TestExpectations >+++ b/LayoutTests/platform/wk2/TestExpectations >@@ -224,6 +224,7 @@ fast/harness/use-page-cache.html > fast/events/controlclick-no-onclick.html > fast/events/moving-text-should-fire-drop-and-dragend-events.html > fast/events/moving-text-should-fire-drop-and-dragend-events-2.html >+fast/events/ondrop-text-html.html > editing/pasteboard/drag-drop-url-with-style.html > > # WTR needs an implementation for eventSender.continuousMouseScrollBy
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 19893
:
50877
| 292643