[GTK] Expose WebKitFrame in WebKit2GTK+ web extensions API
https://bugs.webkit.org/show_bug.cgi?id=119743

Reviewed by Anders Carlsson.

Source/WebKit2:

* GNUmakefile.list.am: Add new files to compilation.
* Shared/APIClientTraits.cpp: Update for new interface version.
* Shared/APIClientTraits.h: Ditto.
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add WebKitFrame
section.
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new public
symbols.
* UIProcess/API/gtk/docs/webkit2gtk.types: Add
webkit_frame_get_type.
* UIProcess/API/gtk/tests/FrameTest.cpp: Added.
(WebKitFrameTest::create):
(WebKitFrameTest::webPageFromArgs):
(WebKitFrameTest::testMainFrame):
(WebKitFrameTest::testURI):
(WebKitFrameTest::testJavaScriptContext):
(WebKitFrameTest::runTest):
(registerTests):
* UIProcess/API/gtk/tests/GNUmakefile.am: Add new test files.
* UIProcess/API/gtk/tests/TestFrame.cpp: Added.
(webkitFrameTestRun):
(testWebKitFrameMainFrame):
(testWebKitFrameURI):
(testWebKitFrameJavaScriptContext):
(beforeAll):
(afterAll):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h: Add
willDestroyFrame callback to the injected bundle loader client, to
notify the client when a frame is about to be destroyed.
* WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp: Added.
(webkit_frame_class_init):
(webkitFrameCreate):
(webkit_frame_is_main_frame):
(webkit_frame_get_uri):
(webkit_frame_get_javascript_global_context):
* WebProcess/InjectedBundle/API/gtk/WebKitFrame.h: Added.
* WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h: Added.
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
(webkitFrameGetOrCreate): Helper function to create a WebKitFrame
wrapping the given WebFrame or returning the wrapper if it already
exists.
(willDestroyFrame): Remove the WebKitFrame wrapping the given
WebFrame if it exists.
(webkitWebPageCreate): Add willDestroyFrame implementation to
injected bundle loader client.
(webkit_web_page_get_main_frame): Return the main frame of the
page.
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h:
* WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h:
Include WebKitFrame.h.
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::willDestroyFrame): New
callback to be called when a frame is about to be destroyed.
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::frameLoaderDestroyed): Call
willDestroyFrame callback of injected bundle loader client.
* WebProcess/qt/QtBuiltinBundlePage.cpp:
(WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage): Add
willDestroyFrame callback.

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage): Add
willDestroyFrame.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK L10N] Updated Brazilian Portuguese translation for WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=120193

Patch by Enrico Nicoletto <liverig@gmail.com> on 2013-08-26
Reviewed by Gustavo Noronha Silva.

* pt_BR.po: Updated.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Allow to run tests without Xvfb in run-gtk-tests
https://bugs.webkit.org/show_bug.cgi?id=120298

Reviewed by Philippe Normand.

Add --no-xvfb command line option to run tests in the current
display.

* Scripts/run-gtk-tests:
(TestRunner._run_xvfb): Return early if option --no-xvfb has been
passed.
(TestRunner._setup_testing_environment): Use helper function
_run_xvfb to start Xvfb if needed.
(TestRunner._tear_down_testing_environment): Check Xvfb is
actually running before trying to terminate it.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Volume slider shows incorrect track when muted
https://bugs.webkit.org/show_bug.cgi?id=120253

Reviewed by Philippe Normand.

When painting the volume bar, consider that it could be muted even
then volume is different than zero.

* platform/gtk/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::paintMediaVolumeSliderTrack): Asign
painted volume as 0 when media is muted.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154666 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Fix GTK+ build after r154601.

* TestWebKitAPI/GNUmakefile.am: Remove mac specific file from
compilation added by mistake in r154601.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[l10n] Updated Polish translation of WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=119986

Patch by Piotr Drąg <piotrdrag@gmail.com> on 2013-08-27
Reviewed by Gustavo Noronha Silva.

* pl.po: updated.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[gstreamer] Make sure gstreamer source element is thread-safe
https://bugs.webkit.org/show_bug.cgi?id=115352

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-08-27
Reviewed by Philippe Normand.

Source/WebCore:

