New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 604928 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
(currently inactive on Chromium)
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 595826



Sign in to add a comment

visualViewport for document inside iframe reports parent's values

Project Member Reported by bokan@chromium.org, Apr 19 2016

Issue description

Chrome Version       : 51.0.2704.7
OS Version: All

What steps will reproduce the problem?
1. Find any page with an iframe (e.g. bokan.ca/iframe.html)
2. Open devtools
3. Call contentDocument.visualViewport.clientWidth on the iframe element

What is the expected result?
The client width should match the iframe dimensions

What happens instead of that?
The dimensions of the root window are returned instead.

Similarly for other properties like pageScale and scrollLeft.

UserAgentString: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.7 Safari/537.36



 

Comment 1 by bokan@chromium.org, Apr 19 2016

Labels: -OS-Linux OS-All

Comment 2 by bokan@chromium.org, Jun 4 2016

Note: I added a TODO in fast/dom/Window/resources/window-property-collector.js when landing https://codereview.chromium.org/2025393003/ that we should fix when fixing this issue. The problem is that we always return the FrameHost's VisualViewport which means that there's no way to create a default "null" `visualViewport` for when the frame is navigated away or destroyed. Part of the work here should be to split the "DOMVisualViewport" from Blink's "VisualViewport" class.

Comment 3 by ymalik@chromium.org, Jun 14 2016

I think this gets a little bit confusing since if the page is zoomed in (visual viewport != layout viewport) and the developer does something like iframe.contentWindow.visualViewport.pageScale, technically they should see '1', but what they want in the frame host's pageScale?

Are you suggesting the following values for iframe.contentWindow.visualViewport:
scrollTop: same as iframe.contentDocument.scrollingElement.scrollTop
scrollLeft: same as iframe.contentDocument.scrollingElement.scrollLeft
clientWidth: same as iframe.contentDocument.scrollingElement.clientWidth
clientHeight: same as iframe.contentDocument.scrollingElement.clientHeight
pageScale: 1

Also, setting pageScale does nothing here?







Comment 4 by ymalik@chromium.org, Jun 14 2016

Status: Started (was: Assigned)

Comment 5 by ymalik@chromium.org, Jun 14 2016

Actually, scrollTop and scrollLeft above should be 0 because pageScale is 1?

Comment 6 by bokan@chromium.org, Jun 14 2016

Right, scroll scrollTop and scrollLeft values should remain zero. The clientWidth/clientHeight should match iframe.contentDocument.scrollingElement.clientWidth/clientHeight.

Basically, we should treat each iframe as a separate viewport. If the user zooms into the page, they're scaling only the top-level viewport, so the child viewports shouldn't change at all.

Comment 7 by bokan@chromium.org, Jun 14 2016

Cc: -ymalik@chromium.org bokan@chromium.org
Owner: ymalik@chromium.org
Project Member

Comment 8 by bugdroid1@chromium.org, Jun 23 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/81dd83a5bae93da969e909c58ed3ecb50d50100c

commit 81dd83a5bae93da969e909c58ed3ecb50d50100c
Author: ymalik <ymalik@chromium.org>
Date: Thu Jun 23 15:59:05 2016

Seperate DOMVisualViewport from Blink's VisualViewport class

DOMVisualViewport represents the things exposed via the VisualViewportAPI. This
is what's returned from window.visualViewport. It queries the Blink's
VisualViewport for the main frame and returns sane values for iframes.

BUG= 604928 

Review-Url: https://codereview.chromium.org/2070563002
Cr-Commit-Position: refs/heads/master@{#401616}

[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/Window/resources/window-property-collector.js
[add] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/LayoutTests/fast/dom/viewport/viewport-dimensions-iframe.html
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/core.gypi
[add] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp
[add] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/DOMVisualViewport.h
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/DOMWindow.h
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/LocalDOMWindow.h
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/VisualViewport.h
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/VisualViewport.idl
[modify] https://crrev.com/81dd83a5bae93da969e909c58ed3ecb50d50100c/third_party/WebKit/Source/core/frame/Window.idl

Comment 9 by bokan@chromium.org, Jun 23 2016

Status: Fixed (was: Started)
Blocking: 410894
Blocking: -410894 595826

Sign in to add a comment