Introduce Promise A+ tests into WebKit
https://bugs.webkit.org/show_bug.cgi?id=136878

Reviewed by Sam Weinig.

To ensure WebKit Promise stability, introducing Promise A+ tests[1] into WebKit.
It's also used to test V8 Promise[2].
So the tests guarantee that WebKit Promise's spec validity and interchangeability
to the other browser's Promise implementation.

Promise A+ tests assumes that it works on the Node.js environment. To work it on
LayoutTests correctly, we need to transform Node.js styled JavaScript code into
browser styled code. In this patch, we use browserify[3] to transform the test code.
Through transforming pipeline, some dependent JS code is bundled into the produced code.
So added SinonJS[4] and browserify's license files into the test directory.

And tests assume that it is used with Mocha[5] test runner. So introducing mocha.js and
added LICENSE file into this directory.

And since Promises/A+ 2.3.3 has many tests, it consumes much time (13s in GTK debug build).
So mark it as a Slow test.

[1]: https://github.com/promises-aplus/promises-tests
[2]: https://code.google.com/p/v8/source/browse#svn%2Ftrunk%2Ftest%2Fpromises-aplus
[3]: http://browserify.org/
[4]: http://sinonjs.org/
[5]: http://visionmedia.github.io/mocha/

* TestExpectations:
* js/promises-tests/README: Added.
* js/promises-tests/browserify-entry-point.js: Added.
(.):
* js/promises-tests/browserify.LICENSE: Added.
* js/promises-tests/mocha.LICENSE: Added.
* js/promises-tests/promises-tests-2-1-2-expected.txt: Added.
* js/promises-tests/promises-tests-2-1-2.html: Added.
* js/promises-tests/promises-tests-2-1-3-expected.txt: Added.
* js/promises-tests/promises-tests-2-1-3.html: Added.
* js/promises-tests/promises-tests-2-2-1-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-1.html: Added.
* js/promises-tests/promises-tests-2-2-2-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-2.html: Added.
* js/promises-tests/promises-tests-2-2-3-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-3.html: Added.
* js/promises-tests/promises-tests-2-2-4-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-4.html: Added.
* js/promises-tests/promises-tests-2-2-5-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-5.html: Added.
* js/promises-tests/promises-tests-2-2-6-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-6.html: Added.
* js/promises-tests/promises-tests-2-2-7-expected.txt: Added.
* js/promises-tests/promises-tests-2-2-7.html: Added.
* js/promises-tests/promises-tests-2-3-1-expected.txt: Added.
* js/promises-tests/promises-tests-2-3-1.html: Added.
* js/promises-tests/promises-tests-2-3-2-expected.txt: Added.
* js/promises-tests/promises-tests-2-3-2.html: Added.
* js/promises-tests/promises-tests-2-3-3-expected.txt: Added.
* js/promises-tests/promises-tests-2-3-3.html: Added.
* js/promises-tests/promises-tests-2-3-4-expected.txt: Added.
* js/promises-tests/promises-tests-2-3-4.html: Added.
* js/promises-tests/promises-tests.LICENSE: Added.
* js/promises-tests/promises-tests.js: Added.
(.):
* js/promises-tests/promises-tests/.gitignore: Added.
* js/promises-tests/promises-tests/.jshintrc: Added.
* js/promises-tests/promises-tests/.npmignore: Added.
* js/promises-tests/promises-tests/LICENSE.txt: Added.
* js/promises-tests/promises-tests/README.md: Added.
* js/promises-tests/promises-tests/lib/cli.js: Added.
(getAdapterFilePath):
(adapterObjectFromFilePath):
* js/promises-tests/promises-tests/lib/getMochaOpts.js: Added.
(module.exports):
* js/promises-tests/promises-tests/lib/programmaticRunner.js: Added.
(normalizeAdapter.adapter.resolved):
(normalizeAdapter.adapter.rejected):
(normalizeAdapter):
(.cb):
(.):
(module.exports):
(module.exports.mocha):
* js/promises-tests/promises-tests/lib/tests/2.1.2.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.1.3.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.2.1.js: Added.
* js/promises-tests/promises-tests/lib/tests/2.2.2.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.2.3.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.2.4.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.2.5.js: Added.
* js/promises-tests/promises-tests/lib/tests/2.2.6.js: Added.
(.return.if):
(callbackAggregator):
(.):
* js/promises-tests/promises-tests/lib/tests/2.2.7.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.3.1.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/2.3.2.js: Added.
(.):
(testPromiseResolution):
* js/promises-tests/promises-tests/lib/tests/2.3.3.js: Added.
(.):
(testPromiseResolution):
(testCallingResolvePromiseRejectsWith):
(testCallingRejectPromiseRejectsWith):
(describe):
* js/promises-tests/promises-tests/lib/tests/2.3.4.js: Added.
(.):
* js/promises-tests/promises-tests/lib/tests/helpers/reasons.js: Added.
(exports.string_appeared_here):
(exports.string_appeared_here.return.then):
* js/promises-tests/promises-tests/lib/tests/helpers/testThreeCases.js: Added.
(.specify):
(.):
(exports.testFulfilled):
(exports.testRejected):
* js/promises-tests/promises-tests/lib/tests/helpers/thenables.js: Added.
(exports.fulfilled.string_appeared_here.return.then):
(exports.fulfilled.string_appeared_here):
(exports.fulfilled.string_appeared_here.):
(exports.fulfilled.get string_appeared_here.return.then):
(exports.fulfilled.get string_appeared_here):
(exports.rejected.string_appeared_here.return.then):
(exports.rejected.string_appeared_here):
(exports.rejected.string_appeared_here.):
(exports.rejected.get string_appeared_here.return.then):
(exports.rejected.get string_appeared_here):
* js/promises-tests/promises-tests/package.json: Added.
* js/promises-tests/promises-tests/test/getMochaOptsTest.js: Added.
* js/promises-tests/resources/adapter.js: Added.
(LayoutTestsReporter.runner):
(window.adapter.resolved):
(window.adapter.rejected):
(window.adapter.deferred):
* js/promises-tests/resources/mocha.js: Added.
(.):
* js/promises-tests/sinonjs.LICENSE: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[TexMap] Remove QDoc comments in GraphicsLayerTextureMapper
https://bugs.webkit.org/show_bug.cgi?id=137264

