Changeset 159827 in webkit


Ignore:
Timestamp:
Nov 27, 2013 5:05:35 PM (10 years ago)
Author:
eric.carlson@apple.com
Message:

Allow the QuickTime plug-in to be replaced by script in an isolated word
https://bugs.webkit.org/show_bug.cgi?id=124900

Reviewed by Dean Jackson.

Source/WebCore:

Test: plugins/quicktime-plugin-replacement.html

  • CMakeLists.txt: Add new Modules path.
  • DerivedSources.make: Add new files.
  • GNUmakefile.am: Add new Modules path.
  • GNUmakefile.list.am: Add new header.
  • WebCore.vcxproj/WebCore.vcxproj: Add new header.
  • WebCore.vcxproj/WebCoreCommon.props: Add new Modules path.
  • WebCore.xcodeproj/project.pbxproj: Add new files.
  • Modules/plugins: Added.
  • Modules/plugins/PluginReplacement.h: Added. Defines the interface for a plug-in replacement.

Create a replacement for the QuickTime plug-in.

  • Modules/plugins/QuickTimePluginReplacement.cpp: Added.
  • Modules/plugins/QuickTimePluginReplacement.css: Added.
  • Modules/plugins/QuickTimePluginReplacement.h: Added.
  • Modules/plugins/QuickTimePluginReplacement.idl: Added.
  • Modules/plugins/QuickTimePluginReplacement.js: Added.

Allow plug-in replacement to be enabled at runtime.

  • bindings/generic/RuntimeEnabledFeatures.h:

(WebCore::RuntimeEnabledFeatures::setPluginReplacementEnabled):
(WebCore::RuntimeEnabledFeatures::pluginReplacementEnabled):

  • bindings/js/JSDOMBinding.h:

(WebCore::toJS): Add toJS(... const String& ...).

  • bindings/js/JSPluginElementFunctions.cpp:

(WebCore::pluginScriptObject): Give a plug-in replacement a first shot at defining the

script interface.

  • html/HTMLEmbedElement.cpp:

(WebCore::HTMLEmbedElement::updateWidget): Call base class requestObject.

  • html/HTMLMediaElement.cpp:

(HTMLMediaElement::fileSize): New, passthrough to media engine.

  • html/HTMLMediaElement.h:
  • html/HTMLObjectElement.cpp:

(WebCore::HTMLObjectElement::updateWidget): Call base class requestObject.

Moved some logic that was previously used only for creating a plug-in snapshot to the base
class so it can be shared by a plug-in replacement.

  • html/HTMLPlugInElement.cpp:

(WebCore::HTMLPlugInElement::HTMLPlugInElement): Initialize timer used to swap renderers.
(WebCore::HTMLPlugInElement::createRenderer): Allow plug-in replacement to create the renderer.
(WebCore::HTMLPlugInElement::swapRendererTimerFired): Create a shadow root.
(WebCore::HTMLPlugInElement::setDisplayState): Set the new state, prime the swap renderer

timer if necessary.

