Allow MediaSessionManager to restrict 'preload' behavior
https://bugs.webkit.org/show_bug.cgi?id=127297

Reviewed by Jer Noble.

Source/WebCore: 

Tests: media/video-restricted-no-preload-auto.html
       media/video-restricted-no-preload-metadata.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute): Apply restrictions to preload attribute before
    passing to media engine.
(WebCore::HTMLMediaElement::loadResource): Ditto.

* html/HTMLMediaSession.cpp:
(WebCore::HTMLMediaSession::effectivePreloadForElement): New, limit preload according to restrictions.
* html/HTMLMediaSession.h:

* platform/audio/MediaSessionManager.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::resetRestrictions): Limit preload to metadata only. Drive-by
    static deviceClass initialization cleanup.

* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Support MetadataPreloadingNotPermitted and
    AutoPreloadingNotPermitted.

LayoutTests: 

* media/video-restricted-no-preload-auto-expected.txt: Added.
* media/video-restricted-no-preload-auto.html: Added.
* media/video-restricted-no-preload-metadata-expected.txt: Added.
* media/video-restricted-no-preload-metadata.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix jumping to a text position when showing a resource.

https://bugs.webkit.org/show_bug.cgi?id=127271

Reviewed by Joseph Pecoraro.

* UserInterface/FrameContentView.js:
(WebInspector.FrameContentView.prototype.showSourceCode): Just use showResponse's arguments
which already does the same logic to call revealPosition.
* UserInterface/ResourceClusterContentView.js:
(WebInspector.ResourceClusterContentView.prototype.restoreFromCookie): This was the bug.
lineNumber and columnNumber need honored here. They were only honored by FrameContentView.
* UserInterface/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype.showSourceCode): Use showContentViewForRepresentedObject
which also accepts a cookie and handles creating the content view for us.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Stop using ThreadCondition in BlockAllocator
https://bugs.webkit.org/show_bug.cgi?id=126313

Reviewed by Sam Weinig.

* heap/BlockAllocator.cpp:
(JSC::BlockAllocator::~BlockAllocator):
(JSC::BlockAllocator::waitForDuration):
(JSC::BlockAllocator::blockFreeingThreadMain):
* heap/BlockAllocator.h:
(JSC::BlockAllocator::deallocate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update style checker and tests to deal with override instead of OVERRIDE
https://bugs.webkit.org/show_bug.cgi?id=127175

Reviewed by Anders Carlsson.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_braces): Use override instead of OVERRIDE.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_brace_at_begin_of_line): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Region based multicol: support explicit column breaks
https://bugs.webkit.org/show_bug.cgi?id=123993

Patch by Morten Stenshorne <mstensho@opera.com> on 2014-01-20
Reviewed by David Hyatt.

Source/WebCore:

Merely supporting insertion of explicit (forced) column breaks in
the region based multicol implementation is really simple: just
hook up with what the CSS regions code is already doing.

However, there is one complication: column balancing. In order to
balance columns as nicely as possible when there are explicit
breaks, we need to figure out between which explicit breaks the
implicit breaks will occur (if there's room for any at all).

Tests: fast/multicol/newmulticol/break-after.html
       fast/multicol/newmulticol/break-before.html
       fast/multicol/newmulticol/breaks-2-columns-3-no-balancing.html
       fast/multicol/newmulticol/breaks-2-columns-3.html
       fast/multicol/newmulticol/breaks-3-columns-3.html
       fast/multicol/newmulticol/fixed-height-fill-balance-2.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::applyBeforeBreak):
