Bug 174585 - [iOS DnD] Web process uses too much memory when beginning a drag on a very large image
Summary: [iOS DnD] Web process uses too much memory when beginning a drag on a very la...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-17 09:44 PDT by Wenson Hsieh
Modified: 2017-07-22 17:08 PDT (History)
6 users (show)

See Also:


Attachments
Patch (18.20 KB, patch)
2017-07-17 10:11 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Rebase on master (18.37 KB, patch)
2017-07-17 10:16 PDT, Wenson Hsieh
thorton: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews123 for ios-simulator-wk2 (6.71 MB, application/zip)
2017-07-17 11:45 PDT, Build Bot
no flags Details
Patch for landing (20.43 KB, patch)
2017-07-17 14:27 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2017-07-17 09:44:18 PDT
<rdar://problem/33302541>
Comment 1 Wenson Hsieh 2017-07-17 10:11:01 PDT
Created attachment 315672 [details]
Patch
Comment 2 Wenson Hsieh 2017-07-17 10:16:24 PDT
Created attachment 315673 [details]
Rebase on master
Comment 3 Build Bot 2017-07-17 11:45:09 PDT
Comment on attachment 315673 [details]
Rebase on master

Attachment 315673 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4136613

New failing tests:
imported/w3c/IndexedDB-private-browsing/idbfactory_open12.html
http/tests/canvas/canvas-tainted-after-draw-image.html
Comment 4 Build Bot 2017-07-17 11:45:11 PDT
Created attachment 315686 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 5 Tim Horton 2017-07-17 13:54:39 PDT
Comment on attachment 315673 [details]
Rebase on master

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

> Source/WebCore/platform/ios/DragImageIOS.mm:103
> +        auto scaledWidth = std::round(std::sqrt(maximumAllowedDragImageArea * imageSize.width / imageSize.height));
> +        adjustedImageScale = scaledWidth / imageSize.width;
> +        imageSize = { scaledWidth, std::round(maximumAllowedDragImageArea / scaledWidth) };

Is there a GeometryUtilities you could use here?
Comment 6 Tim Horton 2017-07-17 13:55:23 PDT
Comment on attachment 315673 [details]
Rebase on master

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

> Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:226
> +- (void)synchronouslyLoadHTML:(NSString *)html

HTMLString, I think, like WebKit
Comment 7 Wenson Hsieh 2017-07-17 14:06:14 PDT
(In reply to Tim Horton from comment #5)
> Comment on attachment 315673 [details]
> Rebase on master
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=315673&action=review
> 
> > Source/WebCore/platform/ios/DragImageIOS.mm:103
> > +        auto scaledWidth = std::round(std::sqrt(maximumAllowedDragImageArea * imageSize.width / imageSize.height));
> > +        adjustedImageScale = scaledWidth / imageSize.width;
> > +        imageSize = { scaledWidth, std::round(maximumAllowedDragImageArea / scaledWidth) };
> 
> Is there a GeometryUtilities you could use here?

It doesn't look like there's anything that just computes an area with a given size and aspect ratio. I can add this to GeometryUtilities -- does FloatSize sizeWithAreaAndAspectRatio(float area, float size); sound okay?
Comment 8 Wenson Hsieh 2017-07-17 14:27:25 PDT
Created attachment 315714 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2017-07-17 15:26:41 PDT
The commit-queue encountered the following flaky tests while processing attachment 315714 [details]:

storage/indexeddb/modern/new-database-after-user-delete.html bug 174354 (author: beidson@apple.com)
The commit-queue is continuing to process your patch.
Comment 10 WebKit Commit Bot 2017-07-17 15:26:42 PDT
The commit-queue encountered the following flaky tests while processing attachment 315714 [details]:

The commit-queue is continuing to process your patch.
Comment 11 WebKit Commit Bot 2017-07-17 16:17:13 PDT
Comment on attachment 315714 [details]
Patch for landing

Clearing flags on attachment: 315714

Committed r219585: <http://trac.webkit.org/changeset/219585>