Reviewed by Andreas Kling.

Remove all the QDoc comments in the class that were
left over by the Qt port.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::setNeedsDisplay):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] generate-gtkdoc crashes when generating HTML due to encoding issues
https://bugs.webkit.org/show_bug.cgi?id=135502

Reviewed by Martin Robinson.

When writing to stdout/stderr fails due to a UnicodeDecodeError
exception, try again without encoding the output.

* gtk/gtkdoc.py:
(GTKDoc._run_command):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Do not generate webkit2gtk-tests-resources.gresource unconditionally
https://bugs.webkit.org/show_bug.cgi?id=137391

Reviewed by Martin Robinson.

Add a custom command to only re-generate
webkit2gtk-tests-resources.gresource when any of its dependencies changes.

* TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[TexMap] Clean up GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=137263

Reviewed by Darin Adler.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded): Clean up
the method a bit. When the backing store will not be in use the change mask
should only get updated if there was a backing store present beforehand.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174311 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Skip remaining failing media tests after adding audio devices to the bots.

* platform/win/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use is<>() / downcast<>() for CSS StyleProperties
https://bugs.webkit.org/show_bug.cgi?id=137398

Reviewed by Benjamin Poulain.

Use is<>() / downcast<>() for CSS StyleProperties subclasses.

No new tests, no behavior change.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::immutableCopyIfNeeded):
(WebCore::MutableStyleProperties::MutableStyleProperties):
(WebCore::StyleProperties::hasCSSOMWrapper):
* css/StyleProperties.h:
(WebCore::StyleProperties::PropertyReference::propertyMetadata):
(WebCore::StyleProperties::PropertyReference::propertyValue):
(WebCore::StyleProperties::propertyCount):
(WebCore::StyleProperties::deref):
(WebCore::StyleProperties::findPropertyIndex):
(isType):
(WebCore::toMutableStyleProperties): Deleted.
(WebCore::toImmutableStyleProperties): Deleted.
* css/StyleRule.cpp:
(WebCore::StyleRule::mutableProperties):
(WebCore::StyleRulePage::mutableProperties):
(WebCore::StyleRuleFontFace::mutableProperties):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::StyleKeyframe::mutableProperties):
* dom/StyledElement.cpp:
(WebCore::StyledElement::ensureMutableInlineStyle):
(WebCore::StyledElement::setInlineStyleFromString):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move DragController::createFragmentFromDragData implementation to the editor
https://bugs.webkit.org/show_bug.cgi?id=136819