(WebCore::RenderBlockFlow::applyAfterBreak): Use the already
existing region breaking code when inserting breaks in region
based multicol.
* rendering/RenderFlowThread.h:
* rendering/RenderMultiColumnBlock.cpp:
(WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock):
(WebCore::RenderMultiColumnBlock::relayoutForPagination): Avoid
re-balancing if the multicol's contents were not laid out. Apart
from being good for performance, this is now necessary because of
how explicit breaks are implemented.
(WebCore::RenderMultiColumnBlock::layoutSpecialExcludedChild):
Detect if the contents are going to be laid out, or skipped, so
that we can tell if we need to (re-)balance the columns
afterwards.
* rendering/RenderMultiColumnBlock.h:
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::addForcedRegionBreak):
Locate the appropriate multi-column set and call its
addForcedBreak().
* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
(WebCore::RenderMultiColumnSet::findRunWithTallestColumns):
(WebCore::RenderMultiColumnSet::distributeImplicitBreaks): Figure
out how many implicit breaks each single "content run" should
contain. The taller the content run, the more implicit breaks.
(WebCore::RenderMultiColumnSet::calculateBalancedHeight): This is
now a const method that only does half of what the old
calculateBalancedHeight() did. The rest (such as actually storing
the new column height) is done by recalculateBalancedHeight().
(WebCore::RenderMultiColumnSet::clearForcedBreaks): Needs to be
called between each layout pass, to clear the list of "content
runs".
(WebCore::RenderMultiColumnSet::addForcedBreak): Only useful when
columns are to be balanced. It receives explicit (forced) breaks
and stores them as "content runs". When layout is done, we'll go
through the list of content runs, and see where implicit breaks
should be inserted (if there's room for any). The goal is to
insert implicit breaks in such a way that the final columns become
as short as possible.
(WebCore::RenderMultiColumnSet::recalculateBalancedHeight):
Calculates and sets a new balanced column height. This used to be
done directly in calculateBalancedHeight(), but that method is now
const and it now only calculates the new height and returns it.
(WebCore::RenderMultiColumnSet::prepareForLayout):
* rendering/RenderMultiColumnSet.h: Remove old data members
intended for forced breaks (they were unused), and introduce a
"content run" vector instead. A new content run is triggered by an
explicit break. This is only used when column balancing is
enabled. When not balanced, RenderMultiColumnSet doesn't need to
do anything when explicit breaks are inserted.

LayoutTests:

* fast/multicol/newmulticol/break-after-expected.html: Added.
* fast/multicol/newmulticol/break-after.html: Added.
* fast/multicol/newmulticol/break-before-expected.html: Added.
* fast/multicol/newmulticol/break-before.html: Added.
* fast/multicol/newmulticol/breaks-2-columns-3-expected.html: Added.
* fast/multicol/newmulticol/breaks-2-columns-3-no-balancing-expected.html: Added.
* fast/multicol/newmulticol/breaks-2-columns-3-no-balancing.html: Added.
* fast/multicol/newmulticol/breaks-2-columns-3.html: Added.
* fast/multicol/newmulticol/breaks-3-columns-3-expected.html: Added.
* fast/multicol/newmulticol/breaks-3-columns-3.html: Added.
* fast/multicol/newmulticol/fixed-height-fill-balance-2-expected.html: Added.
* fast/multicol/newmulticol/fixed-height-fill-balance-2.html: Added.

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

* heap/BlockAllocator.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move WebAudio source code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=127274

Reviewed by Eric Carlson.

Move from using OwnPtr and PassOwnPtr to using std::unique_ptr and move semantics
in the WebAudio module and the WebAudio code in the platform layer.

* Modules/webaudio/AsyncAudioDecoder.cpp:
* Modules/webaudio/AsyncAudioDecoder.h:
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
* Modules/webaudio/AudioBasicProcessorNode.cpp:
(WebCore::AudioBasicProcessorNode::AudioBasicProcessorNode):
* Modules/webaudio/AudioBasicProcessorNode.h:
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::AudioBufferSourceNode):
* Modules/webaudio/AudioContext.cpp:
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::AudioDestinationNode):
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::addInput):
(WebCore::AudioNode::addOutput):
(WebCore::AudioNode::checkNumberOfChannelsForInput):
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/BiquadFilterNode.cpp:
(WebCore::BiquadFilterNode::BiquadFilterNode):
* Modules/webaudio/BiquadProcessor.cpp:
(WebCore::BiquadProcessor::createKernel):
(WebCore::BiquadProcessor::getFrequencyResponse):
* Modules/webaudio/BiquadProcessor.h:
* Modules/webaudio/ChannelMergerNode.cpp:
(WebCore::ChannelMergerNode::ChannelMergerNode):
* Modules/webaudio/ChannelSplitterNode.cpp:
(WebCore::ChannelSplitterNode::ChannelSplitterNode):
* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::ConvolverNode):
(WebCore::ConvolverNode::uninitialize):
(WebCore::ConvolverNode::setBuffer):
* Modules/webaudio/ConvolverNode.h:
* Modules/webaudio/DefaultAudioDestinationNode.h:
* Modules/webaudio/DelayNode.cpp:
(WebCore::DelayNode::DelayNode):
* Modules/webaudio/DelayProcessor.cpp:
(WebCore::DelayProcessor::createKernel):
* Modules/webaudio/DelayProcessor.h:
* Modules/webaudio/DynamicsCompressorNode.cpp:
(WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
(WebCore::DynamicsCompressorNode::initialize):
(WebCore::DynamicsCompressorNode::uninitialize):
* Modules/webaudio/DynamicsCompressorNode.h:
* Modules/webaudio/GainNode.cpp:
(WebCore::GainNode::GainNode):
* Modules/webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
(WebCore::MediaElementAudioSourceNode::setFormat):
* Modules/webaudio/MediaElementAudioSourceNode.h:
* Modules/webaudio/MediaStreamAudioDestinationNode.h:
* Modules/webaudio/MediaStreamAudioSource.cpp:
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
* Modules/webaudio/MediaStreamAudioSourceNode.h:
* Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::OscillatorNode):
* Modules/webaudio/PannerNode.cpp:
(WebCore::PannerNode::PannerNode):
(WebCore::PannerNode::uninitialize):
(WebCore::PannerNode::setPanningModel):
* Modules/webaudio/PannerNode.h:
* Modules/webaudio/PeriodicWave.cpp:
(WebCore::PeriodicWave::createBandLimitedTables):
* Modules/webaudio/PeriodicWave.h:
* Modules/webaudio/RealtimeAnalyser.cpp:
(WebCore::RealtimeAnalyser::RealtimeAnalyser):
(WebCore::RealtimeAnalyser::setFftSize):
* Modules/webaudio/RealtimeAnalyser.h:
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::ScriptProcessorNode):
* Modules/webaudio/WaveShaperDSPKernel.cpp:
(WebCore::WaveShaperDSPKernel::lazyInitializeOversampling):
* Modules/webaudio/WaveShaperDSPKernel.h:
* Modules/webaudio/WaveShaperNode.cpp:
(WebCore::WaveShaperNode::WaveShaperNode):
* Modules/webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::createKernel):
* Modules/webaudio/WaveShaperProcessor.h:
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::AudioBus):
(WebCore::AudioBus::copyWithGainFrom):
* platform/audio/AudioBus.h:
* platform/audio/AudioChannel.cpp:
* platform/audio/AudioChannel.h:
(WebCore::AudioChannel::AudioChannel):
(WebCore::AudioChannel::set):
* platform/audio/AudioDSPKernelProcessor.h:
* platform/audio/AudioDestination.h:
* platform/audio/AudioResampler.cpp:
(WebCore::AudioResampler::AudioResampler):
(WebCore::AudioResampler::configureChannels):
* platform/audio/AudioResampler.h:
* platform/audio/AudioSession.h:
* platform/audio/DynamicsCompressor.cpp:
(WebCore::DynamicsCompressor::setNumberOfChannels):
* platform/audio/DynamicsCompressor.h:
* platform/audio/DynamicsCompressorKernel.cpp:
(WebCore::DynamicsCompressorKernel::setNumberOfChannels):
* platform/audio/DynamicsCompressorKernel.h:
* platform/audio/FFTFrame.cpp:
(WebCore::FFTFrame::createInterpolatedFrame):
* platform/audio/FFTFrame.h:
* platform/audio/HRTFDatabase.cpp:
(WebCore::HRTFDatabase::HRTFDatabase):
* platform/audio/HRTFDatabase.h:
* platform/audio/HRTFDatabaseLoader.cpp:
(WebCore::HRTFDatabaseLoader::~HRTFDatabaseLoader):
(WebCore::HRTFDatabaseLoader::load):
* platform/audio/HRTFDatabaseLoader.h:
* platform/audio/HRTFElevation.cpp:
(WebCore::HRTFElevation::createForSubject):
(WebCore::HRTFElevation::createByInterpolatingSlices):
* platform/audio/HRTFElevation.h:
(WebCore::HRTFElevation::HRTFElevation):
* platform/audio/HRTFKernel.cpp:
(WebCore::HRTFKernel::HRTFKernel):
(WebCore::HRTFKernel::createImpulseResponse):
(WebCore::HRTFKernel::createInterpolatedKernel):
* platform/audio/HRTFKernel.h:
(WebCore::HRTFKernel::create):
(WebCore::HRTFKernel::HRTFKernel):
* platform/audio/MultiChannelResampler.cpp:
(WebCore::MultiChannelResampler::MultiChannelResampler):
* platform/audio/MultiChannelResampler.h:
* platform/audio/Panner.cpp:
(WebCore::Panner::create):
* platform/audio/Panner.h:
* platform/audio/Reverb.cpp:
(WebCore::Reverb::initialize):
* platform/audio/Reverb.h:
* platform/audio/ReverbConvolver.h:
* platform/audio/ReverbConvolverStage.cpp:
(WebCore::ReverbConvolverStage::ReverbConvolverStage):
* platform/audio/ReverbConvolverStage.h:
* platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::AudioDestination::create):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestination::create):
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::AudioSession):
* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestination::create):
* platform/audio/mac/AudioDestinationMac.h:
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::AudioSession):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Run clang-modernize and let it add a bunch of missing overrides in WebCore/inspector
https://bugs.webkit.org/show_bug.cgi?id=127206

