Bug 103737 - CSS Device Adaptation: window.innerWidth returns wrong value if CSS viewport descriptors are applied
Summary: CSS Device Adaptation: window.innerWidth returns wrong value if CSS viewport ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mikhail Pozdnyakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-30 05:52 PST by Mikhail Pozdnyakov
Modified: 2012-12-03 01:23 PST (History)
7 users (show)

See Also:


Attachments
test (998 bytes, text/html)
2012-11-30 05:52 PST, Mikhail Pozdnyakov
no flags Details
Test showing it works after scrolling (1.26 KB, text/html)
2012-11-30 06:27 PST, Kenneth Rohde Christiansen
no flags Details
patch (11.39 KB, patch)
2012-12-02 04:25 PST, Mikhail Pozdnyakov
kenneth: review-
kenneth: commit-queue-
Details | Formatted Diff | Diff
patch v2 (12.26 KB, patch)
2012-12-03 00:13 PST, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Pozdnyakov 2012-11-30 05:52:32 PST
Created attachment 176950 [details]
test

window.innerWidth should return valid value, when CSS viewport descriptors applied. Test is attached.
Comment 1 Kenneth Rohde Christiansen 2012-11-30 06:27:03 PST
Created attachment 176958 [details]
Test showing it works after scrolling
Comment 2 Mikhail Pozdnyakov 2012-12-02 04:25:58 PST
Created attachment 177137 [details]
patch

Might need splitting as it actually solves two problems:
1) initial viewport size detection in webcore
2) appropriate frame view initialization in WK2 WebPage

However those fixes are very close so put them the same patch so far.
Comment 3 Kenneth Rohde Christiansen 2012-12-02 06:00:32 PST
Comment on attachment 177137 [details]
patch

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

> Source/WebCore/ChangeLog:10
> +        descriptrors. Viewport descriptrors from new stylesheet were applied to the visibleContentRect

spelling

> Source/WebCore/page/FrameView.h:583
> +#if ENABLE(CSS_DEVICE_ADAPTATION)
> +    // Size of viewport before CSS viewport descriptors are applied.
> +    IntSize m_initialViewportSize;
> +#endif

Isn't it better to use the description from the spec? also link to the spec in the changelog

> Source/WebKit2/ChangeLog:10
> +        descriptrors. Viewport descriptrors from new stylesheet were applied to the visibleContentRect

spelling

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1038
>      contentFixedSize.scale(1 / m_page->deviceScaleFactor());
> +#if ENABLE(CSS_DEVICE_ADAPTATION)

I would add a newline before this
Comment 4 Kenneth Rohde Christiansen 2012-12-02 06:01:50 PST
Comment on attachment 177137 [details]
patch

I would like some tests that uses a non-1.0 deviceScaleFactor. I think it is possible to change that in tests.
Comment 5 Kenneth Rohde Christiansen 2012-12-02 06:02:28 PST
Another question, doesn't this affect viewport meta as well? That would affect the ifdef's
Comment 6 Mikhail Pozdnyakov 2012-12-02 11:23:24 PST
(In reply to comment #5)
> Another question, doesn't this affect viewport meta as well? That would affect the ifdef's
I don't think it is possible to set/unset viewport meta properties for the same doc, so not I guess
Comment 7 Mikhail Pozdnyakov 2012-12-03 00:13:02 PST
Created attachment 177197 [details]
patch v2

Took Kenneth feedback into consideration.
Comment 8 WebKit Review Bot 2012-12-03 01:23:13 PST
Comment on attachment 177197 [details]
patch v2

Clearing flags on attachment: 177197

Committed r136373: <http://trac.webkit.org/changeset/136373>
Comment 9 WebKit Review Bot 2012-12-03 01:23:17 PST
All reviewed patches have been landed.  Closing bug.