[iOS] Disable the video plugin proxy by default on WK1.
https://bugs.webkit.org/show_bug.cgi?id=130460

Reviewed by Eric Carlson.

Update the defaults to universally enable the AVFoundationEnabled preference, disable the
VideoPluginProxyEnabled preference, and on iOS only enable the AVKitEnabled preference.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165907 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] WebKit2 Quicklook.
https://bugs.webkit.org/show_bug.cgi?id=130360

Source/WebCore:

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2014-03-19
Reviewed by Tim Horton.

Since ResourceLoaders using WebKit2 network process don't have ResourceHandle any more, we
need to make it possible to create QuickLookHandle from ResourceLoader.

* WebCore.exp.in: Make some QuickLookHandle methods visible from WebKit2.
* loader/ResourceLoader.h: Add m_quickLookHandle data member to ResourceLoader.
(WebCore::ResourceLoader::quickLookHandle):
(WebCore::ResourceLoader::setQuickLookHandle):
* platform/network/ios/QuickLook.h: Add a new method to create QuickLookHandle from ResourceLoader.
* platform/network/ios/QuickLook.mm:
(WebCore::QuickLookHandle::create):

Source/WebKit2:

For WebKit2 resource loads, if we detect a quicklook content that QLConverter is able to
convert, handle the response data to QLConverter and use its delegate WKWebResourceQuickLookDelegate
to rounte the converted results (HTML) back into WebCore.  Thie similiar logic has been in place
for WebKit1.

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2014-03-19
Reviewed by Tim Horton.

* WebKit2.xcodeproj/project.pbxproj: Add WebResourceLoaderIOS.mm to the project.
* WebProcess/Network/WebResourceLoadScheduler.cpp:
* WebProcess/ios/WebResourceLoaderIOS.mm: Added.
(-[WKWebResourceQuickLookDelegate initWithWebResourceLoader:WebKit::]): WKWebResourceQuickLookDelegate holds
    the original WebResourceLoader so that we could send converted result to WebCore.
(-[WKWebResourceQuickLookDelegate connection:didReceiveDataArray:]):
(-[WKWebResourceQuickLookDelegate connection:didReceiveData:lengthReceived:]):
(-[WKWebResourceQuickLookDelegate connectionDidFinishLoading:]):
(-[WKWebResourceQuickLookDelegate connection:didFailWithError:]):
(-[WKWebResourceQuickLookDelegate clearHandle]):
(WebKit::WebResourceLoader::setUpQuickLookHandleIfNeeded):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Normalize some of the older JSC options
https://bugs.webkit.org/show_bug.cgi?id=128753

Reviewed by Michael Saboff.

* runtime/Options.cpp:
(JSC::Options::initialize):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement method addPath for Path2D
https://bugs.webkit.org/show_bug.cgi?id=130461

Reviewed by Dean Jackson.

Source/WebCore:

Add support for the Path2D method addPath. The method allows
to append and existing Path2D object to another one. It can be
combined with a transformation matrix SVGMatrix.

Test: fast/canvas/canvas-path-addPath.html

* html/canvas/DOMPath.h: Add new method addPath().
(WebCore::DOMPath::addPath):
* html/canvas/DOMPath.idl:
* platform/graphics/Path.h: Add support for appending paths.
* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::addPath):
* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::addPath):
* platform/graphics/wince/PathWinCE.cpp:
(WebCore::Path::addPath):

LayoutTests:

Test the addPath Path2D method.

* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* fast/canvas/canvas-path-addPath-expected.txt: Added.
* fast/canvas/canvas-path-addPath.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Filter out editable services from image menu for non-contenteditable images
<rdar://problem/16319645> and https://bugs.webkit.org/show_bug.cgi?id=130437

Reviewed by Tim Horton.

Source/WebCore:

* WebCore.exp.in:

Source/WebKit/mac:

* Misc/WebSharingServicePickerController.h:
* Misc/WebSharingServicePickerController.mm:
(-[WebSharingServicePickerController sharingServicePicker:sharingServicesForItems:mask:proposedSharingServices:]):
  Filter out editing services based on the includeEditorServices flag.
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::contextMenuForEvent):

Source/WebKit2:

* UIProcess/mac/WebContextMenuProxyMac.h:
* UIProcess/mac/WebContextMenuProxyMac.mm:
(-[WKSharingServicePickerDelegate setIncludeEditorServices:]):
(-[WKSharingServicePickerDelegate sharingServicePicker:sharingServicesForItems:mask:proposedSharingServices:]):
  Filter out editing services based on the includeEditorServices flag.
(WebKit::WebContextMenuProxyMac::setupImageServicesMenu):
(WebKit::WebContextMenuProxyMac::populate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r165459): It broke 109 jsc stress test on ARM Thumb2 and Mac 32 bit
https://bugs.webkit.org/show_bug.cgi?id=130134

Reviewed by Mark Hahnenberg.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode): Can't do some optimizations if you don't have a lot of registers.
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::cachedGetById): Move stuff around before going into the IC code to ensure that we give the IC code the invariants it needs. This only happens in case of GetByIdFlush, where we are forced into using weird combinations of registers because the results have to be in t0/t1.
(JSC::DFG::SpeculativeJIT::compile): For a normal GetById, the register allocator should just do the right thing so nobody has to move anything around.
* jit/JITInlineCacheGenerator.cpp:
(JSC::JITGetByIdGenerator::JITGetByIdGenerator): Assert the things we want.
* jit/JITInlineCacheGenerator.h:
* jit/Repatch.cpp:
(JSC::generateGetByIdStub): Remove a previous incomplete hack to try to work around the DFG's problem.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Page::setPageScaleFactor should not force the scroll view position when using delegatesScrolling()
https://bugs.webkit.org/show_bug.cgi?id=130429

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-03-19
Reviewed by Simon Fraser.

