Changeset 223140 in webkit
- Timestamp:
- Oct 10, 2017 1:50:20 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223135 r223140 1 2017-10-10 Ryosuke Niwa <rniwa@webkit.org> 2 3 Loading should be disabled while constructing the fragment in WebContentReader::readWebArchive 4 https://bugs.webkit.org/show_bug.cgi?id=178118 5 6 Reviewed by Antti Koivisto. 7 8 Updated the existing tests to wait for images to load in each step explicitly instead of relying on 9 them being loaded synchronously or that it's loaded within 100-200ms. 10 11 * editing/pasteboard/4641033.html: 12 * editing/pasteboard/4947130.html: 13 * editing/pasteboard/4989774.html: 14 * editing/pasteboard/drag-selected-image-to-contenteditable.html: 15 * editing/selection/drag-to-contenteditable-iframe.html: 16 * platform/ios/TestExpectations: Skipped editing/selection/drag-to-contenteditable-iframe.html on iOS 17 since we don't support testing drag & drop on iOS. Also added [ Skip ] to other entires there. 18 1 19 2017-10-10 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/LayoutTests/editing/pasteboard/4641033.html
r120173 r223140 13 13 var start = document.getElementById("start"); 14 14 var end = document.getElementById("end"); 15 15 16 16 var s = window.getSelection(); 17 17 s.setBaseAndExtent(start, 0, end, end.childNodes.length); 18 18 19 19 document.execCommand("Copy"); 20 20 21 21 s.setPosition(document.getElementById("paste"), 0); 22 22 document.execCommand("Paste"); 23 23 24 const pastedImageElement = document.querySelector('#paste img'); 25 if (pastedImageElement.complete) 26 finish(); 27 else 28 pastedImageElement.onload = finish; 29 } 30 function finish() { 24 31 if (window.testRunner) 25 window.testRunner.notifyDone(); 26 32 window.testRunner.notifyDone(); 27 33 } 28 34 if (window.testRunner) 29 35 window.testRunner.waitUntilDone(); 30 window. setTimeout(runTest, 100);36 window.onload = runTest; 31 37 32 38 </script> -
trunk/LayoutTests/editing/pasteboard/4947130.html
r120173 r223140 6 6 <script> 7 7 8 if (window.testRunner) 9 testRunner.waitUntilDone(); 10 8 11 function runTest() { 9 12 if (!window.testRunner) 10 13 return; 11 12 window.testRunner.waitUntilDone();13 14 window.setTimeout(step2, 200);15 }16 17 function step2() {18 14 19 15 var img = document.getElementById("img"); … … 22 18 var x = left + img.offsetWidth / 2; 23 19 var y = top + img.offsetHeight / 2; 24 20 25 21 eventSender.mouseMoveTo(x, y); 26 22 eventSender.mouseDown(); … … 30 26 eventSender.mouseUp(); 31 27 32 window.testRunner.notifyDone(); 28 if (img.complete) 29 testRunner.notifyDone(); 30 else 31 img.onload = () => testRunner.notifyDone(); 33 32 } 34 33 35 runTest();34 window.onload = runTest; 36 35 </script> -
trunk/LayoutTests/editing/pasteboard/4989774.html
r120173 r223140 2 2 3 3 <script> 4 function partTwo() { 4 function runTest() 5 { 5 6 sel.setBaseAndExtent(body, 0, body, body.childNodes.length); 6 7 document.execCommand("Copy"); … … 10 11 document.execCommand("InsertLineBreak"); 11 12 document.execCommand("InsertText", false, "This tests for a bug where an images pasted on the same line would appear on different lines. You should see several pictures above all in the same line/paragraph."); 12 window.testRunner.notifyDone(); 13 Promise.all(Array.from(document.querySelectorAll('img')).map((img) => { 14 if (img.complete) 15 return; 16 return new Promise((resolve) => img.onload = resolve); 17 })).then(() => testRunner.notifyDone()); 13 18 } 14 19 … … 18 23 window.testRunner.waitUntilDone(); 19 24 20 window. setTimeout(partTwo, 200);25 window.onload = runTest; 21 26 } else { 22 27 document.execCommand("SelectAll") -
trunk/LayoutTests/editing/pasteboard/drag-selected-image-to-contenteditable.html
r120173 r223140 20 20 if (window.testRunner) 21 21 testRunner.waitUntilDone(); 22 // Let the subframe come into being.23 window.setTimeout(step2, 100);24 22 e = document.getElementById("dragme"); 25 23 setSelectionCommand(e, 0, e, 1); 26 }27 24 28 function step2()29 {30 25 if (!window.testRunner) { 31 26 log("This test uses the eventSender. To run it manually, drag the selected image into the editable div and drop it. It should appear inside the editable div."); … … 47 42 eventSender.mouseMoveTo(x, y); 48 43 eventSender.mouseUp(); 49 50 testRunner.notifyDone(); 44 45 Promise.all(Array.from(document.querySelectorAll('img')).map((img) => { 46 if (img.complete) 47 return; 48 return new Promise((resolve) => img.onload = resolve); 49 })).then(() => testRunner.notifyDone()); 51 50 } 51 52 52 </script> 53 53 </head> -
trunk/LayoutTests/editing/selection/drag-to-contenteditable-iframe.html
r120173 r223140 32 32 eventSender.leapForward(1000); 33 33 34 e = document.getElementById("frame");35 x = e.offsetLeft +e.offsetWidth / 2;36 y = e.offsetTop +e.offsetHeight / 2;34 const frame = document.getElementById("frame"); 35 x = frame.offsetLeft + frame.offsetWidth / 2; 36 y = frame.offsetTop + frame.offsetHeight / 2; 37 37 38 38 eventSender.mouseMoveTo(x, y); 39 39 eventSender.mouseUp(); 40 41 testRunner.notifyDone(); 40 41 const img = frame.contentDocument.querySelector('img'); 42 if (img.complete) 43 testRunner.notifyDone(); 44 else 45 img.onload = () => testRunner.notifyDone(); 42 46 } 43 47 -
trunk/LayoutTests/platform/ios/TestExpectations
r223016 r223140 237 237 238 238 # Drag-and-drop is not supported: 239 editing/pasteboard/datatransfer-items-drop-plaintext-file.html 240 editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html 241 fast/events/bogus-dropEffect-effectAllowed.html 242 fast/events/clear-drag-state.html 243 fast/events/clear-edit-drag-state.html 244 fast/events/content-changed-during-drop.html 245 fast/events/crash-on-mutate-during-drop.html 246 fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html 247 fast/events/drag-and-drop-link-containing-block.html 248 fast/events/drag-and-drop-autoscroll-inner-frame.html 249 fast/events/drag-and-drop-autoscroll.html 250 fast/events/drag-and-drop-dataTransfer-types-nocrash.html 251 fast/events/drag-and-drop-fire-drag-dragover.html 252 fast/events/drag-and-drop-set-drag-data-arguments.html 253 fast/events/drag-and-drop-subframe-dataTransfer.html 254 fast/events/drag-and-drop.html 255 fast/events/drag-customData.html 256 fast/events/drag-dataTransferItemList-file-handling.html 257 fast/events/drag-dataTransferItemList.html 258 fast/events/drag-display-none-element.html 259 fast/events/drag-file-crash.html 260 fast/events/drag-image-filename.html 261 fast/events/drag-in-frames.html 262 fast/events/drag-and-drop-link.html 263 fast/events/drag-and-drop-link-into-focused-contenteditable.html 264 fast/events/drag-outside-window.html 265 fast/events/drag-parent-node.html 266 fast/events/drag-selects-image.html 267 fast/events/drag-to-navigate.html 268 fast/events/draggable-div-nodata.html 269 fast/events/draggable-div-customdata.html 270 fast/events/drop-handler-should-not-stop-navigate.html 271 fast/events/drop-with-file-paths.html 272 fast/events/dropzone-001.html 273 fast/events/dropzone-002.html 274 fast/events/dropzone-003.html 275 fast/events/dropzone-004.html 276 fast/events/dropzone-005.html 277 fast/events/file-input-hidden-in-ondrop.html 278 fast/events/input-element-display-none-in-dragleave-crash.html 279 fast/events/moving-text-should-fire-drop-and-dragend-events-2.html 280 fast/events/moving-text-should-fire-drop-and-dragend-events.html 281 fast/events/only-valid-drop-targets-receive-file-drop.html 282 fast/events/prevent-drag-to-navigate.html 283 fast/events/standalone-image-drag-to-editable.html 284 fast/files/local-file-drag-security.html 239 editing/pasteboard/datatransfer-items-drop-plaintext-file.html [ Skip ] 240 editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html [ Skip ] 241 editing/selection/drag-to-contenteditable-iframe.html [ Skip ] 242 fast/events/bogus-dropEffect-effectAllowed.html [ Skip ] 243 fast/events/clear-drag-state.html [ Skip ] 244 fast/events/clear-edit-drag-state.html [ Skip ] 245 fast/events/content-changed-during-drop.html [ Skip ] 246 fast/events/crash-on-mutate-during-drop.html [ Skip ] 247 fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html [ Skip ] 248 fast/events/drag-and-drop-link-containing-block.html [ Skip ] 249 fast/events/drag-and-drop-autoscroll-inner-frame.html [ Skip ] 250 fast/events/drag-and-drop-autoscroll.html [ Skip ] 251 fast/events/drag-and-drop-dataTransfer-types-nocrash.html [ Skip ] 252 fast/events/drag-and-drop-fire-drag-dragover.html [ Skip ] 253 fast/events/drag-and-drop-set-drag-data-arguments.html [ Skip ] 254 fast/events/drag-and-drop-subframe-dataTransfer.html [ Skip ] 255 fast/events/drag-and-drop.html [ Skip ] 256 fast/events/drag-customData.html [ Skip ] 257 fast/events/drag-dataTransferItemList-file-handling.html [ Skip ] 258 fast/events/drag-dataTransferItemList.html [ Skip ] 259 fast/events/drag-display-none-element.html [ Skip ] 260 fast/events/drag-file-crash.html [ Skip ] 261 fast/events/drag-image-filename.html [ Skip ] 262 fast/events/drag-in-frames.html [ Skip ] 263 fast/events/drag-and-drop-link.html [ Skip ] 264 fast/events/drag-and-drop-link-into-focused-contenteditable.html [ Skip ] 265 fast/events/drag-outside-window.html [ Skip ] 266 fast/events/drag-parent-node.html [ Skip ] 267 fast/events/drag-selects-image.html [ Skip ] 268 fast/events/drag-to-navigate.html [ Skip ] 269 fast/events/draggable-div-nodata.html [ Skip ] 270 fast/events/draggable-div-customdata.html [ Skip ] 271 fast/events/drop-handler-should-not-stop-navigate.html [ Skip ] 272 fast/events/drop-with-file-paths.html [ Skip ] 273 fast/events/dropzone-001.html [ Skip ] 274 fast/events/dropzone-002.html [ Skip ] 275 fast/events/dropzone-003.html [ Skip ] 276 fast/events/dropzone-004.html [ Skip ] 277 fast/events/dropzone-005.html [ Skip ] 278 fast/events/file-input-hidden-in-ondrop.html [ Skip ] 279 fast/events/input-element-display-none-in-dragleave-crash.html [ Skip ] 280 fast/events/moving-text-should-fire-drop-and-dragend-events-2.html [ Skip ] 281 fast/events/moving-text-should-fire-drop-and-dragend-events.html [ Skip ] 282 fast/events/only-valid-drop-targets-receive-file-drop.html [ Skip ] 283 fast/events/prevent-drag-to-navigate.html [ Skip ] 284 fast/events/standalone-image-drag-to-editable.html [ Skip ] 285 fast/files/local-file-drag-security.html [ Skip ] 285 286 fast/history/page-cache-createObjectURL.html [ Skip ] 286 http/tests/local/drag-over-remote-content.html 287 http/tests/local/fileapi/send-dragged-file.html 288 http/tests/local/fileapi/send-sliced-dragged-file.html 289 http/tests/misc/bubble-drag-events.html 290 http/tests/security/drag-drop-local-file.html 291 http/tests/security/drag-drop-same-unique-origin.html 292 http/tests/security/drag-over-remote-content-iframe.html 287 http/tests/local/drag-over-remote-content.html [ Skip ] 288 http/tests/local/fileapi/send-dragged-file.html [ Skip ] 289 http/tests/local/fileapi/send-sliced-dragged-file.html [ Skip ] 290 http/tests/misc/bubble-drag-events.html [ Skip ] 291 http/tests/security/drag-drop-local-file.html [ Skip ] 292 http/tests/security/drag-drop-same-unique-origin.html [ Skip ] 293 http/tests/security/drag-over-remote-content-iframe.html [ Skip ] 293 294 294 295 # No support for force events -
trunk/Source/WebCore/ChangeLog
r223139 r223140 1 2017-10-10 Ryosuke Niwa <rniwa@webkit.org> 2 3 Loading should be disabled while constructing the fragment in WebContentReader::readWebArchive 4 https://bugs.webkit.org/show_bug.cgi?id=178118 5 6 Reviewed by Antti Koivisto. 7 8 Disable image loading while constructing the document fragment in WebContentReader::readWebArchive 9 as we do in createFragmentAndAddResources for RTF/RTFD. This refactoring is needed to start using 10 blob URL in the pasted document fragment for webkit.org/b/124391. 11 12 Also modified WebContentReader::readWebArchive to take a reference to SharedBuffer instead of a pointer. 13 14 No new tests since existing tests have been updated to cover this behavior change. 15 16 * editing/WebContentReader.h: 17 * editing/cocoa/WebContentReaderCocoa.mm: 18 (WebCore::WebContentReader::readWebArchive): Use DeferredLoadingScope to disable the loader and images 19 while constructing the document fragment. 20 * platform/Pasteboard.h: 21 * platform/ios/PasteboardIOS.mm: 22 (WebCore::readPasteboardWebContentDataForType): 23 * platform/mac/PasteboardMac.mm: 24 (WebCore::Pasteboard::read): 25 1 26 2017-10-10 Antti Koivisto <antti@apple.com> 2 27 -
trunk/Source/WebCore/editing/WebContentReader.h
r222062 r223140 55 55 private: 56 56 #if PLATFORM(COCOA) 57 bool readWebArchive(SharedBuffer *) override;57 bool readWebArchive(SharedBuffer&) override; 58 58 bool readFilenames(const Vector<String>&) override; 59 59 bool readHTML(const String&) override; -
trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
r223020 r223140 180 180 } 181 181 182 bool WebContentReader::readWebArchive(SharedBuffer* buffer) 183 { 184 if (frame.settings().preferMIMETypeForImages()) 185 return false; 186 187 if (!frame.document()) 188 return false; 189 190 if (!buffer) 191 return false; 192 193 auto archive = LegacyWebArchive::create(URL(), *buffer); 182 bool WebContentReader::readWebArchive(SharedBuffer& buffer) 183 { 184 if (frame.settings().preferMIMETypeForImages() || !frame.document()) 185 return false; 186 187 auto archive = LegacyWebArchive::create(URL(), buffer); 194 188 if (!archive) 195 189 return false; … … 203 197 return false; 204 198 205 // FIXME: The code in createFragmentAndAddResources calls setDefersLoading(true). Don't we need that here? 199 DeferredLoadingScope scope(frame); 200 auto markupString = String::fromUTF8(mainResource->data().data(), mainResource->data().size()); 201 addFragment(createFragmentFromMarkup(*frame.document(), markupString, mainResource->url(), DisallowScriptingAndPluginContent)); 202 206 203 if (DocumentLoader* loader = frame.loader().documentLoader()) 207 204 loader->addAllArchiveResources(*archive); 208 205 209 auto markupString = String::fromUTF8(mainResource->data().data(), mainResource->data().size());210 addFragment(createFragmentFromMarkup(*frame.document(), markupString, mainResource->url(), DisallowScriptingAndPluginContent));211 206 return true; 212 207 } -
trunk/Source/WebCore/platform/Pasteboard.h
r222761 r223140 131 131 132 132 #if !(PLATFORM(GTK) || PLATFORM(WIN)) 133 virtual bool readWebArchive(SharedBuffer *) = 0;133 virtual bool readWebArchive(SharedBuffer&) = 0; 134 134 virtual bool readFilenames(const Vector<String>&) = 0; 135 135 virtual bool readHTML(const String&) = 0; -
trunk/Source/WebCore/platform/ios/PasteboardIOS.mm
r222956 r223140 166 166 { 167 167 if ([type isEqualToString:WebArchivePboardType]) { 168 RefPtr<SharedBuffer>buffer = strategy.readBufferFromPasteboard(itemIndex, WebArchivePboardType, pasteboardName);169 return reader.readWebArchive(buffer.get());168 auto buffer = strategy.readBufferFromPasteboard(itemIndex, WebArchivePboardType, pasteboardName); 169 return buffer && reader.readWebArchive(*buffer); 170 170 } 171 171 -
trunk/Source/WebCore/platform/mac/PasteboardMac.mm
r222702 r223140 334 334 335 335 if (types.contains(WebArchivePboardType)) { 336 if ( RefPtr<SharedBuffer>buffer = strategy.bufferForType(WebArchivePboardType, m_pasteboardName)) {337 if (reader.readWebArchive( buffer.get()))336 if (auto buffer = strategy.bufferForType(WebArchivePboardType, m_pasteboardName)) { 337 if (reader.readWebArchive(*buffer)) 338 338 return; 339 339 }
Note: See TracChangeset
for help on using the changeset viewer.