Reviewed by Darin Adler.

Make Editor::webContentFromPasteboard() common to all ports and
add a implementation for every port.

* PlatformWin.cmake: Add new files to compilation.
* WebCore.vcxproj/WebCore.vcxproj: Ditto.
* editing/Editor.cpp:
(WebCore::Editor::pasteWithPasteboard): Move to EditorWin.cpp
since this is only used by windows port.
* editing/Editor.h:
* editing/efl/EditorEfl.cpp:
(WebCore::Editor::webContentFromPasteboard):
* editing/gtk/EditorGtk.cpp:
(WebCore::Editor::webContentFromPasteboard):
* editing/win/EditorWin.cpp: Added.
(WebCore::Editor::pasteWithPasteboard):
(WebCore::Editor::webContentFromPasteboard):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData): Use the editor instead of
createFragmentFromDragData() that has been removed. Also made this
method a static funtion again.
* page/DragController.h:
* page/efl/DragControllerEfl.cpp: Remove createFragmentFromDragData().
* page/gtk/DragControllerGtk.cpp: Ditto.
* page/mac/DragControllerMac.mm: Ditto.
* page/win/DragControllerWin.cpp: Ditto.
* platform/Pasteboard.h:
(WebCore::Pasteboard::dragDataMap): Add a getter for m_dragDataMap
as required by Editor::webContentFromPasteboard for windows.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make it possible to test page overlays
https://bugs.webkit.org/show_bug.cgi?id=137339

Reviewed by Dan Bernstein.

Tests: pageoverlay/overlay-installation.html
       pageoverlay/overlay-large-document-scrolled.html
       pageoverlay/overlay-large-document.html

Do some initial work to make page overlays testable.
There are many more tests to be written, but this lays the groundwork.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* WebCore.vcxproj/WebCoreTestSupport.vcxproj:
* WebCore.vcxproj/WebCoreTestSupport.vcxproj.filters:
* CMakeLists.txt:
Add MockPageOverlayClient.

* platform/graphics/GraphicsLayer.h:
* page/PageOverlayController.h:
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::shouldSkipLayerInDump):
Don't skip PageOverlayController-owned layers in the layer tree dump if the
layerTreeAsText behavior says that we should include them.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::dumpChildren):

* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::shouldSkipLayerInDump):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldSkipLayerInDump):
* rendering/RenderLayerBacking.h:
Pass the LayerTreeAsTextBehavior through shouldSkipLayerInDump.

* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
Uninstall all page overlays when resetting to a consistent state.

(WebCore::Internals::installMockPageOverlay):
(WebCore::Internals::pageOverlayLayerTreeAsText):
Expose two new internals functions.
installMockPageOverlay takes "view" or "document", allowing script
to choose the appropriate overlay type.
pageOverlayLayerTreeAsText dumps both view and document-relative
overlays, from each overlay container layer.

* testing/Internals.h:
* testing/Internals.idl:
Fix some typos.

* testing/MockPageOverlayClient.cpp: Added.
(WebCore::MockPageOverlayClient::shared):
(WebCore::MockPageOverlayClient::MockPageOverlayClient):
(WebCore::MockPageOverlayClient::installOverlay):
(WebCore::MockPageOverlayClient::uninstallAllOverlays):
(WebCore::MockPageOverlayClient::layerTreeAsText):
(WebCore::MockPageOverlayClient::pageOverlayDestroyed):
(WebCore::MockPageOverlayClient::willMoveToPage):
(WebCore::MockPageOverlayClient::didMoveToPage):
When the overlay is parented, mark it as needing repaint.
Future tests might want to test overlays without content,
but for now this is a reasonable default behavior.

