Bug 157630 - REGRESSION (r192098): Content missing after copy and paste to Notes App on retina displays
Summary: REGRESSION (r192098): Content missing after copy and paste to Notes App on re...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-05-12 11:03 PDT by Brent Fulgham
Modified: 2016-05-16 10:34 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.53 KB, patch)
2016-05-12 11:09 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (nearly all of this is test case) (615.22 KB, patch)
2016-05-14 14:19 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (most is just test case). Updated for iOS (615.23 KB, patch)
2016-05-14 22:56 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (nearly all of this is just test case) (615.24 KB, patch)
2016-05-15 17:59 PDT, Brent Fulgham
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2016-05-12 11:03:27 PDT
Web content that uses the <img> 'sizes' attribute, and modifies the "src" attribute of the <img> element to reflect the "best" image for the current display resolution does not work properly after r192098 (which exposed the 'sizes' attribute).

Test case:

1. Copy text/images from Safari Technology Preview. (Example: Copy content from reader view of: http://www.bonappetit.com/test-kitchen/ingredients/article/breadcrumb-substitutions)
2. Create a new note in the Notes application.
3. Paste

Result:
Only the first and last image from the blog post makes it to the Note.
Comment 1 Brent Fulgham 2016-05-12 11:05:49 PDT
Darin and I debugged the cause of the problem. I need to create a reduced test case we can add to the LayoutTests, but I am posting the patch for discussion since I would like to hear from hyatt or perhaps others to make sure this is the right approach.
Comment 2 Brent Fulgham 2016-05-12 11:06:04 PDT
<rdar://problem/25277577>
Comment 3 Brent Fulgham 2016-05-12 11:09:27 PDT
Created attachment 278738 [details]
Patch
Comment 4 WebKit Commit Bot 2016-05-12 11:10:58 PDT
Attachment 278738 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:9:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Darin Adler 2016-05-12 19:48:29 PDT
Comment on attachment 278738 [details]
Patch

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

> Source/WebCore/html/HTMLImageElement.cpp:545
> +    addSubresourceURL(urls, document().completeURL(imageSourceURL()));

Why is calling document.completeURL(imageSourceURL()) better than calling currentSrc() for this?
Comment 6 Brent Fulgham 2016-05-13 10:04:15 PDT
(In reply to comment #5)
> Comment on attachment 278738 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=278738&action=review
> 
> > Source/WebCore/html/HTMLImageElement.cpp:545
> > +    addSubresourceURL(urls, document().completeURL(imageSourceURL()));
> 
> Why is calling document.completeURL(imageSourceURL()) better than calling
> currentSrc() for this?

addSubresourceURLs expects a URL, but currentSrc() returns a string.

We could convert the string value to a URL, but since currentSrc() is populated by the URL returned by "document().completeURL(imageSourceURL())" (converted to a string), it just seemed safer to avoid the URL->string->URL conversion.
Comment 7 Darin Adler 2016-05-13 18:55:57 PDT
Comment on attachment 278738 [details]
Patch

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

>>> Source/WebCore/html/HTMLImageElement.cpp:545
>>> +    addSubresourceURL(urls, document().completeURL(imageSourceURL()));
>> 
>> Why is calling document.completeURL(imageSourceURL()) better than calling currentSrc() for this?
> 
> addSubresourceURLs expects a URL, but currentSrc() returns a string.
> 
> We could convert the string value to a URL, but since currentSrc() is populated by the URL returned by "document().completeURL(imageSourceURL())" (converted to a string), it just seemed safer to avoid the URL->string->URL conversion.

The real problem here is that currentSrc() returns a string. Seems kinda crazy that it does.
Comment 8 Brent Fulgham 2016-05-14 14:19:57 PDT
Created attachment 278945 [details]
Patch (nearly all of this is test case)
Comment 9 Brent Fulgham 2016-05-14 22:56:15 PDT
Created attachment 278961 [details]
Patch (most is just test case). Updated for iOS
Comment 10 Darin Adler 2016-05-15 01:33:30 PDT
Comment on attachment 278961 [details]
Patch (most is just test case). Updated for iOS

Still not compiling on iOS EWS yet.
Comment 11 Brent Fulgham 2016-05-15 17:59:07 PDT
Created attachment 278986 [details]
Patch (nearly all of this is just test case)
Comment 12 Brent Fulgham 2016-05-15 17:59:39 PDT
(In reply to comment #10)
> Comment on attachment 278961 [details]
> Patch (most is just test case). Updated for iOS
> 
> Still not compiling on iOS EWS yet.

Ugh! Forgot to fix WK1 DumpRenderTree!
Comment 13 Simon Fraser (smfr) 2016-05-15 21:27:33 PDT
Comment on attachment 278986 [details]
Patch (nearly all of this is just test case)

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

> Tools/DumpRenderTree/mac/TestRunnerMac.mm:1249
> +    NSPredicate *iPredicate = [NSPredicate predicateWithFormat:WebSubframeArchivesKey];

iPredicate is a pretty gross name. Just 'predicate'?
Comment 14 Brent Fulgham 2016-05-16 10:34:34 PDT
Committed r200945: <http://trac.webkit.org/changeset/200945>