visualViewport for document inside iframe reports parent's values |
|||||
Issue descriptionChrome 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
,
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.
,
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?
,
Jun 14 2016
,
Jun 14 2016
Actually, scrollTop and scrollLeft above should be 0 because pageScale is 1?
,
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.
,
Jun 14 2016
,
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
,
Jun 23 2016
,
Jun 23 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by bokan@chromium.org
, Apr 19 2016