Bug 137376

Summary: Defer resolution of viewport size
Product: WebKit Reporter: Martin Hock <mhock>
Component: WebCore Misc.Assignee: Martin Hock <mhock>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, esprehn+autocc, kangil.han
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
simplify patch, add description to ChangeLog
benjamin: review-
resolve on configuration update benjamin: review+

Description Martin Hock 2014-10-02 18:33:57 PDT
Defer resolution of viewport size.
Comment 1 Martin Hock 2014-10-03 14:33:24 PDT
Created attachment 239238 [details]
patch
Comment 2 Tim Horton 2014-10-03 15:45:17 PDT
Comment on attachment 239238 [details]
patch

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

> Source/WebCore/ChangeLog:7
> +

Definitely needs more justification here.
Comment 3 Martin Hock 2014-10-05 15:26:46 PDT
Created attachment 239301 [details]
simplify patch, add description to ChangeLog
Comment 4 Benjamin Poulain 2014-10-05 15:47:14 PDT
Comment on attachment 239301 [details]
simplify patch, add description to ChangeLog

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

I believe this is incomplete. There can be no use of m_configuration.width/height without resolving it to a real value.

> Source/WebCore/page/ViewportConfiguration.cpp:293
> +double ViewportConfiguration::configLength(double length) const

Avoid abbreviations in WebKit.

> Source/WebCore/page/ViewportConfiguration.cpp:298
> +    if (length == ViewportArguments::ValueDeviceWidth)
> +        return activeMinimumLayoutSizeInScrollViewCoordinates().width();
> +    if (length == ViewportArguments::ValueDeviceHeight)
> +        return activeMinimumLayoutSizeInScrollViewCoordinates().height();

This is fragile.

I would just have 2 getters that resolve the configuration to a real value, for width and height.
Comment 5 Martin Hock 2014-10-06 20:18:27 PDT
Created attachment 239379 [details]
resolve on configuration update
Comment 6 Martin Hock 2014-10-06 20:21:54 PDT
(In reply to comment #4)
> (From update of attachment 239301 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=239301&action=review
> 
> I believe this is incomplete. There can be no use of m_configuration.width/height without resolving it to a real value.

I've refactored it in my new patch to apply when the configuration is changed.

> > Source/WebCore/page/ViewportConfiguration.cpp:293
> > +double ViewportConfiguration::configLength(double length) const
> 
> Avoid abbreviations in WebKit.

Renamed.
 
> > Source/WebCore/page/ViewportConfiguration.cpp:298
> > +    if (length == ViewportArguments::ValueDeviceWidth)
> > +        return activeMinimumLayoutSizeInScrollViewCoordinates().width();
> > +    if (length == ViewportArguments::ValueDeviceHeight)
> > +        return activeMinimumLayoutSizeInScrollViewCoordinates().height();
> 
> This is fragile.
> 
> I would just have 2 getters that resolve the configuration to a real value, for width and height.

Based on our discussion and the fact that we can set width or height to be device-width or device-height, this logic seems correct.
Comment 7 Benjamin Poulain 2014-10-07 13:24:06 PDT
Comment on attachment 239379 [details]
resolve on configuration update

LGTM.
Comment 8 Martin Hock 2014-10-07 13:52:35 PDT
Committed r174405: <http://trac.webkit.org/changeset/174405>