Bug 137376 - Defer resolution of viewport size
Summary: Defer resolution of viewport size
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Martin Hock
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-02 18:33 PDT by Martin Hock
Modified: 2014-10-07 13:52 PDT (History)
4 users (show)

See Also:


Attachments
patch (21.18 KB, patch)
2014-10-03 14:33 PDT, Martin Hock
no flags Details | Formatted Diff | Diff
simplify patch, add description to ChangeLog (5.05 KB, patch)
2014-10-05 15:26 PDT, Martin Hock
benjamin: review-
Details | Formatted Diff | Diff
resolve on configuration update (6.27 KB, patch)
2014-10-06 20:18 PDT, Martin Hock
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>