Implement VisualViewport API attributes
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Nov 2017 22:20:26 +0000 (22:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Nov 2017 22:20:26 +0000 (22:20 +0000)
commit66023855c33db2876beab3f08ce7e862300f2fb2
treeac0bf0625bbce88725a056b13abcd3206b8b5b4f
parentb222d911c7d3a7a283dfd8df828d373b74baecfa
Implement VisualViewport API attributes
https://bugs.webkit.org/show_bug.cgi?id=179385

Patch by Ali Juma <ajuma@chromium.org> on 2017-11-22
Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

Update expectations for viewport WPTs. The new expectations are all passing,
except as mentioned below.

* web-platform-tests/viewport/viewport-no-resize-event-on-overflow-recalc-expected.txt:
* web-platform-tests/viewport/viewport-read-size-causes-layout-expected.txt:
* web-platform-tests/viewport/viewport-read-size-in-iframe-causes-layout-expected.txt:
* web-platform-tests/viewport/viewport-resize-event-on-load-overflowing-page-expected.txt:
  Fails since events are not implemented yet (wkbug.com/b/179386).
* web-platform-tests/viewport/viewport-scrollbars-cause-resize-expected.txt:
* web-platform-tests/viewport/viewport-type-expected.txt:
* web-platform-tests/viewport/viewport-unscaled-scale-expected.txt:
* web-platform-tests/viewport/viewport-unscaled-scale-iframe-expected.txt:
* web-platform-tests/viewport/viewport-unscaled-scroll-expected.txt:
* web-platform-tests/viewport/viewport-unscaled-scroll-iframe-expected.txt:
  Passing expectation for non-iOS, but fails on iOS because iframes aren't scrollable (wkbug.com/b/179794).
* web-platform-tests/viewport/viewport-unscaled-size-expected.txt:
* web-platform-tests/viewport/viewport-unscaled-size-iframe-expected.txt:
  Passing expectation for non-iOS, but fails on iOS because iframes aren't scrollable (wkbug.com/b/179794).

Source/WebCore:

Add a visualViewport attribute to Window, and implement the VisualViewport
interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).

This is behind a newly-added VisualViewportAPI experimental feature flag.

Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
       fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
       fast/visual-viewport/viewport-dimensions-iframe.html
       fast/visual-viewport/viewport-dimensions-under-page-zoom.html
       fast/visual-viewport/viewport-dimensions.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/EventTargetFactory.in:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::~DOMWindow):
(WebCore::DOMWindow::resetDOMWindowProperties):
(WebCore::DOMWindow::visualViewport const):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* page/Settings.yaml:
* page/VisualViewport.cpp: Added.
(WebCore::VisualViewport::VisualViewport):
(WebCore::VisualViewport::eventTargetInterface const):
(WebCore::VisualViewport::scriptExecutionContext const):
(WebCore::getFrameViewAndLayoutIfNonNull):
(WebCore::VisualViewport::offsetLeft const):
(WebCore::VisualViewport::offsetTop const):
(WebCore::VisualViewport::pageLeft const):
(WebCore::VisualViewport::pageTop const):
(WebCore::VisualViewport::width const):
(WebCore::VisualViewport::height const):
(WebCore::VisualViewport::scale const):
* page/VisualViewport.h: Added.
* page/VisualViewport.idl: Added.

Source/WebKit:

Add a VisualViewportAPI experimental feature.

* Shared/WebPreferences.yaml:

Source/WebKitLegacy/mac:

Add a VisualViewportAPI preference.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences visualViewportAPIEnabled]):
(-[WebPreferences setVisualViewportAPIEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKitLegacy/win:

Add a VisualViewportAPI preference.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::visualViewportAPIEnabled):
(WebPreferences::setVisualViewportAPIEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Tools:

Enable the VisualViewportAPI in layout tests.

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* DumpRenderTree/win/DumpRenderTree.cpp:
(enableExperimentalFeatures):

LayoutTests:

Add tests for the Visual Viewport API, based on Blink's layout tests but modified
to use UIScriptController.

* fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars-expected.txt: Added.
* fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html: Added.
* fast/visual-viewport/viewport-dimensions-exclude-scrollbars-expected.txt: Added.
* fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html: Added.
* fast/visual-viewport/viewport-dimensions-expected.txt: Added.
* fast/visual-viewport/viewport-dimensions-iframe-expected.txt: Added.
* fast/visual-viewport/viewport-dimensions-iframe.html: Added.
* fast/visual-viewport/viewport-dimensions-under-page-zoom-expected.txt: Added.
* fast/visual-viewport/viewport-dimensions-under-page-zoom.html: Added.
* fast/visual-viewport/viewport-dimensions.html: Added.
* platform/gtk/TestExpectations:
  Skipped tests that use UIScriptController::zoomToScale, since this isn't implemented on GTK (webkit.org/b/168050).
* platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt: Added.
  Fails because iframes aren't scrollable on iOS (webkit.org/b/179794).
* platform/ios/imported/w3c/web-platform-tests/viewport/viewport-unscaled-scroll-iframe-expected.txt: Added.
  Fails because iframes aren't scrollable on iOS (webkit.org/b/179794).
* platform/ios/imported/w3c/web-platform-tests/viewport/viewport-unscaled-size-expected.txt: Added.
  Platform-specific expectation because of the window size being different on iOS.
* platform/ios/imported/w3c/web-platform-tests/viewport/viewport-unscaled-size-iframe-expected.txt: Added.
  Fails because iframes aren't scrollable on iOS (webkit.org/b/179794).
* platform/mac-wk1/TestExpectations:
  Skipped a test that applies webkit-scrollbar to main frame scrollbars, since this is unsupported in WK1.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
61 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars-expected.txt [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-exclude-scrollbars-expected.txt [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-expected.txt [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-iframe-expected.txt [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-iframe.html [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-under-page-zoom-expected.txt [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions-under-page-zoom.html [new file with mode: 0644]
LayoutTests/fast/visual-viewport/viewport-dimensions.html [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-no-resize-event-on-overflow-recalc-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-read-size-causes-layout-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-read-size-in-iframe-causes-layout-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-resize-event-on-load-overflowing-page-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-scrollbars-cause-resize-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-type-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-unscaled-scale-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-unscaled-scale-iframe-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-unscaled-scroll-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-unscaled-scroll-iframe-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-unscaled-size-expected.txt
LayoutTests/imported/w3c/web-platform-tests/viewport/viewport-unscaled-size-iframe-expected.txt
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/imported/w3c/web-platform-tests/viewport/viewport-unscaled-scroll-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/imported/w3c/web-platform-tests/viewport/viewport-unscaled-size-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/imported/w3c/web-platform-tests/viewport/viewport-unscaled-size-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/dom/EventTargetFactory.in
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindow.idl
Source/WebCore/page/Settings.yaml
Source/WebCore/page/VisualViewport.cpp [new file with mode: 0644]
Source/WebCore/page/VisualViewport.h [new file with mode: 0644]
Source/WebCore/page/VisualViewport.idl [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/win/WebPreferences.cpp
Source/WebKitLegacy/win/WebPreferences.h
Source/WebKitLegacy/win/WebView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp