[Modern Media Controls] Implement the pageScaleFactor property
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Dec 2016 18:28:21 +0000 (18:28 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Dec 2016 18:28:21 +0000 (18:28 +0000)
commit535e5cf343c7c0ed4c1846f29d0c7bc4a5a6158f
tree127cb865ba37b3bac4e96286da9db7485f56ae80
parentd73f1ef3639ebb32491c258e613eb3f0968688f1
[Modern Media Controls] Implement the pageScaleFactor property
https://bugs.webkit.org/show_bug.cgi?id=165660

Reviewed by Dean Jackson.

Source/WebCore:

We implement the pageScaleFactor property on MediaController. This property is set
by the HTMLMediaElement when the page scale factor changes, and we only choose to handle
it on iOS by setting controlsDependOnPageScaleFactor to true on the MediaControlsHost.

To do so, we now size the media controls by multiplying the layout size of the media by
the page scale factor, and apply an inverse CSS zoom on the media controls themselves.

Test: media/modern-media-controls/media-controller/media-controller-scale-factor.html

* Modules/modern-media-controls/controls/media-controls.css:
(.media-controls-container,):
* Modules/modern-media-controls/controls/media-controls.js:
(MediaControls.prototype.get scaleFactor):
(MediaControls.prototype.set scaleFactor):
(MediaControls.prototype.commitProperty):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.set pageScaleFactor):
(MediaController.prototype._updateControlsSize):
* html/HTMLMediaElement.cpp:
(WebCore::controllerJSValue):
(WebCore::HTMLMediaElement::setControllerJSProperty):

We no longer hit a JSC assertion when trying to set the pageScaleFactor property before
the JS controller was actually created.

LayoutTests:

Add a new test to check that we correctly zoom and size the media controls when the page
scale factor is a value other than 1.

* media/modern-media-controls/media-controller/media-controller-scale-factor-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-scale-factor.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/media-controller/media-controller-scale-factor-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-scale-factor.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/controls/media-controls.css
Source/WebCore/Modules/modern-media-controls/controls/media-controls.js
Source/WebCore/Modules/modern-media-controls/media/media-controller.js
Source/WebCore/html/HTMLMediaElement.cpp