Summary: | Use blob URL when pasting RTFD instead of overriding DocumentLoader | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> | ||||||||||
Component: | HTML Editing | Assignee: | Ryosuke Niwa <rniwa> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | commit-queue, wenson_hsieh | ||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||
Version: | WebKit Nightly Build | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Bug Depends on: | |||||||||||||
Bug Blocks: | 124391 | ||||||||||||
Attachments: |
|
Description
Ryosuke Niwa
2017-10-03 01:01:40 PDT
Created attachment 322500 [details]
Fixes the bug
Created attachment 322554 [details]
Fixed builds
Created attachment 322555 [details]
Fixed GTK+ builds
Comment on attachment 322555 [details] Fixed GTK+ builds View in context: https://bugs.webkit.org/attachment.cgi?id=322555&action=review The general approach looks reasonable to me, but I'm not familiar with loading code at all. Perhaps Chris would have some additional input here? > Source/WebCore/ChangeLog:10 > + into the document using WebKit fake URL, and DocumentLoader was overridden to return the appropraite appropraite => appropriate > Source/WebCore/editing/markup.cpp:128 > + if (element.attributeContainsURL(attribute) && !attribute.value().isEmpty()) { How would this handle data: URLs, or app: URLs? > Source/WebCore/editing/markup.cpp:131 > + changes.append(AttributeChange(&element, attribute.name(), replacement)); Nit - { } initialization here? > Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:46 > + [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSRTFDPboardType] owner:nil]; Nit - this would probably be more succinct using @[] instead of +[NSArray arrayWithObject] > Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:61 > + [[UIPasteboard generalPasteboard] setItems:@[[NSDictionary dictionaryWithObject:data forKey:(NSString *)kUTTypeFlatRTFD]]]; Nit - this would probably be more succinct using @{} instead of +[NSDictionary dictionaryWithObject] > Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:72 > + [webView paste:nil]; Did you mean to check that the editable root is empty after this? Comment on attachment 322555 [details] Fixed GTK+ builds View in context: https://bugs.webkit.org/attachment.cgi?id=322555&action=review >> Source/WebCore/editing/markup.cpp:128 >> + if (element.attributeContainsURL(attribute) && !attribute.value().isEmpty()) { > > How would this handle data: URLs, or app: URLs? They won't be in replacement map since those URLs shouldn't be appearing as sub resources in attributed attributes we just parsed. >> Source/WebCore/editing/markup.cpp:131 >> + changes.append(AttributeChange(&element, attribute.name(), replacement)); > > Nit - { } initialization here? Sure. >> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:46 >> + [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSRTFDPboardType] owner:nil]; > > Nit - this would probably be more succinct using @[] instead of +[NSArray arrayWithObject] Fixed. >> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:61 >> + [[UIPasteboard generalPasteboard] setItems:@[[NSDictionary dictionaryWithObject:data forKey:(NSString *)kUTTypeFlatRTFD]]]; > > Nit - this would probably be more succinct using @{} instead of +[NSDictionary dictionaryWithObject] Fixed. >> Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:72 >> + [webView paste:nil]; > > Did you mean to check that the editable root is empty after this? No. This test is simply here to make sure WebKit doesn't hit a debug assertion / crash when sharedBuffer is empty in getPasteboardBufferForType. Created attachment 322638 [details]
Patch for landing
Comment on attachment 322638 [details]
Patch for landing
Wait for EWS.
Comment on attachment 322638 [details] Patch for landing Clearing flags on attachment: 322638 Committed r222839: <http://trac.webkit.org/changeset/222839> All reviewed patches have been landed. Closing bug. |