Reviewed by Anders Carlsson.

Let clang-modernize add overrides.

* inspector/DOMEditor.cpp:
* inspector/InspectorApplicationCacheAgent.h:
* inspector/InspectorCSSAgent.h:
* inspector/InspectorCanvasAgent.h:
* inspector/InspectorConsoleAgent.h:
* inspector/InspectorDOMAgent.h:
* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorDOMStorageAgent.h:
* inspector/InspectorDatabaseAgent.cpp:
* inspector/InspectorDatabaseAgent.h:
* inspector/InspectorDebuggerAgent.h:
* inspector/InspectorFrontendHost.cpp:
* inspector/InspectorHeapProfilerAgent.cpp:
(WebCore::InspectorHeapProfilerAgent::getHeapSnapshot):
(WebCore::InspectorHeapProfilerAgent::takeHeapSnapshot):
* inspector/InspectorHeapProfilerAgent.h:
* inspector/InspectorHistory.cpp:
* inspector/InspectorIndexedDBAgent.cpp:
* inspector/InspectorIndexedDBAgent.h:
* inspector/InspectorInputAgent.h:
* inspector/InspectorLayerTreeAgent.h:
* inspector/InspectorMemoryAgent.h:
* inspector/InspectorPageAgent.h:
* inspector/InspectorProfilerAgent.cpp:
* inspector/InspectorProfilerAgent.h:
* inspector/InspectorResourceAgent.h:
* inspector/InspectorRuntimeAgent.h:
* inspector/InspectorStyleSheet.h:
* inspector/InspectorTimelineAgent.h:
* inspector/InspectorWorkerAgent.cpp:
* inspector/InspectorWorkerAgent.h:
* inspector/PageConsoleAgent.h:
* inspector/PageDebuggerAgent.h:
* inspector/PageRuntimeAgent.h:
* inspector/WorkerConsoleAgent.h:
* inspector/WorkerDebuggerAgent.cpp:
* inspector/WorkerInspectorController.cpp:
* inspector/WorkerRuntimeAgent.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][WK2] Move the rest of GTK's WorkQueue implementation to std::function
https://bugs.webkit.org/show_bug.cgi?id=127273

Reviewed by Anders Carlsson.

Move to using std::function and move semantics in WorkQueue::registerSocketEventHandler
and WorkQueue::SocketEventSource.

* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::open):
* Platform/WorkQueue.h:
* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::SocketEventSource::SocketEventSource):
(WorkQueue::registerSocketEventHandler):
(WorkQueue::dispatchOnSource): Use std::move instead of std::forward<T>.
(WorkQueue::dispatch): Ditto.
(WorkQueue::dispatchAfter): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix webkitpy tests.

* Scripts/webkitpy/common/net/web_mock.py: (MockBrowser.set_handle_robots):
Added a mock implementation, as we now call this function.



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