Bug 137988

Summary: [iOS WK2] Protect WKWebView dynamic viewport change against empty sizes
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: New BugsAssignee: Benjamin Poulain <benjamin>
Status: RESOLVED FIXED    
Severity: Normal CC: simon.fraser, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch simon.fraser: review+

Description Benjamin Poulain 2014-10-22 16:41:44 PDT
[iOS WK2] Protect WKWebView dynamic viewport change against empty sizes
Comment 1 Benjamin Poulain 2014-10-22 16:51:58 PDT
Created attachment 240305 [details]
Patch
Comment 2 Simon Fraser (smfr) 2014-10-22 17:18:38 PDT
Comment on attachment 240305 [details]
Patch

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

> Source/WebKit2/ChangeLog:21
> +        For the target values, things are trickier. We do not know what the values are gonna be before we execute

going to be

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:2227
> +    if (CGRectIsEmpty(newBounds) || newMinimumLayoutSize.isEmpty() || newMinimumLayoutSizeForMinimalUI.isEmpty() || CGRectIsEmpty(futureUnobscuredRectInSelfCoordinates)) {
> +        _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;

Maybe you should assert here. It seems odd to pass empty rects to things like setViewportConfigurationMinimumLayoutSize
Comment 3 Benjamin Poulain 2014-10-22 19:26:54 PDT
(In reply to comment #2)
> > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:2227
> > +    if (CGRectIsEmpty(newBounds) || newMinimumLayoutSize.isEmpty() || newMinimumLayoutSizeForMinimalUI.isEmpty() || CGRectIsEmpty(futureUnobscuredRectInSelfCoordinates)) {
> > +        _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;
> 
> Maybe you should assert here. It seems odd to pass empty rects to things
> like setViewportConfigurationMinimumLayoutSize

That's a good point, there is not valid use case for empty layout size here.
Comment 4 Benjamin Poulain 2014-10-22 19:40:02 PDT
Committed r175081: <http://trac.webkit.org/changeset/175081>
Comment 5 David Kilzer (:ddkilzer) 2014-10-24 12:19:12 PDT
*** Bug 136522 has been marked as a duplicate of this bug. ***