GStreamer source element may be created by any gstreamer element on any thread by calling
gst_element_make_from_uri with the URIs handled by the source element.
This patch makes sure the gstreamer source element is thread-safe to avoid issues with it
being created outside the main thread.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webkit_web_src_init):
(webKitWebSrcDispose):
(webKitWebSrcFinalize):
(webKitWebSrcSetProperty):
(webKitWebSrcGetProperty):
(removeTimeoutSources):
(webKitWebSrcStop):
(webKitWebSrcStart):
(webKitWebSrcChangeState):
(webKitWebSrcQueryWithParent):
(webKitWebSrcGetUri):
(webKitWebSrcSetUri):
(webKitWebSrcNeedDataMainCb):
(webKitWebSrcNeedDataCb):
(webKitWebSrcEnoughDataMainCb):
(webKitWebSrcEnoughDataCb):
(webKitWebSrcSeekMainCb):
(webKitWebSrcSeekDataCb):
(webKitWebSrcSetMediaPlayer):
(StreamingClient::StreamingClient):
(StreamingClient::~StreamingClient):
(StreamingClient::createReadBuffer):
(StreamingClient::handleResponseReceived):
(StreamingClient::handleDataReceived):
(StreamingClient::handleNotifyFinished):
(CachedResourceStreamingClient::CachedResourceStreamingClient):
(CachedResourceStreamingClient::~CachedResourceStreamingClient):
(CachedResourceStreamingClient::loadFailed):
(CachedResourceStreamingClient::setDefersLoading):
(CachedResourceStreamingClient::getOrCreateReadBuffer):
(CachedResourceStreamingClient::responseReceived):
(CachedResourceStreamingClient::dataReceived):
(CachedResourceStreamingClient::notifyFinished):
(ResourceHandleStreamingClient::ResourceHandleStreamingClient):
(ResourceHandleStreamingClient::~ResourceHandleStreamingClient):
(ResourceHandleStreamingClient::loadFailed):
(ResourceHandleStreamingClient::setDefersLoading):
(ResourceHandleStreamingClient::getOrCreateReadBuffer):
(ResourceHandleStreamingClient::willSendRequest):
(ResourceHandleStreamingClient::didReceiveResponse):
(ResourceHandleStreamingClient::didReceiveData):
(ResourceHandleStreamingClient::didFinishLoading):
(ResourceHandleStreamingClient::didFail):
(ResourceHandleStreamingClient::wasBlocked):
(ResourceHandleStreamingClient::cannotShowURL):
Make element thread-safe, add support to use the element without a player associated (e.g.
the DASH plugin using the webkitsrc to download fragments), use GMutexLocker to simplify
locks and other general improvements.

Source/WTF:

Add convenience class that simplifies locking and unlocking a GMutex.

* GNUmakefile.list.am:
* wtf/gobject/GMutexLocker.h: Added.
(WebCore::GMutexLocker::GMutexLocker):
(WebCore::GMutexLocker::~GMutexLocker):
(WebCore::GMutexLocker::lock):
(WebCore::GMutexLocker::unlock):
(WebCore::GMutexLocker::mutex):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][WK2] Disable accelerated compositing under Wayland
https://bugs.webkit.org/show_bug.cgi?id=120347

Reviewed by Martin Robinson.

Accelerated compositing is not yet supported under the Wayland display protocol,
so it should be disabled. Since it is enabled by default and the GTK WK2 API does
not provide any way to change that, it's enough to disable it when attaching the
WebKitSettings object to the WebPageGroup if running under Wayland.

* UIProcess/API/gtk/WebKitWebViewGroup.cpp:
(webkitWebViewGroupAttachSettingsToPageGroup):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][WK2] Only set up a RedirectedXCompositeWindow if running under an X11 display
https://bugs.webkit.org/show_bug.cgi?id=120321

Reviewed by Gustavo Noronha Silva.

Only set up the RedirectedXCompositeWindow member of the WebKitWebViewBasePrivate struct
if we're running under an X11 display. This is now done in the webkitWebViewBaseConstructed
function rather than the constructor, which is removed.

This allows for the UIProcess to run in a Wayland environment even when built with accelerated
compositing enabled. Of course, at the moment there's no support yet for accelerated compositing
under Wayland, so we fall back to rendering the backing store. No changes are introduced to
the behavior under X11 - accelerated compositing will be used where possible, if supported.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseConstructed):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] HTMLElement lost setID and getID - need to add compatibility symbols
https://bugs.webkit.org/show_bug.cgi?id=120440

Reviewed by Martin Robinson.

No tests, just adding compatibility symbols.

setID and getID were removed, and the parent class (Element) ones should be used instead.
We need to keep our ABI compatible, though, so add compatibility symbols.

* bindings/gobject/WebKitDOMCustom.cpp:
(webkit_dom_html_element_get_id):
(webkit_dom_html_element_set_id):
* bindings/gobject/WebKitDOMCustom.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Enable maintainer mode configure switch
https://bugs.webkit.org/show_bug.cgi?id=120424

Reviewed by Martin Robinson.

The maintainer mode feature is used by ostree and other automated builders to ensure no autotools
regeneration will happen for a regular tarball build; ostree builders, for instance, are very
conservative with toolchain upgrades, and are still using aclocal 1.12. WebKit's latest tarball
(2.1.90) for some reason tries to regenerate build files, and the build fails because it can't find
the version of aclocal that was used for generating the tarball (1.13).

* configure.ac: enable maintainer mode feature.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Please incorporate German translation update
https://bugs.webkit.org/show_bug.cgi?id=120016

Patch by Christian Kirbach <Christian.Kirbach@googlemail.com> on 2013-08-28
Reviewed by Gustavo Noronha.

* de.po: updated.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix - copy/paste failure, copied too much.

* bindings/gobject/WebKitDOMCustom.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] [WK2] TestWebKitWebView page-visibility fails
https://bugs.webkit.org/show_bug.cgi?id=120406

Patch by Brian Holt <brian.holt@samsung.com> on 2013-08-29
Reviewed by Gustavo Noronha Silva.

