Source/WebCore: Plug-ins have to use JavaScript to find out the current device scale...
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 23:00:37 +0000 (23:00 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 23:00:37 +0000 (23:00 +0000)
commit59c0f9208d2d821b4430b821c3e815927861eb15
tree9e53933b8acfaac15055fd989c5f0a7dda366169
parent2e9eb9756b31ff410eeea64c940d978acee37bd5
Source/WebCore: Plug-ins have to use JavaScript to find out the current device scale factor
https://bugs.webkit.org/show_bug.cgi?id=67225

Reviewed by Darin Adler.

Test: platform/mac-wk2/plugins/contents-scale-factor.html

Add NPNVcontentsScaleFactor, as per https://wiki.mozilla.org/NPAPI:ContentsScaleFactor.

* plugins/npapi.h:

Source/WebKit2: Plug-ins have to use JavaScript to find out the current device scale factor
https://bugs.webkit.org/show_bug.cgi?id=67225
<rdar://problem/10048258>

Reviewed by Darin Adler.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::PluginControllerProxy):
Initialize m_contentsScaleFactor.

* PluginProcess/PluginControllerProxy.h:
Add contentsScaleFactor member function and m_contentsScaleFactor member variable.

* PluginProcess/PluginCreationParameters.cpp:
(WebKit::PluginCreationParameters::PluginCreationParameters):
(WebKit::PluginCreationParameters::encode):
(WebKit::PluginCreationParameters::decode):
* PluginProcess/PluginCreationParameters.h:
Add contentsScaleFactor to the creation parameters.

* PluginProcess/mac/PluginControllerProxyMac.mm:
(WebKit::PluginControllerProxy::contentsScaleFactor):
Return the cached m_contentsScaleFactor.

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_GetValue):
Handle getting the scale factor by calling NetscapePlugin::contentsScaleFactor.

* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::contentsScaleFactor):
Ask the plug-in controller for the contents scale factor.

* WebProcess/Plugins/PluginController.h:
Add contentsScaleFactor pure virtual member function.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::initialize):
Set contentsScaleFactor in the creation parameters.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::contentsScaleFactor):
Get the device scale factor from the page.

* WebProcess/Plugins/PluginView.h:
Add contentsScaleFactor().

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setDeviceScaleFactor):
Bail if the scale factor didn't change.

Tools: Plug-ins have to use JavaScript to find out the current device scale factor
https://bugs.webkit.org/show_bug.cgi?id=67225
<rdar://problem/10048258>

Reviewed by Darin Adler.

Add a plug-in test for getting the contents scale factor.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TestNetscapePlugIn/Tests/mac/ContentsScaleFactor.cpp: Added.
(ContentsScaleFactor::ContentsScaleFactor):
(ContentsScaleFactor::contentsScaleFactor):
(ContentsScaleFactor::ScriptableObject::hasProperty):
(ContentsScaleFactor::ScriptableObject::getProperty):
(ContentsScaleFactor::ScriptableObject::pluginTest):
(ContentsScaleFactor::NPP_GetValue):

LayoutTests: Plug-ins have to use JavaScript to find out the current device scale factor
https://bugs.webkit.org/show_bug.cgi?id=67225
<rdar://problem/10048258>

Reviewed by Darin Adler.

Add tests.

* platform/mac-wk2/plugins/contents-scale-factor-expected.txt: Added.
* platform/mac-wk2/plugins/contents-scale-factor.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/plugins/contents-scale-factor-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/plugins/contents-scale-factor.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/plugins/npapi.h
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/PluginControllerProxy.cpp
Source/WebKit2/PluginProcess/PluginControllerProxy.h
Source/WebKit2/PluginProcess/PluginCreationParameters.cpp
Source/WebKit2/PluginProcess/PluginCreationParameters.h
Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
Source/WebKit2/WebProcess/Plugins/PluginController.h
Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac/ContentsScaleFactor.cpp [new file with mode: 0644]