When setting the same scale mutliple time (for example on load), Page was asking the top scrollview
to scroll to the origin. This is bogus since the scroll view is driving Page::setDeviceScaleFactor,
not the other way around.

Simon fixed the general case in http://trac.webkit.org/changeset/165652/trunk/Source/WebCore/page/Page.cpp
but this branch was still scrolling content.

* page/Page.cpp:
(WebCore::Page::setPageScaleFactor):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSC bindings should use the passed-in global object for wrapper caching.
<https://webkit.org/b/130458>

Take a shorter path to the DOMWrapperWorld by using the passed-in
global object instead of getting the lexical global from ExecState.
Removed an old FIXME that no longer applies since JSObjects can
always find the right global object these days.

Reviewed by Geoff Garen.

* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJS):
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
* bindings/js/JSCSSValueCustom.cpp:
(WebCore::toJS):
* bindings/js/JSDOMBinding.h:
(WebCore::createWrapper):
(WebCore::wrap):
(WebCore::getExistingWrapper):
(WebCore::createNewWrapper):
(WebCore::toJS):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setTimeout):
(WebCore::JSDOMWindow::setInterval):
(WebCore::JSDOMWindow::addEventListener):
(WebCore::JSDOMWindow::removeEventListener):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::location):
(WebCore::toJS):
* bindings/js/JSElementCustom.cpp:
(WebCore::toJSNewlyCreated):
* bindings/js/JSEventCustom.cpp:
(WebCore::toJS):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::toJS):
* bindings/js/JSHTMLTemplateElementCustom.cpp:
(WebCore::JSHTMLTemplateElement::content):
* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJS):
* bindings/js/JSNodeCustom.cpp:
(WebCore::createWrapperInline):
* bindings/js/JSNodeCustom.h:
(WebCore::toJS):
* bindings/js/JSSVGPathSegCustom.cpp:
(WebCore::toJS):
* bindings/js/JSStyleSheetCustom.cpp:
(WebCore::toJS):
* bindings/js/JSTextTrackCueCustom.cpp:
(WebCore::toJS):
* bindings/js/JSTrackCustom.cpp:
(WebCore::toJS):
* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::setTimeout):
(WebCore::JSWorkerGlobalScope::setInterval):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Improving webkitGetUserMedia error handling and error messages
https://bugs.webkit.org/show_bug.cgi?id=130452

Reviewed by Eric Carlson.

Checking if first argument of webkitGetUserMedia is a valid Dictionary. If not, throw an exception with a
clearer message of the error.

Source/WebCore:

Test updated.

* Modules/mediastream/NavigatorMediaStream.idl:
* UseJSC.cmake:
* bindings/js/JSNavigatorCustom.cpp: Added.

LayoutTests:

* fast/mediastream/argument-types-expected.txt:
* fast/mediastream/script-tests/argument-types.js:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make Remote Control commands testable
https://bugs.webkit.org/show_bug.cgi?id=130358

Reviewed by Jer Noble.

Source/WebCore:

Test: media/video-remote-control-playpause.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Call session->clientWillPausePlayback.
(WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Log the command.

* platform/audio/MediaSession.cpp:
(WebCore::MediaSessionClient::mediaSessionTitle): Move from header file.
(WebCore::MediaSessionClient::mediaSessionDuration): Ditto.
(WebCore::MediaSessionClient::mediaSessionCurrentTime): Ditto.
* platform/audio/MediaSession.h:

* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::MediaSessionManager): Get rid of m_activeSession.
(WebCore::MediaSessionManager::removeSession): No need to clear m_activeSession because
    we use the m_sessions vector.
(WebCore::MediaSessionManager::sessionWillBeginPlayback): setCurrentSession takes a
    MediaSession&.
(WebCore::MediaSessionManager::sessionWillEndPlayback): Keep m_sessions sorted so playing
    sessions are before paused sessions.
(WebCore::MediaSessionManager::setCurrentSession): Move the session that is beginning to
    play to the head of m_sessions.
(WebCore::MediaSessionManager::currentSession): Return m_sessions[0] or nullptr.
(WebCore::MediaSessionManager::didReceiveRemoteControlCommand):
* platform/audio/MediaSessionManager.h:

* platform/audio/ios/MediaSessionManagerIOS.mm: Include MediaPlayer.h.

* testing/Internals.cpp:
(WebCore::Internals::postRemoteControlCommand): New.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/video-remote-control-playpause-expected.txt: Added.
* media/video-remote-control-playpause.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac][EME] Query whether decoder support exists before creating a new MediaKeys object.
https://bugs.webkit.org/show_bug.cgi?id=130459

Reviewed by Eric Carlson.

Source/WebCore:

* WebCore.exp.in: Export the new WCSI method.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsKeySystem): Bail early if we have no decoder support.
* platform/mac/WebCoreSystemInterface.h: Provide a WCSI wrapper for WKSI.
* platform/mac/WebCoreSystemInterface.mm: Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Initialize the new WCSI method.

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Initialize the new WCSI method.

WebKitLibraries:

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceMavericks.a:
* libWebKitSystemInterfaceMountainLion.a:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165917 268f45cc-cd09-0410-ab3c-d52691b4dbfc