Bug 134795

Summary: [iOS] Pasting rich content does not perform a two-step paste
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, enrica, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch benjamin: review+, benjamin: commit-queue-

Description Myles C. Maxfield 2014-07-09 21:15:00 PDT
[iOS] Pasting rich content does not perform a two-step paste
Comment 1 Myles C. Maxfield 2014-07-09 21:17:08 PDT
Created attachment 234687 [details]
Patch
Comment 2 Myles C. Maxfield 2014-07-09 21:18:28 PDT
<rdar://problem/17207410>
Comment 3 Benjamin Poulain 2014-07-09 21:25:10 PDT
Comment on attachment 234687 [details]
Patch

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

> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:160
> +        static NSString* webIOSPastePboardType = @"iOS rich content paste pasteboard type";

No need for static here :-D

> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:8
> +        var explanation = "The following test does a copy and a paste of contenteditable content. It then makes sure that the paste involved a two-step paste. The mechanism it uses to verify this is to determine if some styles change appropriately. If this test passes you should see the word Pass here ===>";

Let's use the test functions. Then the explanation can be added with description(explanation)

> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:35
> +<body id="b" onload="runTest()" dir="auto" contenteditable="true" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
> +<div id="e">

Let's use better id.

> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:48
> +<h2 class="story-heading" style="margin: 0px 0px 2px; font-style: italic; -webkit-text-size-adjust: 100%; word-spacing: -0.1em; line-height: 1.75rem; letter-spacing: 0.01em; font-size: 1.625rem; font-family: nyt-cheltenham, georgia, 'times new roman', times, serif; color: rgb(51, 51, 51);">
> +<a href="http://www.nytimes.com/2014/07/10/world/asia/chinese-hackers-pursue-key-data-on-us-workers.html" style="text-decoration: none; color: rgb(0, 0, 0);">Hackers in China Pursue Key Data on U.S. Workers
> +</a>
> +</h2>
> +<p class="byline" style="margin: 4px 0px 1px; -webkit-text-size-adjust: 100%; line-height: 0.75rem; font-size: 0.625rem; font-family: georgia, 'times new roman', times, serif; color: rgb(153, 153, 153);">By MICHAEL S. SCHMIDT, DAVID E. SANGER and NICOLE PERLROTH&nbsp;
> +<time id="t" class="timestamp" datetime="2014-07-09" data-eastern-timestamp="9:24 PM" data-utc-timestamp="1404955467" style="margin-left: 0.1em; white-space: nowrap; line-height: 0.6875rem; font-size: 0.625rem; font-family: nyt-franklin, arial, helvetica, sans-serif; color: rgb(168, 24, 23);">9:24 PM ET
> +</time>
> +</p>
> +<p class="summary" style="margin: 0px; -webkit-text-size-adjust: 100%; line-height: 1.125rem; font-size: 0.8125rem; font-family: georgia, 'times new roman', times, serif; color: rgb(51, 51, 51);">The hackers penetrated the system that houses the personal information of all federal employees and appeared to be&nbsp;
> +</p>
> +<br>Sent from my iPad

Let's nuke the original content and create some simpler content.
Comment 4 Myles C. Maxfield 2014-07-09 21:25:41 PDT
Comment on attachment 234687 [details]
Patch

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

> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:13
> +        b.textContent = "OMFG";

WOAH WHOOPS this should not be here
Comment 5 Benjamin Poulain 2014-07-09 21:29:13 PDT
Comment on attachment 234687 [details]
Patch

Looks good, minor comments ->r+ cq-
Comment 6 Benjamin Poulain 2014-07-09 21:29:57 PDT
Comment on attachment 234687 [details]
Patch

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

> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:28
> +        if (t.style.color == "rgb(168, 24, 23)")
> +            b.textContent = explanation + " Fail";
> +        else
> +            b.textContent = explanation + " Pass";

This should be shouldBe()
Comment 7 Myles C. Maxfield 2014-07-10 15:09:40 PDT
Comment on attachment 234687 [details]
Patch

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

>> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:160
>> +        static NSString* webIOSPastePboardType = @"iOS rich content paste pasteboard type";
> 
> No need for static here :-D

Done.

>> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:8
>> +        var explanation = "The following test does a copy and a paste of contenteditable content. It then makes sure that the paste involved a two-step paste. The mechanism it uses to verify this is to determine if some styles change appropriately. If this test passes you should see the word Pass here ===>";
> 
> Let's use the test functions. Then the explanation can be added with description(explanation)

Done.

>> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:13
>> +        b.textContent = "OMFG";
> 
> WOAH WHOOPS this should not be here

Done.

>> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:28
>> +            b.textContent = explanation + " Pass";
> 
> This should be shouldBe()

Done.

>> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:35
>> +<div id="e">
> 
> Let's use better id.

Done.

>> LayoutTests/platform/ios-sim/editing/pasteboard/two-step-paste.html:48
>> +<br>Sent from my iPad
> 
> Let's nuke the original content and create some simpler content.

Done.
Comment 8 Myles C. Maxfield 2014-07-10 17:12:48 PDT
http://trac.webkit.org/changeset/170986