Removed the webkit prefix for document visibility properties.

* UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
(testWebViewPageVisibility):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Should enable WebGL by default on MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=120420

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-08-29
Reviewed by Gustavo Noronha Silva.

Enable WebGL by default on MiniBrowser.

* MiniBrowser/gtk/main.c:
(main):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Volume slider value should be 0 when audio is muted
https://bugs.webkit.org/show_bug.cgi?id=120553

Reviewed by Eric Carlson.

Source/WebCore:

Fixed the problem of showing a non empty slider when audio is
muted.

Test: media/volume-bar-empty-when-muted.html.

* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::reset): Use setSliderVolume.
(WebCore::MediaControls::changedVolume): Use setSliderVolume.
(WebCore::MediaControls::setSliderVolume): Added to set the volume
to 0 when muted and to its value otherwise.
* html/shadow/MediaControls.h: Added setSliderVolume.
* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::reset): Used setSliderVolume and
setFullscreenSliderVolume.
(WebCore::MediaControlsApple::changedVolume): Used
setFullscreenSliderVolume.
(WebCore::MediaControlsApple::setFullscreenSliderVolume): Added to
set the volume to 0 when muted and to its value otherwise.
* html/shadow/MediaControlsApple.h: Added setFullscreenSliderVolume
* html/shadow/MediaControlsBlackBerry.cpp:
(WebCore::MediaControlsBlackBerry::reset): Used setSliderVolume.

LayoutTests:

Added test to check if the volume slider value is 0 when the
element is muted even if volume is set to something else.

* media/volume-bar-empty-when-muted-expected.txt: Added.
* media/volume-bar-empty-when-muted.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer] Video player sets system volume to 100%
https://bugs.webkit.org/show_bug.cgi?id=118974

Reviewed by Philippe Normand.

In order to preserve the system volume we need to keep track of
the volume being initialized in the HTMLMediaElement and then just
setting the volume to the sink when initializing the pipeline if
that volume was changed before.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialized
attribute to false.
(WebCore::HTMLMediaElement::setVolume): Set the attribute to true
when volume is changed.
(WebCore::HTMLMediaElement::updateVolume): Set the volume only if
volume was initialized.
(WebCore::HTMLMediaElement::mediaPlayerPlatformVolumeConfigurationRequired):
Platform volume configuration is required only if volume was not
initialized before.
* html/HTMLMediaElement.h: Added attribute and interface method.
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerPlatformVolumeConfigurationRequired):
Declared and added default implementation for the interface method.
(WebCore::MediaPlayer::platformVolumeConfigurationRequired):
Asked the client, meaning the HTMLMediaElement if the platform
volume configuration is required.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::mediaPlayerPrivateVolumeChangedCallback): Added log.
(WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Added log.
(WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
Set the volume only if not platform volume is required and added log.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[gstreamer] Disable HTTP request "Accept-Encoding:" header field on gstreamer source element to avoid receiving the wrong size when retrieving data
https://bugs.webkit.org/show_bug.cgi?id=115354

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-09-03
Reviewed by Philippe Normand.

Source/WebCore:

Also disable Accept-Encoding on ResourceRequest::toSoupMessage accordingly.

* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::toSoupMessage):
Call ResourceRequest::updateSoupMessage from ResourceRequest::toSoupMessage so that the
Accept-Encoding header is also respected.

LayoutTests:

Add test to check that video requests will send no "Accept-Encoding" header.

* http/tests/media/video-accept-encoding-expected.txt: Added.
* http/tests/media/video-accept-encoding.cgi: Added.
* http/tests/media/video-accept-encoding.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] [WK2] TestContextMenu default-menu fails
https://bugs.webkit.org/show_bug.cgi?id=120459

Patch by Brian Holt <brian.holt@samsung.com> on 2013-09-03
Reviewed by Gustavo Noronha Silva.

Add context menu items for downloading media elements.

* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/API/gtk/WebKitContextMenuActions.h:
* UIProcess/API/gtk/tests/TestContextMenu.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer] Don't set state to NULL until element is destroyed
https://bugs.webkit.org/show_bug.cgi?id=117354

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-09-03
Reviewed by Philippe Normand.

Don't set playbin to NULL until it is going to be destroyed or if we stay
for too long on the READY state. Instead only set the state to READY as this
allows much faster state changes to PAUSED/PLAYING again. playbin internally
caches some state that is destroyed when setting it to NULL.
This state is independent of the URI and it is even possible to change the
URI in READY state.

To avoid having resources (e.g. audio devices) open indefinitely,
when setting the state to READY we create a timeout and if the timeout
is reached we reset the pipeline state to NULL to free resources.

Also now all state changes use the changePipelineState method instead of setting
the playbin state directly with gst_element_set_state, so we have a better control
of when we are requesting state changes.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::mediaPlayerPrivateReadyStateTimeoutCallback):
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::commitLoad):
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
(WebCore::MediaPlayerPrivateGStreamer::setRate):
(WebCore::MediaPlayerPrivateGStreamer::handlePluginInstallerResult):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

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

Conflicts:
	Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp