Changeset 208451 in webkit
- Timestamp:
- Nov 9, 2016 11:14:17 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208450 r208451 1 2016-11-09 Chris Dumez <cdumez@apple.com> 2 3 Use Blob URL instead of webkit-fake-url when pasting an image 4 https://bugs.webkit.org/show_bug.cgi?id=49141 5 6 Reviewed by Darin Adler. 7 8 Add layout test coverage checking that the image shows as expected and that the 9 resulting URL is indeed a Blob URL. 10 11 * editing/pasteboard/paste-image-as-blob-url-expected.txt: Added. 12 * editing/pasteboard/paste-image-as-blob-url.html: Added. 13 * editing/pasteboard/paste-image-using-image-data-expected.html: Added. 14 * editing/pasteboard/paste-image-using-image-data.html: Added. 15 1 16 2016-11-07 Yusuke Suzuki <utatane.tea@gmail.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r208449 r208451 1 2016-11-09 Chris Dumez <cdumez@apple.com> 2 3 Use Blob URL instead of webkit-fake-url when pasting an image 4 https://bugs.webkit.org/show_bug.cgi?id=49141 5 6 Reviewed by Darin Adler. 7 8 Use Blob URL instead of webkit-fake-url when pasting an image. 9 10 Tests: editing/pasteboard/paste-image-as-blob-url.html 11 editing/pasteboard/paste-image-using-image-data.html 12 13 * editing/Editor.h: 14 * editing/mac/EditorMac.mm: 15 (WebCore::Editor::WebContentReader::readImage): 16 (WebCore::Editor::createFragmentForImageAndURL): 17 1 18 2016-11-09 Michael Catanzaro <mcatanzaro@igalia.com> 2 19 -
trunk/Source/WebCore/editing/Editor.h
r208406 r208451 519 519 RefPtr<Range> adjustedSelectionRange(); 520 520 RefPtr<DocumentFragment> createFragmentForImageResourceAndAddResource(RefPtr<ArchiveResource>&&); 521 Ref<DocumentFragment> createFragmentForImageAndURL(const String&); 521 522 RefPtr<DocumentFragment> createFragmentAndAddResources(NSAttributedString *); 522 523 FragmentAndResources createFragment(NSAttributedString *); -
trunk/Source/WebCore/editing/mac/EditorMac.mm
r208406 r208451 27 27 #import "Editor.h" 28 28 29 #import "Blob.h" 29 30 #import "CSSPrimitiveValueMappings.h" 30 31 #import "CSSValuePool.h" 31 32 #import "CachedResourceLoader.h" 32 33 #import "ColorMac.h" 34 #import "DOMURL.h" 33 35 #import "DataTransfer.h" 34 36 #import "DocumentFragment.h" … … 611 613 String typeAsFilenameWithExtension = type; 612 614 typeAsFilenameWithExtension.replace('/', '.'); 613 URL imageURL = URL::fakeURLWithRelativePart(typeAsFilenameWithExtension); 614 615 fragment = frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(WTFMove(buffer), imageURL, type, emptyString(), emptyString())); 615 616 Vector<uint8_t> data; 617 data.append(buffer->data(), buffer->size()); 618 auto blob = Blob::create(WTFMove(data), type); 619 ASSERT(frame.document()); 620 String blobURL = DOMURL::createObjectURL(*frame.document(), blob); 621 622 fragment = frame.editor().createFragmentForImageAndURL(blobURL); 616 623 return fragment; 617 624 } … … 670 677 671 678 return WTFMove(fragment); 679 } 680 681 Ref<DocumentFragment> Editor::createFragmentForImageAndURL(const String& url) 682 { 683 auto imageElement = HTMLImageElement::create(*m_frame.document()); 684 imageElement->setAttributeWithoutSynchronization(HTMLNames::srcAttr, url); 685 686 auto fragment = document().createDocumentFragment(); 687 fragment->appendChild(imageElement); 688 689 return fragment; 672 690 } 673 691 -
trunk/Source/WebCore/fileapi/Blob.cpp
r206208 r208451 78 78 } 79 79 80 Blob::Blob(Vector<uint8_t> data, const String& contentType)80 Blob::Blob(Vector<uint8_t>&& data, const String& contentType) 81 81 : m_type(contentType) 82 82 , m_size(data.size()) … … 88 88 } 89 89 90 Blob::Blob(Vector<BlobPart> blobParts, const String& contentType)90 Blob::Blob(Vector<BlobPart>&& blobParts, const String& contentType) 91 91 : m_type(contentType) 92 92 , m_size(-1) -
trunk/Source/WebCore/fileapi/Blob.h
r204717 r208451 49 49 } 50 50 51 static Ref<Blob> create(Vector<uint8_t> data, const String& contentType)51 static Ref<Blob> create(Vector<uint8_t>&& data, const String& contentType) 52 52 { 53 53 return adoptRef(*new Blob(WTFMove(data), contentType)); 54 54 } 55 55 56 static Ref<Blob> create(Vector<BlobPart> blobParts, const String& contentType)56 static Ref<Blob> create(Vector<BlobPart>&& blobParts, const String& contentType) 57 57 { 58 58 return adoptRef(*new Blob(WTFMove(blobParts), contentType)); … … 92 92 protected: 93 93 Blob(); 94 Blob(Vector<uint8_t> , const String& contentType);95 Blob(Vector<BlobPart> , const String& contentType);94 Blob(Vector<uint8_t>&&, const String& contentType); 95 Blob(Vector<BlobPart>&&, const String& contentType); 96 96 97 97 enum UninitializedContructor { uninitializedContructor }; -
trunk/Source/WebCore/platform/network/BlobPart.h
r198869 r208451 43 43 } 44 44 45 BlobPart(Vector<uint8_t> data)45 BlobPart(Vector<uint8_t>&& data) 46 46 : m_type(Data) 47 47 , m_data(WTFMove(data))
Note: See TracChangeset
for help on using the changeset viewer.