(WebCore::MockPageOverlayClient::drawRect):
Paint the overlay rects as described in the LayoutTests ChangeLog.

(WebCore::MockPageOverlayClient::mouseEvent):
(WebCore::MockPageOverlayClient::didScrollFrame):
(WebCore::MockPageOverlayClient::copyAccessibilityAttributeStringValueForPoint):
(WebCore::MockPageOverlayClient::copyAccessibilityAttributeBoolValueForPoint):
(WebCore::MockPageOverlayClient::copyAccessibilityAttributeNames):

* testing/MockPageOverlayClient.h: Added.

* pageoverlay/overlay-installation.html: Added.
Add a test which just installs one view-relative and one document-relative
overlay, and dumps the layer tree and pixel results. The mock overlay
strokes a blue rectangle (inset a little from the overlay bounds) for
view-relative overlays, and a green rectangle (inset a bit more) for
document-relative overlays.

* pageoverlay/overlay-large-document.html: Added.
* pageoverlay/overlay-large-document-scrolled.html: Added.
Tests that do the same as the -installation test, but with a larger document;
the view-relative overlay should be the same size (or slightly smaller,
because we have scrollbars now), but the document-relative overlay should
be the size of the document. The second test scrolls to maxX, maxY, and
the document-relative overlay should scroll along with it, while the
view-relative overlay should remain fixed.

* pageoverlay/overlay-installation-expected.txt: Added.
* pageoverlay/overlay-large-document-expected.txt: Added.
* pageoverlay/overlay-large-document-scrolled-expected.txt: Added.
"Normal" layer tree expectations.

* platform/mac-wk1/pageoverlay/overlay-installation-expected.png: Added.
* platform/mac-wk1/pageoverlay/overlay-installation-expected.txt: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-expected.png: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-expected.txt: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.png: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.txt: Added.
Expected results for WebKit1 differ for view-relative overlays, because
we don't currently hook up view-relative overlays for WebKit1.

* platform/mac/pageoverlay/overlay-installation-expected.png: Added.
* platform/mac/pageoverlay/overlay-large-document-expected.png: Added.
* platform/mac/pageoverlay/overlay-large-document-scrolled-expected.png: Added.
"Normal" pixel dump expectations.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Add missing inspector files to compilation.

* PlatformGTK.cmake: Add javascript sources in
WebInspectorUI/UserInterface/External/Esprima to the list of
inspector files.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[jhbuild] Simplify platform detection in update-webkit-libs-jhbuild
https://bugs.webkit.org/show_bug.cgi?id=137390

Reviewed by Carlos Garcia Campos.

* Scripts/update-webkit-libs-jhbuild:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FTL should sink PutLocals
https://bugs.webkit.org/show_bug.cgi?id=137168

Reviewed by Oliver Hunt.
Source/JavaScriptCore:

        
We've known for a while that our PutLocal situation was sub-optimal. We emit them anytime we
"pass" arguments to an inlined function call, because we need to enable the runtime to grab
those arguments when doing foo.arguments where foo is inlined: our engine doesn't deoptimize
in that case but rather just relies on the arguments being flushed (i.e. a copy of their
values is spilled) at a well-known place in a well-known format.
        
The PutLocals incur two costs: (1) they are store instructions and stores ain't free, and (2)
they look like escaping sites and so they inhibit object allocation sinking.
        
But in most cases, the PutLocals are unnecessary because the inlined code never performs any
side effect that could transitively lead to function.arguments. Even if the inlined code
could do such a side effect, it may be on a rare path so there is no need to penalize the
entire function.
        
This patch implements one solution to the PutLocal problem: it aggressively sinks PutLocals
to the latest possible point. This is even more aggressive than the object allocation
sinking. That sinking algorithm avoids creating situations where an object could be
materialized more than one along any path. PutLocal sinking, on the other hand, doesn't avoid
this at all - both to make the phase cheaper and simpler and to make it more aggressive.
Every PutLocal is sunk no matter what.
        
The upside of this patch is that it eliminates many PutLocals: many of them are sunk "past
their death", thus eliminating them completely. Others are sunk to rare paths. This enables a
lot of object allocation sinking and it removes a lot of pointless store instructions.
        
