Bug 177700 - Share more pasteboard code between iOS and macOS and remove dependency on Settings
Summary: Share more pasteboard code between iOS and macOS and remove dependency on Set...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-29 20:21 PDT by Ryosuke Niwa
Modified: 2017-09-30 03:34 PDT (History)
9 users (show)

See Also:


Attachments
Cleanup (26.87 KB, patch)
2017-09-29 21:35 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Cleanup (28.36 KB, patch)
2017-09-29 21:48 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (29.19 KB, patch)
2017-09-30 01:49 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (30.49 KB, patch)
2017-09-30 01:58 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (30.68 KB, patch)
2017-09-30 02:02 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed Mac builds (30.52 KB, patch)
2017-09-30 02:32 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2017-09-29 20:21:19 PDT
Now that we've added PasteboardCocoa.mm in https://trac.webkit.org/r222656,
we can share more code between iOS and macOS.

Also, we remove the layering violation inadvertently introduced in https://trac.webkit.org/r222595
whereby which Pasteboard code depends on Settings.
Comment 1 Ryosuke Niwa 2017-09-29 21:35:54 PDT
Created attachment 322277 [details]
Cleanup
Comment 2 Ryosuke Niwa 2017-09-29 21:48:00 PDT
Created attachment 322279 [details]
Cleanup
Comment 3 Wenson Hsieh 2017-09-29 22:29:11 PDT
Comment on attachment 322279 [details]
Cleanup

View in context: https://bugs.webkit.org/attachment.cgi?id=322279&action=review

> Source/WebCore/dom/DataTransfer.cpp:146
> +    if (Settings::customPasteboardDataEnabled() && !Pasteboard::isSafeTypeForDOMToReadAndWrite(type))

Shouldn't this be !Pasteboard::isSafeTypeForDOMToReadAndWrite(normalizedType) here? (instead of the non-normalized type)
Comment 4 Wenson Hsieh 2017-09-29 23:09:36 PDT
(In reply to Wenson Hsieh from comment #3)
> Comment on attachment 322279 [details]
> Cleanup
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=322279&action=review
> 
> > Source/WebCore/dom/DataTransfer.cpp:146
> > +    if (Settings::customPasteboardDataEnabled() && !Pasteboard::isSafeTypeForDOMToReadAndWrite(type))
> 
> Shouldn't this be
> !Pasteboard::isSafeTypeForDOMToReadAndWrite(normalizedType) here? (instead
> of the non-normalized type)

Let's augment editing/pasteboard/data-transfer-get-data-on-drop-custom.html so that instead of writing "text/plain", we try to write "Text" so that we have test coverage for this codepath where type normalization matters.
Comment 5 Ryosuke Niwa 2017-09-30 01:42:58 PDT
(In reply to Wenson Hsieh from comment #4)
> (In reply to Wenson Hsieh from comment #3)
> > Comment on attachment 322279 [details]
> > Cleanup
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=322279&action=review
> > 
> > > Source/WebCore/dom/DataTransfer.cpp:146
> > > +    if (Settings::customPasteboardDataEnabled() && !Pasteboard::isSafeTypeForDOMToReadAndWrite(type))
> > 
> > Shouldn't this be
> > !Pasteboard::isSafeTypeForDOMToReadAndWrite(normalizedType) here? (instead
> > of the non-normalized type)
> 
> Let's augment editing/pasteboard/data-transfer-get-data-on-drop-custom.html
> so that instead of writing "text/plain", we try to write "Text" so that we
> have test coverage for this codepath where type normalization matters.

That's not going to quite work because this is a bug in getData, not setData. We need to write a new test for this.
Comment 6 Ryosuke Niwa 2017-09-30 01:49:39 PDT
Created attachment 322288 [details]
Patch for landing
Comment 7 Ryosuke Niwa 2017-09-30 01:49:56 PDT
Comment on attachment 322288 [details]
Patch for landing

Wait for EWS.
Comment 8 Wenson Hsieh 2017-09-30 01:51:09 PDT
(In reply to Ryosuke Niwa from comment #5)
> (In reply to Wenson Hsieh from comment #4)
> > (In reply to Wenson Hsieh from comment #3)
> > > Comment on attachment 322279 [details]
> > > Cleanup
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=322279&action=review
> > > 
> > > > Source/WebCore/dom/DataTransfer.cpp:146
> > > > +    if (Settings::customPasteboardDataEnabled() && !Pasteboard::isSafeTypeForDOMToReadAndWrite(type))
> > > 
> > > Shouldn't this be
> > > !Pasteboard::isSafeTypeForDOMToReadAndWrite(normalizedType) here? (instead
> > > of the non-normalized type)
> > 
> > Let's augment editing/pasteboard/data-transfer-get-data-on-drop-custom.html
> > so that instead of writing "text/plain", we try to write "Text" so that we
> > have test coverage for this codepath where type normalization matters.
> 
> That's not going to quite work because this is a bug in getData, not
> setData. We need to write a new test for this.

Oh, true.

I suppose the new test could exercise both setData/getData with non-normalized versions of text/plain, text/html and text/uri-list and make sure that we can write and read these types from DOM (and also use internals.settings.setCustomPasteboardDataEnabled(true)). I can add this in a followup.
Comment 9 Ryosuke Niwa 2017-09-30 01:52:35 PDT
(In reply to Wenson Hsieh from comment #8)
>
> I suppose the new test could exercise both setData/getData with
> non-normalized versions of text/plain, text/html and text/uri-list and make
> sure that we can write and read these types from DOM (and also use
> internals.settings.setCustomPasteboardDataEnabled(true)). I can add this in
> a followup.

Sure, feel free to write a test if you'd like. If not, I can write one as well.
Comment 10 Ryosuke Niwa 2017-09-30 01:58:09 PDT
Created attachment 322289 [details]
Patch for landing
Comment 11 Ryosuke Niwa 2017-09-30 01:58:26 PDT
Comment on attachment 322289 [details]
Patch for landing

Wait for EWS (after WPE builds).
Comment 12 Ryosuke Niwa 2017-09-30 02:02:23 PDT
Created attachment 322290 [details]
Patch for landing
Comment 13 Ryosuke Niwa 2017-09-30 02:02:40 PDT
Comment on attachment 322290 [details]
Patch for landing

Wait for WPE EWS again...
Comment 14 Ryosuke Niwa 2017-09-30 02:32:23 PDT
Created attachment 322293 [details]
Fixed Mac builds
Comment 15 WebKit Commit Bot 2017-09-30 03:31:08 PDT
Comment on attachment 322293 [details]
Fixed Mac builds

Clearing flags on attachment: 322293

Committed r222680: <http://trac.webkit.org/changeset/222680>
Comment 16 WebKit Commit Bot 2017-09-30 03:31:10 PDT
All reviewed patches have been landed.  Closing bug.
Comment 17 Radar WebKit Bug Importer 2017-09-30 03:34:30 PDT
<rdar://problem/34754897>