(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Tell the plug-in replacement to

install itself in the new shadow DOM.

(WebCore::registeredPluginReplacements): Return vector of all registered plug-in replacements.
(WebCore::registerPluginReplacement): Add a plug-in replacement.
(WebCore::pluginReplacementForType): Find a plug-in replacement for a MIME type.
(WebCore::HTMLPlugInElement::requestObject): If there is a plug-in replacement for the MIME type,

create it and set the display state.

(WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Return the script object for

the current plug-in replacement, if any.

  • html/HTMLPlugInElement.h:

Move some plug-in snapshot code into the base class.

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): No need to initialize timer.
(WebCore::HTMLPlugInImageElement::setDisplayState): Call base class.
(WebCore::HTMLPlugInImageElement::createRenderer): Ditto.
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Ditto.
(WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Remove unnecessary class name.
(WebCore::HTMLPlugInImageElement::requestObject): New.

  • html/HTMLPlugInImageElement.h:
  • html/HTMLVideoElement.h: Make createRenderer public so the QuickTime plug-in replacement can

call it.

  • platform/graphics/MediaPlayer.cpp:

(WebCore::MediaPlayer::fileSize): New.

  • platform/graphics/MediaPlayer.h:
  • platform/graphics/MediaPlayerPrivate.h:
  • platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:

(WebCore::MediaPlayerPrivateAVFoundation::extraMemoryCost): totalBytes returns an unsigned long long.

  • platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:

(WebCore::MediaPlayerPrivateAVFoundation::fileSize):

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

(WebCore::MediaPlayerPrivateAVFoundationCF::totalBytes): Return an unsigned long long.

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::totalBytes): Ditto.

  • testing/InternalSettings.cpp:

(WebCore::InternalSettings::Backup::Backup): Backup the plug-in replacement runtime setting.
(WebCore::InternalSettings::Backup::restoreTo): Restore it.
(WebCore::InternalSettings::setPluginReplacementEnabled): Set it.

  • testing/InternalSettings.h:
  • testing/InternalSettings.idl:

LayoutTests:

  • platform/efl/TestExpectations: Skip the new test.
  • platform/gtk/TestExpectations: Ditto.
  • platform/wincairo/TestExpectations: Ditto.
  • plugins/quicktime-plugin-replacement.html: Added.
  • plugins/quicktime-plugin-replacement-expected.txt: Added.
  • plugins/resources/orange.mov: Replace movie compressed with ancient (and deprecated)

animated gif codec with one compressed with H.264 codec.

Location:
trunk
Files:
9 added
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159823 r159827  
     12013-11-27  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Allow the QuickTime plug-in to be replaced by script in an isolated word
     4        https://bugs.webkit.org/show_bug.cgi?id=124900
     5
     6        Reviewed by Dean Jackson.
     7
     8        * platform/efl/TestExpectations: Skip the new test.
     9        * platform/gtk/TestExpectations: Ditto.
     10        * platform/wincairo/TestExpectations: Ditto.
     11        * plugins/quicktime-plugin-replacement.html: Added.
     12        * plugins/quicktime-plugin-replacement-expected.txt: Added.
     13        * plugins/resources/orange.mov: Replace movie compressed with ancient (and deprecated)
     14            animated gif codec with one compressed with H.264 codec.
     15
    1162013-11-27  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
    217
  • trunk/LayoutTests/platform/efl/TestExpectations

    r159812 r159827  
    17521752
    17531753webkit.org/b/124894 accessibility/fieldset-element.html [ Missing ]
     1754
     1755# QuickTime plug-in not relevant to this port
     1756plugins/quicktime-plugin-replacement.html [ Skip ]
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r159744 r159827  
    512512crypto/subtle [ Skip ]
    513513
     514# QuickTime plug-in not relevant to this port
     515plugins/quicktime-plugin-replacement.html [ Skip ]
     516
    514517#////////////////////////////////////////////////////////////////////////////////////////
    515518# End of Expected failures
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r158396 r159827  
    28542854# crypto.subtle is not yet enabled
    28552855crypto/subtle [ Skip ]
     2856
     2857# QuickTime plug-in not relevant to this port
     2858plugins/quicktime-plugin-replacement.html [ Skip ]
  • trunk/Source/WebCore/CMakeLists.txt

    r159823 r159827  
    1212    "${WEBCORE_DIR}/Modules/networkinfo"
    1313    "${WEBCORE_DIR}/Modules/notifications"
     14    "${WEBCORE_DIR}/Modules/plugins"
    1415    "${WEBCORE_DIR}/Modules/proximity"
    1516    "${WEBCORE_DIR}/Modules/quota"
  • trunk/Source/WebCore/ChangeLog

    r159823 r159827  
     12013-11-27  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Allow the QuickTime plug-in to be replaced by script in an isolated word
     4        https://bugs.webkit.org/show_bug.cgi?id=124900
     5
     6        Reviewed by Dean Jackson.
     7
     8        Test: plugins/quicktime-plugin-replacement.html
     9
     10        * CMakeLists.txt: Add new Modules path.
     11        * DerivedSources.make: Add new files.
     12        * GNUmakefile.am: Add new Modules path.
     13        * GNUmakefile.list.am: Add new header.
     14        * WebCore.vcxproj/WebCore.vcxproj: Add new header.
     15        * WebCore.vcxproj/WebCoreCommon.props: Add new Modules path.
     16        * WebCore.xcodeproj/project.pbxproj: Add new files.
     17
     18        * Modules/plugins: Added.
     19        * Modules/plugins/PluginReplacement.h: Added. Defines the interface for a plug-in replacement.
     20
     21        Create a replacement for the QuickTime plug-in.
     22        * Modules/plugins/QuickTimePluginReplacement.cpp: Added.
     23        * Modules/plugins/QuickTimePluginReplacement.css: Added.
     24        * Modules/plugins/QuickTimePluginReplacement.h: Added.
     25        * Modules/plugins/QuickTimePluginReplacement.idl: Added.
     26        * Modules/plugins/QuickTimePluginReplacement.js: Added.
     27
     28        Allow plug-in replacement to be enabled at runtime.
     29        * bindings/generic/RuntimeEnabledFeatures.h:
     30        (WebCore::RuntimeEnabledFeatures::setPluginReplacementEnabled):
     31        (WebCore::RuntimeEnabledFeatures::pluginReplacementEnabled):
     32
     33        * bindings/js/JSDOMBinding.h:
     34        (WebCore::toJS): Add toJS(... const String& ...).
     35
     36        * bindings/js/JSPluginElementFunctions.cpp:
     37        (WebCore::pluginScriptObject): Give a plug-in replacement a first shot at defining the
     38            script interface.
     39
     40        * html/HTMLEmbedElement.cpp:
     41        (WebCore::HTMLEmbedElement::updateWidget): Call base class requestObject.
     42
     43        * html/HTMLMediaElement.cpp:
     44        (HTMLMediaElement::fileSize): New, passthrough to media engine.
     45        * html/HTMLMediaElement.h:
     46
     47        * html/HTMLObjectElement.cpp:
     48        (WebCore::HTMLObjectElement::updateWidget): Call base class requestObject.
     49
     50        Moved some logic that was previously used only for creating a plug-in snapshot to the base
     51        class so it can be shared by a plug-in replacement.
     52        * html/HTMLPlugInElement.cpp:
     53        (WebCore::HTMLPlugInElement::HTMLPlugInElement): Initialize timer used to swap renderers.
     54        (WebCore::HTMLPlugInElement::createRenderer): Allow plug-in replacement to create the renderer.
     55        (WebCore::HTMLPlugInElement::swapRendererTimerFired): Create a shadow root.
     56        (WebCore::HTMLPlugInElement::setDisplayState): Set the new state, prime the swap renderer
     57            timer if necessary.
     58        (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Tell the plug-in replacement to
     59            install itself in the new shadow DOM.
     60        (WebCore::registeredPluginReplacements): Return vector of all registered plug-in replacements.
     61        (WebCore::registerPluginReplacement): Add a plug-in replacement.
     62        (WebCore::pluginReplacementForType): Find a plug-in replacement for a MIME type.
     63        (WebCore::HTMLPlugInElement::requestObject): If there is a plug-in replacement for the MIME type,
     64            create it and set the display state.
     65        (WebCore::HTMLPlugInElement::scriptObjectForPluginReplacement): Return the script object for
     66            the current plug-in replacement, if any.
     67        * html/HTMLPlugInElement.h:
     68
     69        Move some plug-in snapshot code into the base class.
     70        * html/HTMLPlugInImageElement.cpp:
     71        (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): No need to initialize timer.
     72        (WebCore::HTMLPlugInImageElement::setDisplayState): Call base class.
     73        (WebCore::HTMLPlugInImageElement::createRenderer): Ditto.
     74        (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Ditto.
     75        (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Remove unnecessary class name.
     76        (WebCore::HTMLPlugInImageElement::requestObject): New.
     77        * html/HTMLPlugInImageElement.h:
     78
     79        * html/HTMLVideoElement.h: Make createRenderer public so the QuickTime plug-in replacement can
     80            call it.
     81
     82        * platform/graphics/MediaPlayer.cpp:
     83        (WebCore::MediaPlayer::fileSize): New.
     84        * platform/graphics/MediaPlayer.h:
     85        * platform/graphics/MediaPlayerPrivate.h:
     86
     87        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
     88        (WebCore::MediaPlayerPrivateAVFoundation::extraMemoryCost): totalBytes returns an unsigned long long.
     89        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
     90        (WebCore::MediaPlayerPrivateAVFoundation::fileSize):
     91
     92        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
     93        (WebCore::MediaPlayerPrivateAVFoundationCF::totalBytes): Return an unsigned long long.
     94        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
     95
     96        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     97        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     98        (WebCore::MediaPlayerPrivateAVFoundationObjC::totalBytes): Ditto.
     99
     100        * testing/InternalSettings.cpp:
     101        (WebCore::InternalSettings::Backup::Backup): Backup the plug-in replacement runtime setting.
     102        (WebCore::InternalSettings::Backup::restoreTo): Restore it.
     103        (WebCore::InternalSettings::setPluginReplacementEnabled): Set it.
     104        * testing/InternalSettings.h:
     105        * testing/InternalSettings.idl:
     106
    11072013-11-27  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
    2108
  • trunk/Source/WebCore/DerivedSources.make

    r159797 r159827  
    3737    $(WebCore)/Modules/mediastream \
    3838    $(WebCore)/Modules/notifications \
     39    $(WebCore)/Modules/plugins \
    3940    $(WebCore)/Modules/quota \
    4041    $(WebCore)/Modules/speech \
     
    142143    $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \
    143144    $(WebCore)/Modules/notifications/WorkerGlobalScopeNotifications.idl \
     145    $(WebCore)/Modules/plugins/QuickTimePluginReplacement.idl \
    144146    $(WebCore)/Modules/quota/DOMWindowQuota.idl \
    145147    $(WebCore)/Modules/quota/NavigatorStorageQuota.idl \
     
    871873endif
    872874
     875ifeq ($(OS),MACOS)
     876        USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/plugins/QuickTimePluginReplacement.css
     877endif
     878
    873879UserAgentStyleSheets.h : css/make-css-file-arrays.pl bindings/scripts/preprocessor.pm $(USER_AGENT_STYLE_SHEETS) $(PLATFORM_FEATURE_DEFINES)
    874880        perl -I$(WebCore)/bindings/scripts $< --defines "$(FEATURE_DEFINES)" $@ UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS)
     
    884890endif
    885891
     892ifeq ($(OS),MACOS)
     893        USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/plugins/QuickTimePluginReplacement.js
     894endif
    886895
    887896UserAgentScripts.h : css/make-css-file-arrays.pl bindings/scripts/preprocessor.pm $(USER_AGENT_SCRIPTS) $(PLATFORM_FEATURE_DEFINES)
  • trunk/Source/WebCore/GNUmakefile.am

    r159419 r159827  
    2020        -I$(srcdir)/Source/WebCore/Modules/navigatorcontentutils \
    2121        -I$(srcdir)/Source/WebCore/Modules/notifications \
     22        -I$(srcdir)/Source/WebCore/Modules/plugins \
    2223        -I$(srcdir)/Source/WebCore/Modules/proximity \
    2324        -I$(srcdir)/Source/WebCore/Modules/quota \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r159823 r159827  
    19781978        Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.cpp \
    19791979        Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.h \
     1980        Source/WebCore/Modules/plugins/PluginReplacement.h \
    19801981        Source/WebCore/Modules/proximity/DeviceProximityClient.h \
    19811982        Source/WebCore/Modules/proximity/DeviceProximityController.cpp \
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r159730 r159827  
    1869618696    <ClInclude Include="..\Modules\notifications\NotificationClient.h" />
    1869718697    <ClInclude Include="..\Modules\notifications\WorkerGlobalScopeNotifications.h" />
     18698    <ClInclude Include="..\Modules\plugins\PluginReplacement.h" />
    1869818699    <ClInclude Include="..\Modules\webdatabase\AbstractDatabaseServer.h" />
    1869918700    <ClInclude Include="..\Modules\webdatabase\AbstractSQLStatement.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCoreCommon.props

    r159499 r159827  
    88  <ItemDefinitionGroup>
    99    <ClCompile>
    10       <AdditionalIncludeDirectories>$(ProjectDir)..;$(ProjectDir)..\Modules\mediacontrols;$(ProjectDir)..\Modules\mediastream;$(ProjectDir)..\Modules\filesystem;$(ProjectDir)..\Modules\geolocation;$(ProjectDir)..\Modules\indexeddb;$(ProjectDir)..\Modules\mediasource;$(ProjectDir)..\Modules\navigatorcontentutils;$(ProjectDir)..\Modules\speech;$(ProjectDir)..\Modules\proximity;$(ProjectDir)..\Modules\quota;$(ProjectDir)..\Modules\notifications;$(ProjectDir)..\Modules\webdatabase;$(ProjectDir)..\Modules\websockets;$(ProjectDir)..\accessibility;$(ProjectDir)..\accessibility\win;$(ProjectDir)..\bridge;$(ProjectDir)..\bridge\c;$(ProjectDir)..\bridge\jsc;$(ProjectDir)..\css;$(ProjectDir)..\editing;$(ProjectDir)..\fileapi;$(ProjectDir)..\rendering;$(ProjectDir)..\rendering\line;$(ProjectDir)..\rendering\mathml;$(ProjectDir)..\rendering\shapes;$(ProjectDir)..\rendering\style;$(ProjectDir)..\rendering\svg;$(ProjectDir)..\bindings;$(ProjectDir)..\bindings\generic;$(ProjectDir)..\bindings\js;$(ProjectDir)..\bindings\js\specialization;$(ProjectDir)..\dom;$(ProjectDir)..\dom\default;$(ProjectDir)..\history;$(ProjectDir)..\html;$(ProjectDir)..\html\canvas;$(ProjectDir)..\html\forms;$(ProjectDir)..\html\parser;$(ProjectDir)..\html\shadow;$(ProjectDir)..\html\track;$(ProjectDir)..\inspector;$(ProjectDir)..\loader;$(ProjectDir)..\loader\appcache;$(ProjectDir)..\loader\archive;$(ProjectDir)..\loader\archive\cf;$(ProjectDir)..\loader\cache;$(ProjectDir)..\loader\icon;$(ProjectDir)..\mathml;$(ProjectDir)..\page;$(ProjectDir)..\page\animation;$(ProjectDir)..\page\scrolling;$(ProjectDir)..\page\win;$(ProjectDir)..\platform;$(ProjectDir)..\platform\animation;$(ProjectDir)..\platform\mock;$(ProjectDir)..\platform\sql;$(ProjectDir)..\platform\win;$(ProjectDir)..\platform\network;$(ProjectDir)..\platform\network\win;$(ProjectDir)..\platform\cf;$(ProjectDir)..\platform\graphics;$(ProjectDir)..\platform\graphics\ca;$(ProjectDir)..\platform\graphics\cpu\arm\filters;$(ProjectDir)..\platform\graphics\filters;$(ProjectDir)..\platform\graphics\filters\arm;$(ProjectDir)..\platform\graphics\opentype;$(ProjectDir)..\platform\graphics\transforms;$(ProjectDir)..\platform\text;$(ProjectDir)..\platform\text\transcoder;$(ProjectDir)..\platform\graphics\win;$(ProjectDir)..\xml;$(ProjectDir)..\xml\parser;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources;$(ProjectDir)..\plugins;$(ProjectDir)..\plugins\win;$(ProjectDir)..\svg\animation;$(ProjectDir)..\svg\graphics;$(ProjectDir)..\svg\properties;$(ProjectDir)..\svg\graphics\filters;$(ProjectDir)..\svg;$(ProjectDir)..\testing;$(ProjectDir)..\crypto;$(ProjectDir)..\wml;$(ProjectDir)..\storage;$(ProjectDir)..\style;$(ProjectDir)..\websockets;$(ProjectDir)..\workers;$(ConfigurationBuildDir)\include;$(ConfigurationBuildDir)\include\private;$(ConfigurationBuildDir)\include\JavaScriptCore;$(ConfigurationBuildDir)\include\private\JavaScriptCore;$(ProjectDir)..\ForwardingHeaders;$(ProjectDir)..\platform\graphics\gpu;$(ProjectDir)..\platform\graphics\egl;$(ProjectDir)..\platform\graphics\surfaces;$(ProjectDir)..\platform\graphics\surfaces\egl;$(ProjectDir)..\platform\graphics\opengl;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;$(WebKit_Libraries)\include\private\JavaScriptCore;$(WebKit_Libraries)\include\sqlite;$(WebKit_Libraries)\include\JavaScriptCore;$(WebKit_Libraries)\include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     10      <AdditionalIncludeDirectories>$(ProjectDir)..;$(ProjectDir)..\Modules\mediacontrols;$(ProjectDir)..\Modules\mediastream;$(ProjectDir)..\Modules\filesystem;$(ProjectDir)..\Modules\geolocation;$(ProjectDir)..\Modules\indexeddb;$(ProjectDir)..\Modules\mediasource;$(ProjectDir)..\Modules\navigatorcontentutils;$(ProjectDir)..\Modules\plugins;$(ProjectDir)..\Modules\speech;$(ProjectDir)..\Modules\proximity;$(ProjectDir)..\Modules\quota;$(ProjectDir)..\Modules\notifications;$(ProjectDir)..\Modules\webdatabase;$(ProjectDir)..\Modules\websockets;$(ProjectDir)..\accessibility;$(ProjectDir)..\accessibility\win;$(ProjectDir)..\bridge;$(ProjectDir)..\bridge\c;$(ProjectDir)..\bridge\jsc;$(ProjectDir)..\css;$(ProjectDir)..\editing;$(ProjectDir)..\fileapi;$(ProjectDir)..\rendering;$(ProjectDir)..\rendering\line;$(ProjectDir)..\rendering\mathml;$(ProjectDir)..\rendering\shapes;$(ProjectDir)..\rendering\style;$(ProjectDir)..\rendering\svg;$(ProjectDir)..\bindings;$(ProjectDir)..\bindings\generic;$(ProjectDir)..\bindings\js;$(ProjectDir)..\bindings\js\specialization;$(ProjectDir)..\dom;$(ProjectDir)..\dom\default;$(ProjectDir)..\history;$(ProjectDir)..\html;$(ProjectDir)..\html\canvas;$(ProjectDir)..\html\forms;$(ProjectDir)..\html\parser;$(ProjectDir)..\html\shadow;$(ProjectDir)..\html\track;$(ProjectDir)..\inspector;$(ProjectDir)..\loader;$(ProjectDir)..\loader\appcache;$(ProjectDir)..\loader\archive;$(ProjectDir)..\loader\archive\cf;$(ProjectDir)..\loader\cache;$(ProjectDir)..\loader\icon;$(ProjectDir)..\mathml;$(ProjectDir)..\page;$(ProjectDir)..\page\animation;$(ProjectDir)..\page\scrolling;$(ProjectDir)..\page\win;$(ProjectDir)..\platform;$(ProjectDir)..\platform\animation;$(ProjectDir)..\platform\mock;$(ProjectDir)..\platform\sql;$(ProjectDir)..\platform\win;$(ProjectDir)..\platform\network;$(ProjectDir)..\platform\network\win;$(ProjectDir)..\platform\cf;$(ProjectDir)..\platform\graphics;$(ProjectDir)..\platform\graphics\ca;$(ProjectDir)..\platform\graphics\cpu\arm\filters;$(ProjectDir)..\platform\graphics\filters;$(ProjectDir)..\platform\graphics\filters\arm;$(ProjectDir)..\platform\graphics\opentype;$(ProjectDir)..\platform\graphics\transforms;$(ProjectDir)..\platform\text;$(ProjectDir)..\platform\text\transcoder;$(ProjectDir)..\platform\graphics\win;$(ProjectDir)..\xml;$(ProjectDir)..\xml\parser;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources;$(ProjectDir)..\plugins;$(ProjectDir)..\plugins\win;$(ProjectDir)..\svg\animation;$(ProjectDir)..\svg\graphics;$(ProjectDir)..\svg\properties;$(ProjectDir)..\svg\graphics\filters;$(ProjectDir)..\svg;$(ProjectDir)..\testing;$(ProjectDir)..\crypto;$(ProjectDir)..\wml;$(ProjectDir)..\storage;$(ProjectDir)..\style;$(ProjectDir)..\websockets;$(ProjectDir)..\workers;$(ConfigurationBuildDir)\include;$(ConfigurationBuildDir)\include\private;$(ConfigurationBuildDir)\include\JavaScriptCore;$(ConfigurationBuildDir)\include\private\JavaScriptCore;$(ProjectDir)..\ForwardingHeaders;$(ProjectDir)..\platform\graphics\gpu;$(ProjectDir)..\platform\graphics\egl;$(ProjectDir)..\platform\graphics\surfaces;$(ProjectDir)..\platform\graphics\surfaces\egl;$(ProjectDir)..\platform\graphics\opengl;$(WebKit_Libraries)\include;$(WebKit_Libraries)\include\private;$(WebKit_Libraries)\include\private\JavaScriptCore;$(WebKit_Libraries)\include\sqlite;$(WebKit_Libraries)\include\JavaScriptCore;$(WebKit_Libraries)\include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    1111      <PreprocessorDefinitions>DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1212      <PrecompiledHeader>Use</PrecompiledHeader>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r159797 r159827  
    147147                07277E5417D018CC0015534D /* JSMediaStreamTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4817D018CC0015534D /* JSMediaStreamTrackEvent.cpp */; };
    148148                07277E5517D018CC0015534D /* JSMediaStreamTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4917D018CC0015534D /* JSMediaStreamTrackEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
     149                072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1DF183C0741000A5988 /* PluginReplacement.h */; };
     150                072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.cpp */; };
     151                072AE1E8183C0741000A5988 /* QuickTimePluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1E2183C0741000A5988 /* QuickTimePluginReplacement.h */; };
    149152                072C8B11131C518600A4FCE9 /* MediaPlayerPrivateAVFoundation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076F0D0912B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.cpp */; };
    150153                072CA86116CB4DC3008AE131 /* CaptionUserPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 072CA86016CB4DC3008AE131 /* CaptionUserPreferences.cpp */; };
     
    188191                07846343145B151A00A58DF1 /* JSTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07846341145B151A00A58DF1 /* JSTrackEvent.h */; };
    189192                07846385145B1B8E00A58DF1 /* JSTrackCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */; };
     193                077664FC183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 077664FA183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp */; };
     194                077664FD183E6B5C00133B92 /* JSQuickTimePluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 077664FB183E6B5C00133B92 /* JSQuickTimePluginReplacement.h */; };
    190195                078E08FE17D14CEE00420AA1 /* MediaConstraintsImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B4A17CEC32700848E51 /* MediaConstraintsImpl.cpp */; };
    191196                078E08FF17D14CEE00420AA1 /* MediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07221B4C17CEC32700848E51 /* MediaStream.cpp */; };
     
    67666771                0729B14E17CFCCA0004F1D60 /* MediaStreamCenterMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamCenterMac.cpp; sourceTree = "<group>"; };
    67676772                0729B14F17CFCCA0004F1D60 /* MediaStreamCenterMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamCenterMac.h; sourceTree = "<group>"; };
     6773                072AE1DF183C0741000A5988 /* PluginReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PluginReplacement.h; path = plugins/PluginReplacement.h; sourceTree = "<group>"; };
     6774                072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = QuickTimePluginReplacement.cpp; path = plugins/QuickTimePluginReplacement.cpp; sourceTree = "<group>"; };
     6775                072AE1E1183C0741000A5988 /* QuickTimePluginReplacement.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = QuickTimePluginReplacement.css; path = plugins/QuickTimePluginReplacement.css; sourceTree = "<group>"; };
     6776                072AE1E2183C0741000A5988 /* QuickTimePluginReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuickTimePluginReplacement.h; path = plugins/QuickTimePluginReplacement.h; sourceTree = "<group>"; };
     6777                072AE1E3183C0741000A5988 /* QuickTimePluginReplacement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = QuickTimePluginReplacement.idl; path = plugins/QuickTimePluginReplacement.idl; sourceTree = "<group>"; };
     6778                072AE1E4183C0741000A5988 /* QuickTimePluginReplacement.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = QuickTimePluginReplacement.js; path = plugins/QuickTimePluginReplacement.js; sourceTree = "<group>"; };
    67686779                072CA86016CB4DC3008AE131 /* CaptionUserPreferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CaptionUserPreferences.cpp; sourceTree = "<group>"; };
    67696780                0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerProxy.h; sourceTree = "<group>"; };
     
    68046815                0783228218013ED700999E0C /* MediaStreamAudioSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamAudioSource.cpp; sourceTree = "<group>"; };
    68056816                0783228318013ED800999E0C /* MediaStreamAudioSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamAudioSource.h; sourceTree = "<group>"; };
     6817                077664FA183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSQuickTimePluginReplacement.cpp; path = JSQuickTimePluginReplacement.cpp; sourceTree = "<group>"; };
     6818                077664FB183E6B5C00133B92 /* JSQuickTimePluginReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSQuickTimePluginReplacement.h; path = JSQuickTimePluginReplacement.h; sourceTree = "<group>"; };
    68066819                07846340145B151A00A58DF1 /* JSTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackEvent.cpp; sourceTree = "<group>"; };
    68076820                07846341145B151A00A58DF1 /* JSTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTrackEvent.h; sourceTree = "<group>"; };
     
    1375613769                        sourceTree = "<group>";
    1375713770                };
     13771                072AE1DE183C0513000A5988 /* plugins */ = {
     13772                        isa = PBXGroup;
     13773                        children = (
     13774                                072AE1DF183C0741000A5988 /* PluginReplacement.h */,
     13775                                072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.cpp */,
     13776                                072AE1E1183C0741000A5988 /* QuickTimePluginReplacement.css */,
     13777                                072AE1E2183C0741000A5988 /* QuickTimePluginReplacement.h */,
     13778                                072AE1E3183C0741000A5988 /* QuickTimePluginReplacement.idl */,
     13779                                072AE1E4183C0741000A5988 /* QuickTimePluginReplacement.js */,
     13780                        );
     13781                        name = plugins;
     13782                        sourceTree = "<group>";
     13783                };
    1375813784                076F0D0812B8192700C26AA4 /* avfoundation */ = {
    1375913785                        isa = PBXGroup;
     
    1410114127                        isa = PBXGroup;
    1410214128                        children = (
     14129                                077664FA183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp */,
     14130                                077664FB183E6B5C00133B92 /* JSQuickTimePluginReplacement.h */,
    1410314131                                A83B79100CCB001B000B0825 /* Core */,
    1410414132                                E1FF8F61180745C600132674 /* Crypto */,
     
    1695516983                        isa = PBXGroup;
    1695616984                        children = (
     16985                                072AE1DE183C0513000A5988 /* plugins */,
    1695716986                                CDA98DBD16014E0800FEA3B1 /* encryptedmedia */,
    1695816987                                971145FF14EF007900674FD9 /* geolocation */,
     
    2199722026                                0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */,
    2199822027                                51D719D7181106E00016DC51 /* IDBHistograms.h in Headers */,
     22028                                072AE1E8183C0741000A5988 /* QuickTimePluginReplacement.h in Headers */,
    2199922029                                29D7BCFA1444AF7D0070619C /* AccessibilitySpinButton.h in Headers */,
    2200022030                                AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */,
     
    2219322223                                FD31600212B0267600C1A359 /* ChannelSplitterNode.h in Headers */,
    2219422224                                6550B6A0099DF0270090D781 /* CharacterData.h in Headers */,
     22225                                077664FD183E6B5C00133B92 /* JSQuickTimePluginReplacement.h in Headers */,
    2219522226                                97B8FFD116AE7F960038388D /* CharacterReferenceParserInlines.h in Headers */,
    2219622227                                E164FAA318315BF400DB4E61 /* CryptoKeyRSA.h in Headers */,
     
    2489324924                                5DA97ECD168E787B000E3676 /* SystemVersionMac.h in Headers */,
    2489424925                                A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */,
     24926                                072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */,
    2489524927                                BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */,
    2489624928                                F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */,
     
    2704327075                                B2FA3D9E0AB75A6F000E5AC4 /* JSSVGImageElement.cpp in Sources */,
    2704427076                                B2FA3DA00AB75A6F000E5AC4 /* JSSVGLength.cpp in Sources */,
     27077                                077664FC183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp in Sources */,
    2704527078                                08E4FE460E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp in Sources */,
    2704627079                                B2FA3DA20AB75A6F000E5AC4 /* JSSVGLengthList.cpp in Sources */,
     
    2724927282                                9759E93E14EF1CF80026A2DD /* LoadableTextTrack.cpp in Sources */,
    2725027283                                656D37330ADBA5DE00A4554D /* LoaderNSURLExtras.mm in Sources */,
     27284                                072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.cpp in Sources */,
    2725127285                                7EE6846812D26E3800E79415 /* LoaderRunLoopCF.cpp in Sources */,
    2725227286                                51ABF64D16392E2800132A7A /* LoaderStrategy.cpp in Sources */,
  • trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h

    r158269 r159827  
    229229    void setLangAttributeAwareFormControlUIEnabled(bool isEnabled) { m_isLangAttributeAwareFormControlUIEnabled = isEnabled; }
    230230
     231    void setPluginReplacementEnabled(bool isEnabled) { m_isPluginReplacementEnabled = isEnabled; }
     232    bool pluginReplacementEnabled() const { return m_isPluginReplacementEnabled; }
     233
    231234    static RuntimeEnabledFeatures& sharedFeatures();
    232235
     
    251254    bool m_isCSSCompositingEnabled;
    252255    bool m_isLangAttributeAwareFormControlUIEnabled;
     256    bool m_isPluginReplacementEnabled;
     257
    253258#if ENABLE(SCRIPTED_SPEECH)
    254259    bool m_isScriptedSpeechEnabled;
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.h

    r159275 r159827  
    393393}
    394394
     395inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject*, const String& value)
     396{
     397    return jsStringOrNull(exec, value);
     398}
     399
    395400template <class T>
    396401struct JSValueTraits {
  • trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp

    r159416 r159827  
    8383    HTMLPlugInElement& pluginElement = toHTMLPlugInElement(element);
    8484
    85     // First, see if we can ask the plug-in view for its script object.
     85    // First, see if the element has a plug-in replacement with a script.
     86    if (JSObject* scriptObject = pluginElement.scriptObjectForPluginReplacement())
     87        return scriptObject;
     88   
     89    // Next, see if we can ask the plug-in view for its script object.
    8690    if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject()))
    8791        return scriptObject;
  • trunk/Source/WebCore/html/HTMLEmbedElement.cpp

    r159416 r159827  
    171171        return;
    172172
    173     SubframeLoader& loader = document().frame()->loader().subframeLoader();
    174173    // FIXME: beforeLoad could have detached the renderer!  Just like in the <object> case above.
    175     loader.requestObject(*this, m_url, getNameAttribute(), m_serviceType, paramNames, paramValues);
     174    requestObject(m_url, m_serviceType, paramNames, paramValues);
    176175}
    177176
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r159797 r159827  
    53015301#endif
    53025302
    5303 }
    5304 
    5305 #endif
     5303unsigned long long HTMLMediaElement::fileSize() const
     5304{
     5305    if (m_player)
     5306        return m_player->fileSize();
     5307   
     5308    return 0;
     5309}
     5310
     5311}
     5312
     5313#endif
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r159797 r159827  
    394394#endif
    395395
     396    unsigned long long fileSize() const;
     397
    396398protected:
    397399    HTMLMediaElement(const QualifiedName&, Document&, bool);
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r159604 r159827  
    308308        return;
    309309
    310     SubframeLoader& loader = document().frame()->loader().subframeLoader();
    311     bool success = beforeLoadAllowedLoad && hasValidClassId() && loader.requestObject(*this, url, getNameAttribute(), serviceType, paramNames, paramValues);
     310    bool success = beforeLoadAllowedLoad && hasValidClassId();
     311    if (success)
     312        success = requestObject(url, serviceType, paramNames, paramValues);
    312313    if (!success && hasFallbackContent())
    313314        renderFallbackContent();
  • trunk/Source/WebCore/html/HTMLPlugInElement.cpp

    r159023 r159827  
    3636#include "FrameTree.h"
    3737#include "HTMLNames.h"
     38#include "Logging.h"
     39#include "MIMETypeRegistry.h"
    3840#include "Page.h"
     41#include "PluginData.h"
     42#include "PluginReplacement.h"
    3943#include "PluginViewBase.h"
    4044#include "RenderEmbeddedObject.h"
    4145#include "RenderSnapshottedPlugIn.h"
    4246#include "RenderWidget.h"
     47#include "RuntimeEnabledFeatures.h"
    4348#include "ScriptController.h"
    4449#include "Settings.h"
     50#include "ShadowRoot.h"
     51#include "SubframeLoader.h"
    4552#include "Widget.h"
    4653
    4754#if ENABLE(NETSCAPE_PLUGIN_API)
    4855#include "npruntime_impl.h"
     56#endif
     57
     58#if PLATFORM(MAC)
     59#include "QuickTimePluginReplacement.h"
    4960#endif
    5061
     
    5667    : HTMLFrameOwnerElement(tagName, document)
    5768    , m_inBeforeLoadEventHandler(false)
     69    , m_swapRendererTimer(this, &HTMLPlugInElement::swapRendererTimerFired)
    5870#if ENABLE(NETSCAPE_PLUGIN_API)
    5971    , m_NPObject(0)
     
    263275#endif /* ENABLE(NETSCAPE_PLUGIN_API) */
    264276
    265 }
     277RenderElement* HTMLPlugInElement::createRenderer(PassRef<RenderStyle> style)
     278{
     279    if (m_pluginReplacement && m_pluginReplacement->willCreateRenderer())
     280        return m_pluginReplacement->createRenderer(*this, std::move(style));
     281
     282    return new RenderEmbeddedObject(*this, std::move(style));
     283}
     284
     285void HTMLPlugInElement::swapRendererTimerFired(Timer<HTMLPlugInElement>*)
     286{
     287    ASSERT(displayState() == PreparingPluginReplacement || displayState() == DisplayingSnapshot);
     288    if (userAgentShadowRoot())
     289        return;
     290   
     291    // Create a shadow root, which will trigger the code to add a snapshot container
     292    // and reattach, thus making a new Renderer.
     293    ensureUserAgentShadowRoot();
     294}
     295
     296void HTMLPlugInElement::setDisplayState(DisplayState state)
     297{
     298    m_displayState = state;
     299   
     300    if ((state == DisplayingSnapshot || displayState() == PreparingPluginReplacement) && !m_swapRendererTimer.isActive())
     301        m_swapRendererTimer.startOneShot(0);
     302}
     303
     304void HTMLPlugInElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     305{
     306    if (!m_pluginReplacement || !document().page() || displayState() != PreparingPluginReplacement)
     307        return;
     308   
     309    root->setResetStyleInheritance(true);
     310    if (m_pluginReplacement->installReplacement(root)) {
     311        setDisplayState(DisplayingPluginReplacement);
     312        Style::reattachRenderTree(*this);
     313    }
     314}
     315
     316#if PLATFORM(MAC)
     317static void registrar(const ReplacementPlugin&);
     318#endif
     319
     320static Vector<ReplacementPlugin*>& registeredPluginReplacements()
     321{
     322    DEFINE_STATIC_LOCAL(Vector<ReplacementPlugin*>, registeredReplacements, ());
     323    static bool enginesQueried = false;
     324   
     325    if (enginesQueried)
     326        return registeredReplacements;
     327    enginesQueried = true;
     328
     329#if PLATFORM(MAC)
     330    QuickTimePluginReplacement::registerPluginReplacement(registrar);
     331#endif
     332   
     333    return registeredReplacements;
     334}
     335
     336#if PLATFORM(MAC)
     337static void registrar(const ReplacementPlugin& replacement)
     338{
     339    registeredPluginReplacements().append(new ReplacementPlugin(replacement));
     340}
     341#endif
     342
     343static ReplacementPlugin* pluginReplacementForType(const URL& url, const String& mimeType)
     344{
     345    Vector<ReplacementPlugin*>& replacements = registeredPluginReplacements();
     346    if (replacements.isEmpty())
     347        return nullptr;
     348
     349    String extension;
     350    String lastPathComponent = url.lastPathComponent();
     351    size_t dotOffset = lastPathComponent.reverseFind('.');
     352    if (dotOffset != notFound)
     353        extension = lastPathComponent.substring(dotOffset + 1);
     354
     355    String type = mimeType;
     356    if (type.isEmpty() && url.protocolIsData())
     357        type = mimeTypeFromDataURL(url.string());
     358   
     359    if (type.isEmpty() && !extension.isEmpty()) {
     360        for (size_t i = 0; i < replacements.size(); i++)
     361            if (replacements[i]->supportsFileExtension(extension))
     362                return replacements[i];
     363    }
     364   
     365    if (type.isEmpty()) {
     366        if (extension.isEmpty())
     367            return nullptr;
     368        type = MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
     369    }
     370
     371    if (type.isEmpty())
     372        return nullptr;
     373
     374    for (unsigned i = 0; i < replacements.size(); i++)
     375        if (replacements[i]->supportsType(type))
     376            return replacements[i];
     377
     378    return nullptr;
     379}
     380
     381bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
     382{
     383    if (!RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
     384        return false;
     385
     386    if (m_pluginReplacement)
     387        return true;
     388
     389    URL completedURL;
     390    if (!url.isEmpty())
     391        completedURL = document().completeURL(url);
     392
     393    ReplacementPlugin* replacement = pluginReplacementForType(completedURL, mimeType);
     394    if (!replacement)
     395        return false;
     396
     397    LOG(Plugins, "%p - Found plug-in replacement for %s.", this, completedURL.string().utf8().data());
     398
     399    m_pluginReplacement = replacement->create(*this, paramNames, paramValues);
     400    setDisplayState(PreparingPluginReplacement);
     401    return true;
     402}
     403
     404JSC::JSObject* HTMLPlugInElement::scriptObjectForPluginReplacement()
     405{
     406    if (m_pluginReplacement)
     407        return m_pluginReplacement->scriptObject();
     408    return nullptr;
     409}
     410
     411}
  • trunk/Source/WebCore/html/HTMLPlugInElement.h

    r158985 r159827  
    3939namespace WebCore {
    4040
     41class PluginReplacement;
    4142class RenderEmbeddedObject;
    4243class RenderWidget;
     
    5859        Restarting,
    5960        RestartingWithPendingMouseClick,
    60         Playing
     61        Playing,
     62        PreparingPluginReplacement,
     63        DisplayingPluginReplacement,
    6164    };
    6265    DisplayState displayState() const { return m_displayState; }
    63     virtual void setDisplayState(DisplayState state) { m_displayState = state; }
     66    virtual void setDisplayState(DisplayState);
    6467    virtual void updateSnapshot(PassRefPtr<Image>) { }
    6568    virtual void dispatchPendingMouseClick() { }
    6669    virtual bool isRestartedPlugin() const { return false; }
     70
     71    JSC::JSObject* scriptObjectForPluginReplacement();
    6772
    6873#if ENABLE(NETSCAPE_PLUGIN_API)
     
    9297    virtual void defaultEventHandler(Event*) OVERRIDE;
    9398
     99    virtual bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues);
     100    virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
     101    virtual void didAddUserAgentShadowRoot(ShadowRoot*) OVERRIDE;
     102
    94103    // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
    95104    bool guardedDispatchBeforeLoadEvent(const String& sourceURL);
     
    98107
    99108private:
     109    void swapRendererTimerFired(Timer<HTMLPlugInElement>*);
     110    bool shouldOverridePlugin(const String& url, const String& mimeType);
     111
    100112    bool dispatchBeforeLoadEvent(const String& sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake.
    101113
     
    110122
    111123    RefPtr<JSC::Bindings::Instance> m_instance;
     124    Timer<HTMLPlugInElement> m_swapRendererTimer;
     125    RefPtr<PluginReplacement> m_pluginReplacement;
    112126#if ENABLE(NETSCAPE_PLUGIN_API)
    113127    NPObject* m_NPObject;
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r159604 r159827  
    109109    , m_needsDocumentActivationCallbacks(false)
    110110    , m_simulatedMouseClickTimer(this, &HTMLPlugInImageElement::simulatedMouseClickTimerFired, simulatedMouseClickTimerDelay)
    111     , m_swapRendererTimer(this, &HTMLPlugInImageElement::swapRendererTimerFired)
    112111    , m_removeSnapshotTimer(this, &HTMLPlugInImageElement::removeSnapshotTimerFired)
    113112    , m_createdDuringUserGesture(ScriptController::processingUserGesture())
     
    140139
    141140    HTMLPlugInElement::setDisplayState(state);
    142 
    143     if (state == DisplayingSnapshot)
    144         m_swapRendererTimer.startOneShot(0);
    145141}
    146142
     
    197193RenderElement* HTMLPlugInImageElement::createRenderer(PassRef<RenderStyle> style)
    198194{
     195    if (displayState() >= PreparingPluginReplacement)
     196        return HTMLPlugInElement::createRenderer(std::move(style));
     197
    199198    // Once a PlugIn Element creates its renderer, it needs to be told when the Document goes
    200199    // inactive or reactivates so it can clear the renderer before going into the page cache.
     
    222221    }
    223222
    224     return new RenderEmbeddedObject(*this, std::move(style));
     223    return HTMLPlugInElement::createRenderer(std::move(style));
    225224}
    226225
     
    364363void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
    365364{
     365    HTMLPlugInElement::didAddUserAgentShadowRoot(root);
     366    if (displayState() >= PreparingPluginReplacement)
     367        return;
     368
    366369    Page* page = document().page();
    367     if (!page)
     370    if (page)
    368371        return;
    369372
     
    408411    RefPtr<Element> snapshotLabel = ensureUserAgentShadowRoot().querySelector(selector, ASSERT_NO_EXCEPTION);
    409412    return node && snapshotLabel && (node == snapshotLabel.get() || node->isDescendantOf(snapshotLabel.get()));
    410 }
    411 
    412 void HTMLPlugInImageElement::swapRendererTimerFired(Timer<HTMLPlugInImageElement>*)
    413 {
    414     ASSERT(displayState() == DisplayingSnapshot);
    415     if (userAgentShadowRoot())
    416         return;
    417 
    418     // Create a shadow root, which will trigger the code to add a snapshot container
    419     // and reattach, thus making a new Renderer.
    420     ensureUserAgentShadowRoot();
    421413}
    422414
     
    497489    restartSnapshottedPlugIn();
    498490    if (forwardEvent)
    499         setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick);
     491        setDisplayState(RestartingWithPendingMouseClick);
    500492    restartSimilarPlugIns();
    501493}
     
    733725}
    734726
     727bool HTMLPlugInImageElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
     728{
     729    if (HTMLPlugInElement::requestObject(url, mimeType, paramNames, paramValues))
     730        return true;
     731   
     732    SubframeLoader& loader = document().frame()->loader().subframeLoader();
     733    return loader.requestObject(*this, url, getNameAttribute(), mimeType, paramNames, paramValues);
     734}
     735
    735736} // namespace WebCore
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.h

    r158097 r159827  
    3030
    3131class HTMLImageLoader;
     32class HTMLVideoElement;
    3233class FrameLoader;
    3334class Image;
     
    124125
    125126    virtual bool isRestartedPlugin() const OVERRIDE { return m_isRestartedPlugin; }
     127    virtual bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) OVERRIDE;
    126128
    127129private:
     
    139141    void simulatedMouseClickTimerFired(DeferrableOneShotTimer<HTMLPlugInImageElement>*);
    140142
    141     void swapRendererTimerFired(Timer<HTMLPlugInImageElement>*);
    142 
    143143    void restartSimilarPlugIns();
    144144
     
    155155    RefPtr<MouseEvent> m_pendingClickEventFromSnapshot;
    156156    DeferrableOneShotTimer<HTMLPlugInImageElement> m_simulatedMouseClickTimer;
    157     Timer<HTMLPlugInImageElement> m_swapRendererTimer;
    158157    Timer<HTMLPlugInImageElement> m_removeSnapshotTimer;
    159158    RefPtr<Image> m_snapshotImage;
  • trunk/Source/WebCore/html/HTMLVideoElement.h

    r159518 r159827  
    7373
    7474    URL posterImageURL() const;
     75    virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
    7576
    7677private:
     
    7879
    7980    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
    80     virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
    8181    virtual void didAttachRenderers() OVERRIDE;
    8282    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r159518 r159827  
    12261226}
    12271227
     1228unsigned long long MediaPlayer::fileSize() const
     1229{
     1230    if (!m_private)
     1231        return 0;
     1232   
     1233    return m_private->fileSize();
     1234}
     1235
    12281236void MediaPlayerFactorySupport::callRegisterMediaEngine(MediaEngineRegister registerMediaEngine)
    12291237{
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.h

    r159518 r159827  
    509509    size_t extraMemoryCost() const;
    510510
     511    unsigned long long fileSize() const;
     512
    511513private:
    512514    MediaPlayer(MediaPlayerClient*);
  • trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h

    r159518 r159827  
    214214
    215215    virtual size_t extraMemoryCost() const { return 0; }
     216   
     217    virtual unsigned long long fileSize() const { return 0; }
    216218};
    217219
  • trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp

    r159208 r159827  
    922922        return 0;
    923923
    924     return totalBytes() * buffered()->totalDuration() / duration;
     924    unsigned long long extra = totalBytes() * buffered()->totalDuration() / duration;
     925    return static_cast<unsigned>(extra);
    925926}
    926927
  • trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h

    r159208 r159827  
    191191    virtual bool supportsFullscreen() const;
    192192    virtual bool supportsScanning() const { return true; }
     193    unsigned long long fileSize() const { return totalBytes(); }
    193194
    194195    // Required interfaces for concrete derived classes.
     
    226227    virtual float rate() const = 0;
    227228    virtual void seekToTime(double time, double negativeTolerance, double positiveTolerance) = 0;
    228     virtual unsigned totalBytes() const = 0;
     229    virtual unsigned long long totalBytes() const = 0;
    229230    virtual PassRefPtr<TimeRanges> platformBufferedTimeRanges() const = 0;
    230231    virtual double platformMaxTimeSeekable() const = 0;
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp

    r159691 r159827  
    722722}
    723723
    724 unsigned MediaPlayerPrivateAVFoundationCF::totalBytes() const
     724unsigned long long MediaPlayerPrivateAVFoundationCF::totalBytes() const
    725725{
    726726    if (!metaDataAvailable() || !avAsset(m_avfWrapper))
     
    735735    }
    736736
    737     // FIXME: It doesn't seem safe to cast an int64_t to unsigned.
    738     return static_cast<unsigned>(totalMediaSize);
     737    return static_cast<unsigned long long>(totalMediaSize);
    739738}
    740739
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h

    r159302 r159827  
    7878    virtual float rate() const;
    7979    virtual void seekToTime(double time, double negativeTolerance, double positiveTolerance);
    80     virtual unsigned totalBytes() const;
     80    virtual unsigned long long totalBytes() const;
    8181    virtual PassRefPtr<TimeRanges> platformBufferedTimeRanges() const;
    8282    virtual double platformMinTimeSeekable() const;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r159518 r159827  
    149149    virtual float rate() const;
    150150    virtual void seekToTime(double time, double negativeTolerance, double positiveTolerance);
    151     virtual unsigned totalBytes() const;
     151    virtual unsigned long long totalBytes() const;
    152152    virtual PassRefPtr<TimeRanges> platformBufferedTimeRanges() const;
    153153    virtual double platformMinTimeSeekable() const;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r159525 r159827  
    804804}
    805805
    806 unsigned MediaPlayerPrivateAVFoundationObjC::totalBytes() const
     806unsigned long long MediaPlayerPrivateAVFoundationObjC::totalBytes() const
    807807{
    808808    if (!metaDataAvailable())
     
    813813        totalMediaSize += [[thisTrack assetTrack] totalSampleDataLength];
    814814
    815     return static_cast<unsigned>(totalMediaSize);
     815    return totalMediaSize;
    816816}
    817817
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r157265 r159827  
    9595    , m_useLegacyBackgroundSizeShorthandBehavior(settings.useLegacyBackgroundSizeShorthandBehavior())
    9696    , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled())
     97    , m_pluginReplacementEnabled(RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
    9798{
    9899}
     
    157158    settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior);
    158159    settings.setAutoscrollForDragAndDropEnabled(m_autoscrollForDragAndDropEnabled);
     160    RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(m_pluginReplacementEnabled);
    159161}
    160162
     
    529531}
    530532
    531 }
     533void InternalSettings::setPluginReplacementEnabled(bool enabled)
     534{
     535    RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(enabled);
     536}
     537
     538}
  • trunk/Source/WebCore/testing/InternalSettings.h

    r157265 r159827  
    9292        bool m_useLegacyBackgroundSizeShorthandBehavior;
    9393        bool m_autoscrollForDragAndDropEnabled;
     94        bool m_pluginReplacementEnabled;
    9495    };
    9596
     
    137138    void setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode&);
    138139    void setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode&);
     140    void setPluginReplacementEnabled(bool);
    139141
    140142private:
  • trunk/Source/WebCore/testing/InternalSettings.idl

    r157265 r159827  
    6161    [RaisesException] void setAutoscrollForDragAndDropEnabled(boolean enabled);
    6262    [RaisesException] void setFontFallbackPrefersPictographs(boolean preferPictographs);
     63    void setPluginReplacementEnabled(boolean enabled);
    6364};
Note: See TracChangeset for help on using the changeset viewer.