It also has downsites. Sinking PutLocals increases register pressure because it increases the
live ranges of things like inlined arguments.
        
This patch is a net performance win in its current form: 1% SunSpider regression, 2% OctaneV2
progression, 0.6% Kraken regression, 1% AsmBench progression, and 0.5% CompressionBench
regression. The biggest win is on Octane/raytrace, which improves by 27%.
        
Relanding after fixing internal builds. We have to be careful about implicit casts from int64
to int32.

* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.h:
* bytecode/Operands.h:
(JSC::Operands::dump): Deleted.
* bytecode/OperandsInlines.h:
(JSC::Traits>::dump):
* bytecode/VirtualRegister.h:
(JSC::VirtualRegister::isHeader):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* dfg/DFGClobberSet.h:
(JSC::DFG::ClobberSetAdd::operator()):
(JSC::DFG::ClobberSetOverlaps::operator()):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
(JSC::DFG::NoOpClobberize::operator()):
(JSC::DFG::CheckClobberize::operator()):
(JSC::DFG::AbstractHeapOverlaps::operator()):
(JSC::DFG::ReadMethodClobberize::operator()):
(JSC::DFG::WriteMethodClobberize::operator()):
(JSC::DFG::DefMethodClobberize::operator()):
* dfg/DFGFlushFormat.h:
(JSC::DFG::merge):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::Graph):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::capturedVarsFor):
* dfg/DFGObjectAllocationSinkingPhase.cpp:
(JSC::DFG::ObjectAllocationSinkingPhase::determineMaterializationPoints):
(JSC::DFG::ObjectAllocationSinkingPhase::placeMaterializationPoints):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThreadImpl):
* dfg/DFGPreciseLocalClobberize.h: Added.
(JSC::DFG::PreciseLocalClobberizeAdaptor::PreciseLocalClobberizeAdaptor):
(JSC::DFG::PreciseLocalClobberizeAdaptor::read):
(JSC::DFG::PreciseLocalClobberizeAdaptor::write):
(JSC::DFG::PreciseLocalClobberizeAdaptor::def):
(JSC::DFG::PreciseLocalClobberizeAdaptor::callIfAppropriate):
(JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
(JSC::DFG::PreciseLocalClobberizeAdaptor::writeTop):
(JSC::DFG::forEachLocalReadByUnwind):
(JSC::DFG::preciseLocalClobberize):
* dfg/DFGPutLocalSinkingPhase.cpp: Added.
(JSC::DFG::performPutLocalSinking):
* dfg/DFGPutLocalSinkingPhase.h: Added.
* dfg/DFGSSACalculator.h:
(JSC::DFG::SSACalculator::computePhis):
* dfg/DFGValidate.cpp:

Source/WTF:

        
Make the set bits of a BitVector iterable.

* wtf/BitVector.h:
(WTF::BitVector::SetBitsIterable::SetBitsIterable):
(WTF::BitVector::SetBitsIterable::iterator::iterator):
(WTF::BitVector::SetBitsIterable::iterator::operator*):
(WTF::BitVector::SetBitsIterable::iterator::operator++):
(WTF::BitVector::SetBitsIterable::iterator::operator==):
(WTF::BitVector::SetBitsIterable::iterator::operator!=):
(WTF::BitVector::SetBitsIterable::begin):
(WTF::BitVector::SetBitsIterable::end):
(WTF::BitVector::setBits):

LayoutTests:


* js/regress/elidable-new-object-then-call-expected.txt: Added.
* js/regress/elidable-new-object-then-call.html: Added.
* js/regress/script-tests/elidable-new-object-then-call.js: Added.
(sumOfArithSeries):
(bar):
(foo):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: timelines should not count time elapsed while paused in the debugger
https://bugs.webkit.org/show_bug.cgi?id=136351

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Now that we have a stopwatch to provide pause-aware timing data, we can remove the
profiler's handling of debugger pause/continue callbacks. The timeline agent accounts
for debugger pauses by pausing and resuming the stopwatch.

* API/JSProfilerPrivate.cpp:
(JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API.
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::handlePause):
* profiler/LegacyProfiler.cpp:
(JSC::LegacyProfiler::profiler): Use nullptr.
(JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator.
(JSC::LegacyProfiler::stopProfiling): Use nullptr.
(JSC::LegacyProfiler::didPause): Deleted.
(JSC::LegacyProfiler::didContinue): Deleted.
* profiler/LegacyProfiler.h:
* profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the
timestamp member that was used to track time elapsed by the debugger. Just use the
stopwatch's elapsed times to generate start/elapsed times for function calls.
(JSC::ProfileGenerator::create):
(JSC::ProfileGenerator::ProfileGenerator):
(JSC::ProfileGenerator::beginCallEntry):
(JSC::ProfileGenerator::endCallEntry):
(JSC::ProfileGenerator::didPause): Deleted.
(JSC::ProfileGenerator::didContinue): Deleted.
* profiler/ProfileGenerator.h:

Source/WebCore:

To avoid counting time elapsed while the debugger is paused, timeline records should
keep track of time elapsed since the start of timeline capturing, rather than wall clock
timestamps. We can easily compute elapsed time by sharing Stopwatch instance among
all timeline record-generating code. The stopwatch is paused while the debugger is paused,
so subsequent time measurements will not include time elapsed while the debugger is paused.

Agents use the shared stopwatch to generate timestamps if the timeline agent is active
(i.e., a timeline recording is being captured). If not, use a zero timestamp since the timing data is only revealed through the Timeline interface.

This refactoring is safe because start and end times are only used to graph records; the
timestamp's actual value is irrelevant and is not displayed in the user interface. Date
timestamps are still included with network-related records as part of their header data.

No new tests, because we cannot reliably test timing changes induced by debugger pauses.
It is possible for records to accrue time before the debugger pauses or after it resumes.

* inspector/InspectorCSSAgent.cpp: Remove unused include.
* inspector/InspectorPageAgent.cpp: Use timestamps from the shared stopwatch.
(WebCore::InspectorPageAgent::timestamp):
(WebCore::InspectorPageAgent::domContentEventFired):
(WebCore::InspectorPageAgent::loadEventFired):
* inspector/InspectorPageAgent.h:
* inspector/InspectorResourceAgent.cpp: Use timestamps from the shared stopwatch.
(WebCore::InspectorResourceAgent::timestamp):
(WebCore::InspectorResourceAgent::willSendRequest):
(WebCore::InspectorResourceAgent::didReceiveResponse):
(WebCore::InspectorResourceAgent::didReceiveData):
(WebCore::InspectorResourceAgent::didFinishLoading):
(WebCore::InspectorResourceAgent::didFailLoading):
(WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
(WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest):
(WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorResourceAgent::didCloseWebSocket):
(WebCore::InspectorResourceAgent::didReceiveWebSocketFrame):
(WebCore::InspectorResourceAgent::didSendWebSocketFrame):
(WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError):
* inspector/InspectorResourceAgent.h:
* inspector/InspectorTimelineAgent.cpp: Add calls to reset, start, and stop the stopwatch.
(WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::startProfiling):
(WebCore::InspectorTimelineAgent::startFromConsole):
(WebCore::InspectorTimelineAgent::willCallFunction):
(WebCore::InspectorTimelineAgent::willEvaluateScript):
(WebCore::InspectorTimelineAgent::didPause):
(WebCore::InspectorTimelineAgent::didContinue):
(WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
(WebCore::InspectorTimelineAgent::timestamp):
(WebCore::TimelineTimeConverter::reset): Deleted.
* inspector/InspectorTimelineAgent.h: Make timestamp() public, and remove old timepieces.
(WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted.
(WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted.
(WebCore::InspectorTimelineAgent::timeConverter): Deleted.
* inspector/TimelineRecordFactory.cpp:

Source/WebInspectorUI:

Don't update the timeline's current time when the debugger is paused.

Start and end times for timeline records are now in seconds elapsed since timeline
recording started, rather than milliseconds since the epoch. Add a workaround to
preserve compatibility with old backends.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.capturingStarted):
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
(WebInspector.TimelineManager.prototype.eventRecorded):
* UserInterface/Views/TimelineContentView.js:
(WebInspector.TimelineContentView.prototype._debuggerPaused):
(WebInspector.TimelineContentView.prototype._debuggerResumed):

Source/WTF:

* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch.
(WTF::Stopwatch::reset):
(WTF::Stopwatch::start):
(WTF::Stopwatch::stop):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174319 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix the Windows build after r174315.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix the Windows build after r174315.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174321 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r174319.

Causes assertions in fast/profiler tests. Needs nontrivial
investigation, will take offline.

Reverted changeset:

"Web Inspector: timelines should not count time elapsed while
paused in the debugger"
https://bugs.webkit.org/show_bug.cgi?id=136351
http://trac.webkit.org/changeset/174319

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Add PrettyPrinter CSS tests
https://bugs.webkit.org/show_bug.cgi?id=134005

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-10-04
Reviewed by Timothy Hatcher.

Add CSS pretty printing tests. Improve pretty printing of calc()
expressions and media-queries with whitespace around operators
and keywords. Also fix the debug output in the tool for CSS.

* Tools/PrettyPrinting/CodeMirrorFormatters.js:
* Tools/PrettyPrinting/FormatterContentBuilder.js:
(FormatterContentBuilder.prototype._appendIndent):
* Tools/PrettyPrinting/FormatterDebug.js:
(.debugToken):
(Formatter.prototype.debug):
* Tools/PrettyPrinting/css-tests/basic-expected.css: Added.
* Tools/PrettyPrinting/css-tests/basic.css: Added.
* Tools/PrettyPrinting/css-tests/calc-expected.css: Added.
* Tools/PrettyPrinting/css-tests/calc.css: Added.
* Tools/PrettyPrinting/css-tests/media-query-expected.css: Added.
* Tools/PrettyPrinting/css-tests/media-query.css: Added.
* Tools/PrettyPrinting/css-tests/selectors-expected.css: Added.
* Tools/PrettyPrinting/css-tests/selectors.css: Added.
* Tools/PrettyPrinting/index.html:
* UserInterface/Views/CodeMirrorFormatters.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement Element.closest() API
https://bugs.webkit.org/show_bug.cgi?id=137418

Patch by Dhi Aurrahman <diorahman@rockybars.com> on 2014-10-04
Reviewed by Benjamin Poulain.

Source/WebCore:

Implement Element.closest() API as specified in [1].

[1]: https://dom.spec.whatwg.org/#dom-element-closest

Tests: fast/selectors/closest-general.html
       fast/selectors/closest-scope.html

* dom/Element.cpp:
(WebCore::Element::closest):
* dom/Element.h:
* dom/Element.idl:
* dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::selectorClosest):
(WebCore::SelectorDataList::closest):
* dom/SelectorQuery.h:
(WebCore::SelectorQuery::closest):

LayoutTests:

Add test cases for Element.closest() API

* fast/selectors/closest-general-expected.txt: Added.
* fast/selectors/closest-general.html: Added.
* fast/selectors/closest-scope-expected.txt: Added.
* fast/selectors/closest-scope.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[SVG -> OTF Converter] Arabic forms are not substituted correctly
https://bugs.webkit.org/show_bug.cgi?id=137092

Reviewed by Darin Adler.

Tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg
       svg/custom/glyph-selection-arabic-forms.svg

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendArabicReplacementSubtable): Invoked for each of the three
Arabic form substitutions.
(WebCore::SVGToOTFFontConverter::appendGSUBTable): OpenType "Advanced Typographic Table":
"Glyph substitution data"
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Re-order the m_codepointsToIndicesMap
to prefer isolated forms of glyphs.
(WebCore::SVGToOTFFontConverter::convertSVGToOTFFont): Append the GSUB table.
(WebCore::calculateChecksum): Deleted.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Do not generate a symlink in derived sources for every header in WebCore/bindings/gobject
https://bugs.webkit.org/show_bug.cgi?id=137389

Reviewed by Martin Robinson.

We only need a symlink for static sources that are included in
public generated headers, because they are added with as
<webkitdom/WebKitDOMFoo.h> so they need to be inside a webkitdom
directory. Also use proper targets and commands to create the
symlinks only when needed instead of for every build.

* PlatformGTK.cmake:

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