WebKit.git
3 years agoFile inputs only accept UTI types that can be inserted into contenteditable areas...
wenson_hsieh@apple.com [Sun, 23 Apr 2017 03:52:12 +0000 (03:52 +0000)]
File inputs only accept UTI types that can be inserted into contenteditable areas when dropping
https://bugs.webkit.org/show_bug.cgi?id=171177
<rdar://problem/31765379>

Reviewed by Andy Estes.

Source/WebCore:

Currently, DragController::canProcessDrag bails immediately with `false` if the drag data does not contain
compatible content. However, if we are dragging over a file input, we want the presence of files in the drag
data to take priority. To fix this, we teach DragData::containsCompatibleContent to take the purpose of the drag
into account (by default, this is Editing, but when dragging over a file input, this becomes FileUpload). We
then consider DragData to have compatible content for the purpose of file uploading if it contains any files.

Test: DataInteractionTests.ExternalSourceJSONToFileInput.

* page/DragController.cpp:
(WebCore::DragController::canProcessDrag):
* platform/DragData.h:
* platform/gtk/DragDataGtk.cpp:
(WebCore::DragData::containsCompatibleContent):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsCompatibleContent):
* platform/win/DragDataWin.cpp:
(WebCore::DragData::containsCompatibleContent):

Tools:

Tests uploading a JSON file to a file input.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

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

3 years ago[MediaStream] Fix regression caused by r215626
eric.carlson@apple.com [Sat, 22 Apr 2017 18:46:06 +0000 (18:46 +0000)]
[MediaStream] Fix regression caused by r215626
https://bugs.webkit.org/show_bug.cgi?id=171168
<rdar://problem/31774787>

Reviewed by Antoine Quint.

No new tests, fixes fast/mediastream/MediaStream-page-muted.html

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::mediaState): Test muted before m_isProducingData because if both are
true we want to report that the stream is muted.

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

3 years ago[JSC] Get stack pointer without pthread attr
utatane.tea@gmail.com [Sat, 22 Apr 2017 18:08:01 +0000 (18:08 +0000)]
[JSC] Get stack pointer without pthread attr
https://bugs.webkit.org/show_bug.cgi?id=171162

Reviewed by Mark Lam.

If HAVE(MACHINE_CONTEXT) is not enabled, we get stack base and boundary by using
pthread_attr functions. However, it is wrong since this function can be called
after the thread is suspended. In that case, we should not call any functions
that is not async signal safe. For example, pthread_getattr_np calls malloc.

Instead we use getApproximateStackPointer(), which returns approximate stack pointer.

* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::getApproximateStackPointer):
(WTF::isOnAlternativeSignalStack):
When gathering conservative roots, we should keep stack pointer pointing stack.
And if concurrent GC is enabled, we always need to keep the above invariant.
So, we do not support alternative signal stack.

(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::getRegisters):

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

3 years agoDo not measure large chunk of text repeatedly during mid-word breaking.
zalan@apple.com [Sat, 22 Apr 2017 14:34:35 +0000 (14:34 +0000)]
Do not measure large chunk of text repeatedly during mid-word breaking.
https://bugs.webkit.org/show_bug.cgi?id=171065
<rdar://problem/31630245>

Reviewed by Antti Koivisto.

This patch reduces redundant text measuring for mid-word breaking by
1. Adjusting the range for the binary search when the text fragment is longer than the available width
2. Preserving the width value for the left side of the split fragment (computed during the binary search) so
that when the fragment is being split we don't need to re-measure it
3. Checking if the right side fits the next line and only adjust the width (by re-measuring the text) for
kerning/ligature if it does (if it does not fit, we'll end up re-measuring some part of it
during the next split)

Performance test has already been added.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::hyphenPositionForFragment):
(WebCore::SimpleLineLayout::split): binary search with adjusting the range and preserving the width for the left side.
(WebCore::SimpleLineLayout::splitFragmentToFitLine):
(WebCore::SimpleLineLayout::FragmentForwardIterator::FragmentForwardIterator): Deleted.
(WebCore::SimpleLineLayout::FragmentForwardIterator::operator++): Deleted.
(WebCore::SimpleLineLayout::FragmentForwardIterator::operator!=): Deleted.
(WebCore::SimpleLineLayout::FragmentForwardIterator::operator==): Deleted.
(WebCore::SimpleLineLayout::FragmentForwardIterator::operator*): Deleted.
(WebCore::SimpleLineLayout::begin): Deleted.
(WebCore::SimpleLineLayout::end): Deleted.
* rendering/SimpleLineLayoutTextFragmentIterator.h:
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):

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

3 years agoREGRESSION(r215638): [Linux] Several worker tests are crashing in Thread::signalHandl...
utatane.tea@gmail.com [Sat, 22 Apr 2017 14:07:29 +0000 (14:07 +0000)]
REGRESSION(r215638): [Linux] Several worker tests are crashing in Thread::signalHandlerSuspendResume after r215638
https://bugs.webkit.org/show_bug.cgi?id=171159

Reviewed by Michael Catanzaro.

Now, SIGUSR2 is used by ThreadMessage. Instead SIGUSR1 becomes empty.
We should use some signal, that is not managed by WTF Signal mechanism
because the behaivor of this suspend and resume is a bit tricky.
For example, we set a bit tricky signal mask to sigaction to temporary
block SIGUSR2 in the handler to avoid nested SIGUSR2. And we cannot
use ThreadMessage to implement this mechanism because this suspend
and resume handler will stop in the middle of the handler by sigsuspend.
It is not the expected semantics by ThreadMessage.

So now, we use SIGUSR1 instead. And we note that SIGUSR1 is used for
pthread ports.

* wtf/ThreadingPthreads.cpp:
* wtf/threads/Signals.h:

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

3 years agoWebAssembly: Module.exports, Module.imports, Module.customSections are wrong
jfbastien@apple.com [Sat, 22 Apr 2017 07:52:03 +0000 (07:52 +0000)]
WebAssembly: Module.exports, Module.imports, Module.customSections are wrong
https://bugs.webkit.org/show_bug.cgi?id=171078

Reviewed by Saam Barati.

They're static properties of Module, not instance properties of a module.
https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymoduleexports

JSTests:

* wasm/js-api/Module.customSection.js:
(assert.throws.WebAssembly.Module.customSections):
(assert.eq):
(assert.throws.WebAssembly.Module.prototype.customSections): Deleted.
* wasm/js-api/Module.exports.js:
(assert.throws.WebAssembly.Module.exports):
(assert.truthy):
(assert.throws.WebAssembly.Module.prototype.exports): Deleted.
* wasm/js-api/Module.imports.js:
(assert.throws.WebAssembly.Module.imports):
(assert.truthy):
(assert.throws.WebAssembly.Module.prototype.imports): Deleted.

Source/JavaScriptCore:

* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::webAssemblyModuleCustomSections):
(JSC::webAssemblyModuleImports):
(JSC::webAssemblyModuleExports):
* wasm/js/WebAssemblyModulePrototype.cpp:
(JSC::webAssemblyModuleProtoCustomSections): Deleted.
(JSC::webAssemblyModuleProtoImports): Deleted.
(JSC::webAssemblyModuleProtoExports): Deleted.

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

3 years agoSupport writing link titles to the pasteboard when beginning data interaction on...
wenson_hsieh@apple.com [Sat, 22 Apr 2017 06:18:53 +0000 (06:18 +0000)]
Support writing link titles to the pasteboard when beginning data interaction on a link
https://bugs.webkit.org/show_bug.cgi?id=171154
<rdar://problem/31356937>

Reviewed by Andy Estes.

Source/WebCore:

Currently, when writing NSURLs to the pasteboard, we only write a String to the pasteboard corresponding to
kUTTypeURL. This means richer data associated with the link (in this case, the title) are not captured when
writing to the pasteboard. To address this, we introduce a new codepath for writing links to the pasteboard that
mirrors the way PasteboardImage and PasteboardWebContent are written to the pasteboard.

Test: Augmented DataInteractionTests.LinkToInput.

* platform/PasteboardStrategy.h:
* platform/PlatformPasteboard.h:

Add plumbing support for writing PasteboardURLs.

* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::write):
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::writeObjectRepresentations):

Teach PlatformPasteboard to also set the _title attribute of the NSURL when creating an NSURL representation
for registering with the shared WebItemProviderPasteboard.

(WebCore::PlatformPasteboard::write):
* platform/ios/WebItemProviderPasteboard.mm:

Remove deprecation guards and replace deprecated method calls with the latest undeprecated versions.

(-[WebItemProviderPasteboard setItemsFromObjectRepresentations:]):

Source/WebKit/mac:

Adjust for some changes in WebCore to introduce a separate codepath for writing PasteboardURLs. See WebCore
and WebKit2 ChangeLogs for more details.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::writeToPasteboard):

Source/WebKit2:

Adds support for setting the _title attribute of NSURLs written to the pasteboard. See WebCore ChangeLog for more details.

* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PasteboardURL>::encode):
(IPC::ArgumentCoder<PasteboardURL>::decode):
* Shared/WebCoreArgumentCoders.h:

Teach PasteboardURL to be serialized in IPC. For now, we just send across the absolute string of the link and
its title.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::writeURLToPasteboard):
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:

Add IPC plumbing for writing PasteboarURLs to the pasteboard.

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::writeToPasteboard):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

Tools:

Augments an existing unit test, DataInteractionTests.LinkToInput, to also check that the fetching the NSURL from
the source UIItemProvider generated by performing data interaction results in an NSURL with the _title attribute
matching the title of the link.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

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

3 years agoNoisy OOM
jfbastien@apple.com [Sat, 22 Apr 2017 04:31:37 +0000 (04:31 +0000)]
Noisy OOM

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

3 years agoUnreviewed, rolling out r215608.
mcatanzaro@igalia.com [Sat, 22 Apr 2017 02:23:45 +0000 (02:23 +0000)]
Unreviewed, rolling out r215608.

Hundreds of test failures on GTK bot

Reverted changeset:

"Reduce copies and allocations in SharedBuffer::append"
https://bugs.webkit.org/show_bug.cgi?id=170956
http://trac.webkit.org/changeset/215608

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

3 years agoREGRESSION(r205374): <li> content inside <ul> should mid-word wrap when word-break...
zalan@apple.com [Sat, 22 Apr 2017 02:01:55 +0000 (02:01 +0000)]
REGRESSION(r205374): <li> content inside <ul> should mid-word wrap when word-break: break-word is present.
https://bugs.webkit.org/show_bug.cgi?id=171108
<rdar://problem/30271747>

Reviewed by Dan Bernstein.

Source/WebCore:

This patch ensures that we search for mid-word breaks when a zero sized element has been committed on the line
unless it's an image or some other replaced element with special properties (e.g. list-style: inside).

Tests: fast/replaced/ul-li-word-break-break-word.html
       fast/replaced/zero-width-image-force-linebreak.html

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::handleText): This matches pre-r205374 behaviour, but it's explicit about whether a
replaced width has already been committed on the current line.
* rendering/line/LineWidth.cpp:
(WebCore::LineWidth::commit):
* rendering/line/LineWidth.h:
(WebCore::LineWidth::hasCommittedReplaced):
(WebCore::LineWidth::addUncommittedReplacedWidth): These 2 last functions were removed with r205374 (and now I am adding them back).

LayoutTests:

* fast/replaced/ul-li-word-break-break-word-expected.html: Added.
* fast/replaced/ul-li-word-break-break-word.html: Added.
* fast/replaced/zero-width-image-force-linebreak-expected.html: Added.
* fast/replaced/zero-width-image-force-linebreak.html: Added.

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

3 years ago[MediaCapture] Improvements to CoreAudioCaptureSource
jer.noble@apple.com [Sat, 22 Apr 2017 01:00:00 +0000 (01:00 +0000)]
[MediaCapture] Improvements to CoreAudioCaptureSource
https://bugs.webkit.org/show_bug.cgi?id=171146

Reviewed by Eric Carlson.

Various interlocking improvements to CoreAudioCaptureSource:

- Allow the volume, sampleRate, and echoCancellation settings to be applied to the source.
- Update the values returned via settings() when these values change.
- Obey the sampleRate and echoCancellation settings when creating the VPIO unit.
- Because AudioUnitRender() mutates the passed in AudioBufferList, reset it immediately before calling.

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::create):
(WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
(WebCore::CoreAudioCaptureSource::preferredSampleRate):
(WebCore::CoreAudioCaptureSource::preferredIOBufferSize):
(WebCore::CoreAudioCaptureSource::configureMicrophoneProc):
(WebCore::CoreAudioCaptureSource::configureSpeakerProc):
(WebCore::CoreAudioCaptureSource::processMicrophoneSamples):
(WebCore::CoreAudioCaptureSource::setupAudioUnits):
(WebCore::CoreAudioCaptureSource::stopProducingData):
(WebCore::CoreAudioCaptureSource::settings):
(WebCore::CoreAudioCaptureSource::settingsDidChange):
(WebCore::CoreAudioCaptureSource::preferredIOBufferDuration): Deleted.
* platform/mediastream/mac/CoreAudioCaptureSource.h:

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

3 years agocom.apple.WebCore: non-virtual thunk to WebCore::LibWebRTCDataChannelHandler::OnBuffe...
commit-queue@webkit.org [Sat, 22 Apr 2017 00:55:53 +0000 (00:55 +0000)]
com.apple.WebCore: non-virtual thunk to WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange + 39
https://bugs.webkit.org/show_bug.cgi?id=171087
<rdar://problem/31739051>

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-21
Reviewed by Eric Carlson.

Covered by existing tests.
No test added as this behavior is really libwebrtc specific and cannot be triggered easily.

* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::close): Stopping observing libwebrtc data channel before closing it.
This ensures we will stop getting notified as soon as there is no more interest.
* Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
(WebCore::LibWebRTCDataChannelHandler::OnStateChange): libwebrtc can still notify us even though we said we were
not interested. Ensuring we do not call the client if we are no longer interested.
(WebCore::LibWebRTCDataChannelHandler::OnMessage): Ditto.
(WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): Ditto.

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

3 years ago[macOS] Enable media selection button on AVTouchBarScrubber
aestes@apple.com [Sat, 22 Apr 2017 00:53:44 +0000 (00:53 +0000)]
[macOS] Enable media selection button on AVTouchBarScrubber
https://bugs.webkit.org/show_bug.cgi?id=171149
<rdar://problem/29875010>

Reviewed by Beth Dakin.

Source/WebCore:

* platform/spi/cocoa/AVKitSPI.h:

Source/WebKit2:

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::updateMediaTouchBar):

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

3 years ago[macOS] Name WebPlaybackControlsManager delegate methods correctly depending on OS...
aestes@apple.com [Sat, 22 Apr 2017 00:51:15 +0000 (00:51 +0000)]
[macOS] Name WebPlaybackControlsManager delegate methods correctly depending on OS version
https://bugs.webkit.org/show_bug.cgi?id=171147
<rdar://problem/29875010>

Reviewed by Beth Dakin.

On macOS 10.12, WebPlaybackControlsManager conforms to
AVFunctionBarPlaybackControlsControlling, but on 10.13 it conforms to
AVTouchBarPlaybackControlsControlling. These protocols are near-identical, except for
instances of "FunctionBar" in method names are renamed to "TouchBar". This patch updates to
the new method names, and generally renames things with "FunctionBar" to "TouchBar".

* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager generateTouchBarThumbnailsForTimes:tolerance:size:thumbnailHandler:]):
(-[WebPlaybackControlsManager generateTouchBarAudioAmplitudeSamples:completionHandler:]):
(-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
(-[WebPlaybackControlsManager beginTouchBarScrubbing]):
(-[WebPlaybackControlsManager endTouchBarScrubbing]):
(-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]):
(-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
(-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]):
(-[WebPlaybackControlsManager beginFunctionBarScrubbing]):
(-[WebPlaybackControlsManager endFunctionBarScrubbing]):
(-[WebPlaybackControlsManager audioTouchBarMediaSelectionOptions]):
(-[WebPlaybackControlsManager setAudioTouchBarMediaSelectionOptions:]):
(-[WebPlaybackControlsManager currentAudioTouchBarMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
(-[WebPlaybackControlsManager legibleTouchBarMediaSelectionOptions]):
(-[WebPlaybackControlsManager setLegibleTouchBarMediaSelectionOptions:]):
(-[WebPlaybackControlsManager currentLegibleTouchBarMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]): Deleted.
(-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]): Deleted.
(-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]): Deleted.
(-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]): Deleted.
(-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]): Deleted.
(-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]): Deleted.
(-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]): Deleted.
(-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]): Deleted.

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

3 years agoMake CoreAudioCaptureDevice stackable.
jer.noble@apple.com [Sat, 22 Apr 2017 00:14:09 +0000 (00:14 +0000)]
Make CoreAudioCaptureDevice stackable.
https://bugs.webkit.org/show_bug.cgi?id=171097

Reviewed by Eric Carlson.

There's no real reason to keep CoreAudioCaptureDevice from being created on the stack.
Make it un-RefCounted, and have it's static factory method return an std::optional rather
than a RefPtr.

Drive-by fix: clean up the factory method of CoreAudioCaptureSource a bit.

* platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
(WebCore::CoreAudioCaptureDevice::create):
(WebCore::CoreAudioCaptureDevice::deviceID): Deleted.
* platform/mediastream/mac/CoreAudioCaptureDevice.h:
(WebCore::CoreAudioCaptureDevice::deviceID):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
(WebCore::CoreAudioCaptureDeviceManager::coreAudioDeviceWithUID):
(WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::create):
(WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
* platform/mediastream/mac/CoreAudioCaptureSource.h:

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

3 years ago[MediaStream iOS] Release capture session when not producing data
eric.carlson@apple.com [Sat, 22 Apr 2017 00:06:41 +0000 (00:06 +0000)]
[MediaStream iOS] Release capture session when not producing data
https://bugs.webkit.org/show_bug.cgi?id=171148
<rdar://problem/29265868>

Reviewed by Jer Noble.

On iOS, only one AVCaptureSession can be active at a time, so release a session whenever
it is told to stop producing data. The session will recreated if the capture source if/when
told to produce data again.

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::stopProducingData): Clear m_session to release the session.
It will be re-allocated if startProducingData is called later.

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

3 years ago[WK2] Add delegate hooks for overriding unhanded data interaction operations
wenson_hsieh@apple.com [Sat, 22 Apr 2017 00:03:01 +0000 (00:03 +0000)]
[WK2] Add delegate hooks for overriding unhanded data interaction operations
https://bugs.webkit.org/show_bug.cgi?id=171005
<rdar://problem/31669646>

Reviewed by Tim Horton.

Source/WebKit2:

Adds support for overriding data interaction operations through two new delegate methods:
_webView:willUpdateDataInteractionOperationToOperation:forSession:, and
_webView:dataInteractionOperationWasHandled:forSession:. The former may be overridden to return a different
operation type than what WebKit would originally have returned, and the latter may be overridden to run custom
logic after the web process has handled a data interaction operation.

Additionally, includes some minor cleanup around WKContentViewInteraction. With the new
_webView:dataInteractionOperationWasHandled:forSession: delegate method, the last method on _WKTestingDelegate
may be removed. This means _WKTestingDelegate is no longer needed, so this patch removes its header entirely.
Also, relocates some state variables formerly on WKContentView to WKContentView's WKDataInteractionState struct
instead, so that all state associated with data interaction may be cleaned up at the same time.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _testingDelegate]): Deleted.
(-[WKWebView _setTestingDelegate:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKTestingDelegate.h: Removed.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

Add a new "handled" IPC argument to DidPerformDataInteractionControllerOperation. This lets the UI process
know whether or not the data interaction operation was handled by the web process, and is eventually plumbed
through to the UI delegate via the new SPI.

* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanupInteraction]):
(-[WKContentView _displayFormNodeInputView]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didPerformDataInteractionControllerOperation):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performDragControllerAction):

Tools:

Adds a new API test checking that normal WebKit behavior when vending updated data interaction operations may
be overridden, resulting in a data interaction operation being performed when it otherwise would not have. Also
adjusts for some changes in WebKit2 (See WebKit2 ChangeLog for more details).

New API test:
DataInteractionTests.OverrideDataInteractionOperation

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(-[UIItemProvider registerDataRepresentationForTypeIdentifier:withData:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator initWithWebView:]):
(-[DataInteractionSimulator dealloc]):
(-[DataInteractionSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):
(-[DataInteractionSimulator _webView:willUpdateDataInteractionOperationToOperation:forSession:]):
(-[DataInteractionSimulator webViewDidPerformDataInteractionControllerOperation:]): Deleted.

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

3 years agoAX: FKA: Buttons need a visible focus indicator
commit-queue@webkit.org [Fri, 21 Apr 2017 23:58:51 +0000 (23:58 +0000)]
AX: FKA: Buttons need a visible focus indicator
https://bugs.webkit.org/show_bug.cgi?id=171040
<rdar://problem/30922548>

Patch by Aaron Chu <aaron_chu@apple.com> on 2017-04-21
Reviewed by Antoine Quint.

Source/WebCore:

Added a background color for the focus state of the icon buttons in modern media controls.

Test: media/modern-media-controls/icon-button/icon-button-focus-state.html

* Modules/modern-media-controls/controls/icon-button.css:
(button.icon:focus):

LayoutTests:

* TestExpectations:
* media/modern-media-controls/icon-button/icon-button-focus-state-expected.txt: Added.
* media/modern-media-controls/icon-button/icon-button-focus-state.html: Added.
* platform/mac/TestExpectations:

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

3 years agoTemporarily disable two flaky API tests.
ryanhaddad@apple.com [Fri, 21 Apr 2017 22:55:40 +0000 (22:55 +0000)]
Temporarily disable two flaky API tests.

Unreviewed test gardening.

* TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm:
(TEST):

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

3 years agoMark inspector/debugger/tail-deleted-frames-this-value.html as flaky.
ryanhaddad@apple.com [Fri, 21 Apr 2017 22:55:37 +0000 (22:55 +0000)]
Mark inspector/debugger/tail-deleted-frames-this-value.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169119

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoConsider muting audio hardware a form of autoplay interference.
mrajca@apple.com [Fri, 21 Apr 2017 22:45:46 +0000 (22:45 +0000)]
Consider muting audio hardware a form of autoplay interference.
https://bugs.webkit.org/show_bug.cgi?id=169971

Reviewed by Eric Carlson.

If the user mutes audio hardware and a media element is auto-playing, consider that
as a form of auto-play interference that we tell clients about.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::hardwareMutedStateDidChange):
* html/HTMLMediaElement.h:
* platform/audio/AudioSession.h:
(WebCore::AudioSession::MutedStateObserver::~MutedStateObserver):
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::isMuted):
(WebCore::muteProcess):
(WebCore::AudioSession::handleMutedStateChange):
(WebCore::AudioSession::addMutedStateObserver):
(WebCore::AudioSession::removeMutedStateObserver):

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

3 years agoRegression(r206240): XMLSerializer.serializeToString() does not properly escape ...
cdumez@apple.com [Fri, 21 Apr 2017 22:23:10 +0000 (22:23 +0000)]
Regression(r206240): XMLSerializer.serializeToString() does not properly escape '<' / '>' in attribute values
https://bugs.webkit.org/show_bug.cgi?id=171132
<rdar://problem/31426752>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Re-sync web-platform-tests/domparsing from upstream.

* web-platform-tests/domparsing/DOMParser-parseFromString-html.html:
* web-platform-tests/domparsing/DOMParser-parseFromString-xml-doctype.html:
* web-platform-tests/domparsing/DOMParser-parseFromString-xml.html:
* web-platform-tests/domparsing/XMLSerializer-serializeToString.html:
* web-platform-tests/domparsing/createContextualFragment.html:
* web-platform-tests/domparsing/innerhtml-01.xhtml:
* web-platform-tests/domparsing/innerhtml-03.xhtml:
* web-platform-tests/domparsing/innerhtml-04.html:
* web-platform-tests/domparsing/innerhtml-05.xhtml:
* web-platform-tests/domparsing/innerhtml-06.html:
* web-platform-tests/domparsing/innerhtml-07.html:
* web-platform-tests/domparsing/insert-adjacent.html:
* web-platform-tests/domparsing/insert_adjacent_html-xhtml.xhtml:
* web-platform-tests/domparsing/insert_adjacent_html.html:
* web-platform-tests/domparsing/outerhtml-01.html:
* web-platform-tests/domparsing/outerhtml-02.html:
* web-platform-tests/domparsing/style_attribute_html.html:
* web-platform-tests/domparsing/w3c-import.log:
* web-platform-tests/domparsing/xml-serialization.xhtml:

Source/WebCore:

Use XMLSerialization [1] in MarkupAccumulator::appendAttribute() when inXMLFragmentSerialization()
returns true, even if the node's associated document is an HTML document. When XMLSerializer.serializeToString()
is called on a Node, we want XML serialization, even if the node comes from an HTML document.

[1] https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization

Test: fast/dom/XMLSerializer-serializeToString-entities.html

* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendAttributeValue):
(WebCore::MarkupAccumulator::appendAttribute):
* editing/MarkupAccumulator.h:

LayoutTests:

Add layout test coverage. This test is passing in both Firefox and Chrome.

* fast/dom/XMLSerializer-serializeToString-entities-expected.txt: Added.
* fast/dom/XMLSerializer-serializeToString-entities.html: Added.

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

3 years ago[ios-simulator] LayoutTest webrtc/multi-video.html is a flaky crash
commit-queue@webkit.org [Fri, 21 Apr 2017 22:17:13 +0000 (22:17 +0000)]
[ios-simulator] LayoutTest webrtc/multi-video.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=170823
<rdar://problem/31611583>

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-21

* TestExpectations: Reactivating test.

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

3 years agoSplit cryptographic digest computation and parsing out of CSP code so it can be reused
weinig@apple.com [Fri, 21 Apr 2017 22:13:58 +0000 (22:13 +0000)]
Split cryptographic digest computation and parsing out of CSP code so it can be reused
https://bugs.webkit.org/show_bug.cgi?id=171076

Reviewed by Chris Dumez.

Source/WebCore:

Factor out cryptographic digest parsing from Content Security Policy code
so that it can be reused for the Subresource Integrity implementation.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* html/parser/ParsingUtilities.h:
(WebCore::skipExactlyIgnoringASCIICase):
Add parsing helper to match / skip over a constant string, using IgnoringASCIICase semantics.

* loader/ResourceCryptographicDigest.cpp: Added.
(WebCore::parseHashAlgorithmAdvancingPosition):
(WebCore::parseCryptographicDigestImpl):
(WebCore::parseCryptographicDigest):
Move parsing of cryptographic-digest strings from ContentSecurityPolicySourceList.cpp
and optimize it a little by avoiding String allocations and generalizing it so that it
can parse either UChars or LChars.

* loader/ResourceCryptographicDigest.h: Added.
(WebCore::ResourceCryptographicDigest::operator==):
(WebCore::ResourceCryptographicDigest::operator!=):
(WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::Hash::hash):
(WTF::DefaultHash<WebCore::ResourceCryptographicDigest>::Hash::equal):
(WTF::HashTraits<WebCore::ResourceCryptographicDigest>::emptyValue):
(WTF::HashTraits<WebCore::ResourceCryptographicDigest>::constructDeletedValue):
(WTF::HashTraits<WebCore::ResourceCryptographicDigest>::isDeletedValue):
Add a struct (rather than using a std::pair) to represent the digest + algorithm. And add
HashTraits so it can be used as HashMap.

* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::findHashOfContentInPolicies):
(WebCore::toCryptoDigestAlgorithm): Deleted.
Move algorithm conversion to ResourceCryptographicDigest.cpp. Make use of new
cryptographicDigestForBytes function to do hashing.

* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyHash.h:
(WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::hash): Deleted.
(WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::equal): Deleted.
Remove HashTraits for the digest, this is now handled by ResourceCryptographicDigest.
To keep things relatively straight-forward, redefine ContentSecurityPolicyHashAlgorithm
and ContentSecurityPolicyHash in terms of ResourceCryptographicDigest, so that less code
has to be changed all at once. In a later pass, if wanted, we can remove these using
declarations.

* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::isNonceCharacter):
Use renamed isBase64OrBase64URLCharacter predicate.

(WebCore::ContentSecurityPolicySourceList::parseHashSource):
Rework using ResourceCryptographicDigest parsing. Quotation and maximum digest
length have been kept here, as they are not applicable to other uses of
the digest, specifically Subresource Integrity.

Source/WTF:

* wtf/text/Base64.cpp:
(WTF::base64Decode):
(WTF::base64URLDecode):
Add overloads for base64Decode and base64URLDecode that take a StringView, to avoid allocations
of Strings.

* wtf/text/Base64.h:
(WTF::isBase64OrBase64URLCharacter):
Move helper predicate used for parsing either type of Base64 encoded string from WebCore.

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

3 years agoUnreviewed fix after r215624; null-deref crash.
jer.noble@apple.com [Fri, 21 Apr 2017 22:01:38 +0000 (22:01 +0000)]
Unreviewed fix after r215624; null-deref crash.

Make sure to call reset() inside each constructor.

* platform/audio/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):

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

3 years agoSharedArrayBuffer-opt.js fails with Briggs
sbarati@apple.com [Fri, 21 Apr 2017 21:45:12 +0000 (21:45 +0000)]
SharedArrayBuffer-opt.js fails with Briggs
https://bugs.webkit.org/show_bug.cgi?id=170948
<rdar://problem/31740568>

Reviewed by Michael Saboff.

The bug was not actually with Briggs, but instead was with
our X86-64 MacroAssembler. Michael fixed the bug here:
https://trac.webkit.org/changeset/215618/webkit

The issue was we weren't adding the REX byte for AtomicXchg8,
leading to the incorrect encoding for the result register depending
on which register it was. If you look at this code, you'll see the issue:

  Int32 @38 = AtomicXchg(@59, @64, width = 8, range = 0, fenceRange = 0, ControlDependent|Fence|Writes:0|Reads:0, DFG:@49)
      AtomicXchg8 %rsi, (%rax,%rdx), @38
          0x2dcb5bc0015e: lock xchg %dh, (%rax,%rdx)
  Int32 @66 = Const32(255, DFG:@49)
  Int32 @67 = BitAnd(@38, $255(@66), DFG:@49)
      ZeroExtend8To32 %rsi, %rax, @67
          0x2dcb5bc00162: movzx %sil, %eax

Air thought the result was in the lower 8 bits of %rsi,
however, the code we emitted stored it in the [8-15] bits
of %rdx. Since this issue is fixed, I'm turning Briggs back
on.

* b3/air/AirAllocateRegistersByGraphColoring.h:
(JSC::B3::Air::useIRC):

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

3 years ago[iOS] Skip http/tests/security/contentSecurityPolicy/{audio, video}-redirect-allowed2...
dbates@webkit.org [Fri, 21 Apr 2017 21:43:40 +0000 (21:43 +0000)]
[iOS] Skip http/tests/security/contentSecurityPolicy/{audio, video}-redirect-allowed2.html
<rdar://problem/31690952>

Rubber-stamped by Jer Noble.

We can enable these tests again once we fix <rdar://problem/25780035>.

* platform/ios/TestExpectations:

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

3 years agoRefactor MASM probe to allow printing of custom types.
mark.lam@apple.com [Fri, 21 Apr 2017 21:42:24 +0000 (21:42 +0000)]
Refactor MASM probe to allow printing of custom types.
https://bugs.webkit.org/show_bug.cgi?id=171101

Reviewed by JF Bastien.

For example, this allows us to add MASM printing of CodeBlock* and Air::Args.

In general, MASM print can be used like dataLog, except that it generates JITted
code for doing the dataLogging later when the JITted code runs.  MASM print can
print any value type that a specialized Printer template or a setPrinter()
function implemented for that type.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/MacroAssembler.h:

* assembler/MacroAssemblerPrinter.cpp:
(JSC::Printer::printAllRegisters):
(JSC::Printer::printPCRegister):
(JSC::Printer::printRegisterID):
(JSC::Printer::printFPRegisterID):
(JSC::Printer::printAddress):
(JSC::Printer::printMemory):
(JSC::Printer::printCallback):
(JSC::printIndent): Deleted.
(JSC::printCPU): Deleted.
(JSC::printCPURegisters): Deleted.
(JSC::printPC): Deleted.
(JSC::printRegister): Deleted.
(JSC::printMemory): Deleted.
(JSC::MacroAssemblerPrinter::printCallback): Deleted.
* assembler/MacroAssemblerPrinter.h:
(JSC::AllRegisters::AllRegisters):
(JSC::Printer::Printer<AllRegisters>::Printer):
(JSC::Printer::Printer<PCRegister>::Printer):
(JSC::Printer::Printer<MacroAssembler::RegisterID>::Printer):
(JSC::Printer::Printer<MacroAssembler::FPRegisterID>::Printer):
(JSC::Printer::Printer<MacroAssembler::Address>::Printer):
(JSC::Printer::Printer<Memory>::Printer):
(JSC::Printer::Printer<MemWord<IntType>>::Printer):
(JSC::MacroAssembler::print):
(JSC::MacroAssemblerPrinter::print): Deleted.
(JSC::MacroAssemblerPrinter::PrintArg::PrintArg): Deleted.
(JSC::MacroAssemblerPrinter::appendPrintArg): Deleted.
- Refactored to move the underlying PrintRecord (and associated data structures)
  out to Printer.cpp/h.
- MacroAssemblerPrinter.cpp/h now only add custom Printers for MASM types like
  RegisterID and Memory.  It also defines the implementation of
  MacroAssembler::print().

  As before, JIT code that wishes to use MacroAssembler::print() needs to
  #include "MacroAssemblerPrinter.h".

- Also added the ability to specify an optional indentation (in number of chars)
  when MASM printing AllRegisters.  This is useful because AllRegisters prints
  a block of data unlike other printers which print inline.

* assembler/Printer.cpp: Added.
(JSC::Printer::printConstCharString):
(JSC::Printer::printIntptr):
(JSC::Printer::printUintptr):
(JSC::Printer::printPointer):
(JSC::Printer::setPrinter):
* assembler/Printer.h: Added.
(JSC::Printer::Context::Context):
(JSC::Printer::PrintRecord::PrintRecord):
(JSC::Printer::appendPrinter):
(JSC::Printer::makePrintRecordList):
(JSC::Printer::Printer<RawPointer>::Printer):
(JSC::Printer::setPrinter):
(JSC::Printer::Printer::Printer):
- Data structures for creating a list of PrintRecords.  Classes which wish to
  add custom support for MASM printing can #include "Printer.h" and implement
  either:
  1. a specialized Printer template, or
  2. a setPrinter() function.

  See Printer<Reg> and Printer<B3::Air::Tmp> in AirPrintSpecial.h for examples of
  (1).  See CodeBlock's setPrinter() for an example of (2).

* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::print):
* b3/air/AirPrintSpecial.cpp: Added.
(JSC::B3::Air::PrintSpecial::PrintSpecial):
(JSC::B3::Air::PrintSpecial::~PrintSpecial):
(JSC::B3::Air::PrintSpecial::forEachArg):
(JSC::B3::Air::PrintSpecial::isValid):
(JSC::B3::Air::PrintSpecial::admitsStack):
(JSC::B3::Air::PrintSpecial::reportUsedRegisters):
(JSC::B3::Air::PrintSpecial::generate):
(JSC::B3::Air::PrintSpecial::extraEarlyClobberedRegs):
(JSC::B3::Air::PrintSpecial::extraClobberedRegs):
(JSC::B3::Air::PrintSpecial::dumpImpl):
(JSC::B3::Air::PrintSpecial::deepDumpImpl):
(JSC::Printer::printAirArg):
* b3/air/AirPrintSpecial.h: Added.
(JSC::Printer::appendAirArg):
(JSC::Printer::appendAirArgs):
(JSC::Printer::Printer<B3::Air::Tmp>::Printer):
(JSC::Printer::Printer<Reg>::Printer):
- Add the print() operation for use in LowerToAir.  print() will emit a
  PrintSpecial that will ultimately emit a MASM print to print what we want.
- LowerToAir's print() adds the ability to print Air::Args.
- Unlike in the baseline JIT and the DFG, LowerToAir's print() can perturb the
  usage of registers.  This is because PrintSpecial is a patch point, and it
  prevents certain optimizations.  If not used carefully, an attempt to print()
  an Arg by taking a Tmp, can force the B3 Value into a Tmp earlier than it would
  otherwise do so.  So, use LowerToAir's print() with care.

* bytecode/CodeBlock.cpp:
(JSC::setPrinter):
- Now we can MASM print CodeBlock*.
(WTF::printInternal):
- Now we can dataLog CodeBlock* (including null CodeBlock pointers).

* bytecode/CodeBlock.h:

* runtime/VM.cpp:
(JSC::VM::throwException):
- Use the new ability to dataLog CodeBlock*.  No need to do an explicit null
  check before printing anymore.

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

3 years agoSimple line layout: Add performance test to measure mid-word line breaking with long...
zalan@apple.com [Fri, 21 Apr 2017 21:41:41 +0000 (21:41 +0000)]
Simple line layout: Add performance test to measure mid-word line breaking with long text.
https://bugs.webkit.org/show_bug.cgi?id=171136

Reviewed by Ryosuke Niwa.

* Layout/simple-line-layout-word-break-long-text.html: Added.

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

3 years agoRename commit_set_relationships to commit_set_items
rniwa@webkit.org [Fri, 21 Apr 2017 21:31:06 +0000 (21:31 +0000)]
Rename commit_set_relationships to commit_set_items
https://bugs.webkit.org/show_bug.cgi?id=171143

Reviewed by Joseph Pecoraro.

Renamed commit_set_relationships to commit_set_items. Also added commitset_patch_file in the preparation to add
the support for applying patches in custom test groups. To migrate an existing database, run:

```sql
BEGIN;
ALTER TABLE commit_set_relationships RENAME TO commit_set_items;
ALTER TABLE commit_set_items ADD COLUMN commitset_patch_file integer REFERENCES uploaded_files;
ALTER TABLE commit_set_items ADD CONSTRAINT commitset_with_patch_must_have_commit
    CHECK (commitset_patch_file IS NULL OR commitset_commit IS NOT NULL);
END;
```

* init-database.sql:
* public/include/build-requests-fetcher.php:
* public/privileged-api/create-test-group.php:
* server-tests/resources/mock-data.js:
(MockData.addMockData):
(MockData.addMockTestGroupWithGitWebKit):
* tools/js/database.js:

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

3 years agoStop using deprecated APIs, part 5
andersca@apple.com [Fri, 21 Apr 2017 21:28:22 +0000 (21:28 +0000)]
Stop using deprecated APIs, part 5
https://bugs.webkit.org/show_bug.cgi?id=171134
rdar://problem/31589635

Reviewed by Tim Horton.

Source/WebCore:

* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):
Stop using the toPaymentAuthorizationStatus. Convert the passed in status results to the remaining
PaymentAuthorizationStatus values, and add errors if needed.

(WebCore::toPaymentAuthorizationStatus):
This function is no longer used.

* Modules/applepay/PaymentAuthorizationStatus.h:
Remove deprecated status values. We can achieve the same results with errors now.

* Modules/applepay/PaymentRequest.cpp:
(WebCore::isFinalStateResult):
Remove deprecated status values.

* Modules/applepay/PaymentRequest.h:
Remove deprecated status values.

Source/WebKit2:

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toPKPaymentAuthorizationStatus):
Remove this and add a new version that doesn't use any deprecated values.

(WebKit::toPKPaymentAuthorizationStatus):
New function that takes a WebCore::PaymentAuthorizationResult and converts it to a status, for older OSes.

(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
Use the new toPKPaymentAuthorizationStatus versions.

(WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
Ditto.

(WebKit::status): Deleted.

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

3 years agoUnreviewed, rolling out r215634.
keith_miller@apple.com [Fri, 21 Apr 2017 21:28:17 +0000 (21:28 +0000)]
Unreviewed, rolling out r215634.

underlying build issues should have been fixed

Reverted changeset:

"Unreviewed, rolling out r215620 and r215623."
https://bugs.webkit.org/show_bug.cgi?id=171139
http://trac.webkit.org/changeset/215634

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

3 years agoSource/JavaScriptCore:
keith_miller@apple.com [Fri, 21 Apr 2017 21:14:15 +0000 (21:14 +0000)]
Source/JavaScriptCore:
Unreviewed, rolling out r215620 and r215623.
https://bugs.webkit.org/show_bug.cgi?id=171139

broke arm64 build (Requested by keith_miller on #webkit).

Reverted changesets:

"Add signaling API"
https://bugs.webkit.org/show_bug.cgi?id=170976
http://trac.webkit.org/changeset/215620

"Unreviewed, fix Cloop build."
http://trac.webkit.org/changeset/215623

Patch by Commit Queue <commit-queue@webkit.org> on 2017-04-21

Source/WTF:
Remove LL/SC from Atomics
https://bugs.webkit.org/show_bug.cgi?id=171141

Reviewed by Saam Barati.

Adding load link and store conditionally was not an actual progression
and the existing code is causing problems for users of Atomics. So let's
get rid of it.

* wtf/Atomics.h:
(WTF::hasFence):
(WTF::Atomic::exchange):
(WTF::Atomic::transaction):
(WTF::Atomic::transactionRelaxed):
(WTF::Atomic::prepare): Deleted.
(WTF::Atomic::attempt): Deleted.
* wtf/Bitmap.h:
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockFast):
(WTF::LockAlgorithm::unlockFast):

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

3 years agoAdd the support for creating a custom test group in the analysis task page
rniwa@webkit.org [Fri, 21 Apr 2017 21:08:36 +0000 (21:08 +0000)]
Add the support for creating a custom test group in the analysis task page

Make it possible to create more custom test groups in the analysis task page
https://bugs.webkit.org/show_bug.cgi?id=171138

Rubber-stamped by Chris Dumez.

Extracted CustomConfigurationTestGroupForm out of CreateAnalysisTaskPage and added it to AnalysisTaskPage inside
AnalysisTaskConfiguratorPane. This allows configuration of a new test group within a custom analysis task.

* public/privileged-api/create-test-group.php:
(main): Fixed the bug that the triggerable wasn't resolved when creating a test group in a custom analysis task.

* public/v3/components/custom-analysis-task-configurator.js:
(CustomAnalysisTaskConfigurator.prototype.selectTests): Added. Used by CustomConfigurationTestGroupForm's
setConfigurations.
(CustomAnalysisTaskConfigurator.prototype.selectPlatform): Ditto.
(CustomAnalysisTaskConfigurator.prototype.setCommitSets): Ditto.
(CustomAnalysisTaskConfigurator.prototype._setUploadedFilesIfEmpty): Added.
(CustomAnalysisTaskConfigurator.prototype._revisionMapFromCommitSet): Added.
(CustomAnalysisTaskConfigurator.prototype.render): Update the currently selected platforms and tests now that
they can be set externally via selectTests and selectPlatform.
(CustomAnalysisTaskConfigurator.prototype._renderTriggerableTests): Return the result of _renderRadioButtonList
so that the caller can update the currently selected tests without having to reconstruct the list.
(CustomAnalysisTaskConfigurator.prototype._renderTriggerablePlatforms): Ditto.
(CustomAnalysisTaskConfigurator.prototype._renderRadioButtonList): Renamed from _buildCheckboxList. Now returns
a function which updates the currently selected items. We still pretend that multiple items can be selected to
make it future-proof.

* public/v3/components/custom-configuration-test-group-form.js: Added.
(CustomConfigurationTestGroupForm): Added. Inherits from TestGroupForm. Extracted from CreateAnalysisTaskPage.
(CustomConfigurationTestGroupForm.prototype.setHasTask): Added.
(CustomConfigurationTestGroupForm.prototype.hasCommitSets): Added.
(CustomConfigurationTestGroupForm.prototype.setConfigurations): Added. Used by AnalysisTaskConfiguratorPane to
set the default configuration to what the latest test group used.
(CustomConfigurationTestGroupForm.prototype.startTesting): Added. Dispatches "startTesting" action with
platform, test, taskName in addition to what CustomizedTestGroupForm emits.
(CustomConfigurationTestGroupForm.prototype.didConstructShadowTree): Added.
(CustomConfigurationTestGroupForm.prototype.render): Added.
(CustomConfigurationTestGroupForm.prototype._updateTestGroupName): Added.
(CustomConfigurationTestGroupForm.cssTemplate): Added.
(CustomConfigurationTestGroupForm.htmlTemplate): Added.

* public/v3/components/test-group-form.js:
(TestGroupForm.cssTemplate): Make the form display: block.

* public/v3/index.html:

* public/v3/models/test-group.js:
(TestGroup.prototype.test): Added.
(TestGroup.prototype.platform): Added.
(TestGroup.createWithCustomConfiguration): Added. Creates a custom test group with an existing analysis task.

* public/v3/models/uploaded-file.js:
(UploadedFile): Fixed a bug that _deletedAt was set to a Date object even when object.deletedAt is null.

* public/v3/pages/analysis-task-page.js:
(AnalysisTaskConfiguratorPane): Added.
(AnalysisTaskConfiguratorPane.prototype.didConstructShadowTree): Added. Dispatch createCustomTestGroup action
in turn when receiving startTesting from CustomConfigurationTestGroupForm.
(AnalysisTaskConfiguratorPane.prototype.setTestGroups): Added.
(AnalysisTaskConfiguratorPane.prototype.render): Added.
(AnalysisTaskConfiguratorPane.htmlTemplate): Added. We override this instead of formContent to display the
"Start" button at the end instead of at the beginnning.
(AnalysisTaskConfiguratorPane.cssTemplate): Added.
(AnalysisTaskPage.prototype.didConstructShadowTree): Listen to createCustomTestGroup.
(AnalysisTaskPage.prototype.render): Hide AnalysisTaskConfiguratorPane when the analysis task is not custom.
(AnalysisTaskPage.prototype._showTestGroup): Let AnalysisTaskConfiguratorPane know of the current test group
so that it can update the default configuration if the user hasn't modified yet.
(AnalysisTaskPage.prototype._createCustomTestGroup): Added.

* public/v3/pages/create-analysis-task-page.js:
(CreateAnalysisTaskPage.prototype.didConstructShadowTree):
(CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup):
(CreateAnalysisTaskPage.prototype.render):
(CreateAnalysisTaskPage.prototype._renderMessage):
(CreateAnalysisTaskPage.htmlTemplate):
(CreateAnalysisTaskPage.cssTemplate):

* server-tests/privileged-api-create-test-group-tests.js: Added a test case for creating a custom test group for
an existing analysis task.

* server-tests/resources/mock-data.js:
(MockData.otherPlatformId): Added.
(MockData.addMockData): Added a test configuration for otherPlatformId.

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

3 years agoBubbles on dashboard doesn't turn red for test262 failures
aakash_jain@apple.com [Fri, 21 Apr 2017 20:56:04 +0000 (20:56 +0000)]
Bubbles on dashboard doesn't turn red for test262 failures
https://bugs.webkit.org/show_bug.cgi?id=171129

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js: Added test262-test.

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

3 years agoUnreviewed, rolling out r215620 and r215623.
commit-queue@webkit.org [Fri, 21 Apr 2017 20:31:39 +0000 (20:31 +0000)]
Unreviewed, rolling out r215620 and r215623.
https://bugs.webkit.org/show_bug.cgi?id=171139

broke arm64 build (Requested by keith_miller on #webkit).

Reverted changesets:

"Add signaling API"
https://bugs.webkit.org/show_bug.cgi?id=170976
http://trac.webkit.org/changeset/215620

"Unreviewed, fix Cloop build."
http://trac.webkit.org/changeset/215623

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

3 years agoMake it possible to view results for sub tests and metrics in A/B testing
rniwa@webkit.org [Fri, 21 Apr 2017 20:20:05 +0000 (20:20 +0000)]
Make it possible to view results for sub tests and metrics in A/B testing
https://bugs.webkit.org/show_bug.cgi?id=170975

Reviewed by Chris Dumez.

Replaced TestGroupResultsTable, which was a single table that presented the test results with a set of revisions
each build request used, with TestGroupResultsViewer and TestGroupRevisionTable. TestGroupResultsViewer provides
an UI to look the results of sub-tests and sub-metrics and TestGroupRevisionTable provides an UI to display
the set of revisions each build request used. TestGroupRevisionTable can also show the list of custom roots now
that we've added UI to schedule an analysis task with a custom test group.

This patch extends BarGraphGroup to show multiple bars per SingleBarGraph using a canvas with bars indicating
their mean and confidence interval.

* browser-tests/index.html:
(ChartTest.importChartScripts): Include lazily-evaluated-function.js now that Test model object uses
LazilyEvaluatedFunction.

* public/v3/components/analysis-results-viewer.js:
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet):
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus):

* public/v3/components/bar-graph-group.js:
(BarGraphGroup): No longer takes formatter. Added _computeRangeLazily and _showLabels as instance variables.
(BarGraphGroup.prototype.addBar): Now takes a list of values, their labels, mean, confidence interval, and
the colors of bar graphs shown for each value and the mean indicator.
(BarGraphGroup.prototype.showLabels): Added.
(BarGraphGroup.prototype.setShowLabels): Added.
(BarGraphGroup.prototype.range): Added.
(BarGraphGroup.prototype._computeRange): Renamed from updateGroupRendering. Now returns the range instead off
setting it to each bar, and each SingleBarGraph's render function uses the value via BarGraphGroup's range.
(BarGraph): Renamed from SingleBarGraph. Added various arguments introduced in addBar, and now stores various
lazily evaluated functions used for rendering.
(BarGraph.prototype.render): Rewritten to use canvas to draw bar graphs and show a label when group's
showLabels() returns true.
(BarGraph.prototype._resizeCanvas): Added.
(BarGraph.prototype._renderCanvas): Added.
(BarGraph.prototype._renderLabels): Added. We align the top of each label to the middle of each bar and shift it
back up by half the height of the label (0.4rem) using margin-top in css.
(BarGraph.htmlTemplate): Uses a canvas now.
(BarGraph.cssTemplate):

* public/v3/components/results-table.js:
(ResultsTable.prototype.renderTable): Updated per code changes to BarGraphGroup.
(ResultsTableRow.prototype.resultContent): Ditto.

* public/v3/components/test-group-results-table.js: Removed.
* public/v3/components/test-group-results-viewer.js: Added.
(TestGroupResultsViewer): Added. Shows a list of test results with bar graphs with mean and confidence interval
indicators. The results of sub tests and metrics can be expanded via "(Breakdown)" link shown below each test.
(TestGroupResultsViewer.prototype.setTestGroup): Added.
(TestGroupResultsViewer.prototype.setAnalysisResults): Added.
(TestGroupResultsViewer.prototype.render): Added.
(TestGroupResultsViewer.prototype._renderResultsTable): Compute the depth of the test tree we show, and construct
the header rows. Each sub test is "indented" by a new column.
(TestGroupResultsViewer.prototype._buildRowForTest): Added. Build rows for metrics of the given test. Expand the
list of its child tests if it's in expandedTests. Otherwise add a link to "Breakdown" if it has any child tests.
(TestGroupResultsViewer.prototype._buildRowForMetric): Added. Builds rows of table cells to show the results for
the given metric for each configuration.
(TestGroupResultsViewer.prototype._buildRowForMetric.createConfigurationRow): Added. A helper to build cells for
a given configuration represented by a requested commit set.
(TestGroupResultsViewer.prototype._buildValueMap): Added. Creates a mappting between a requested commit set, and
the list of values, mean, etc... associated with the results for the commit set.
(TestGroupResultsViewer.prototype._buildEmptyCells): Added. A helper to create empty cells to indent sub tests.
(TestGroupResultsViewer.prototype._expandCurrentMetrics): Added. Highlights the current metrics and renders the
label for each bar in the results.
(TestGroupResultsViewer.htmlTemplate): Added.
(TestGroupResultsViewer.cssTemplate): Added.

* public/v3/components/test-group-revision-table.js: Added.
(TestGroupRevisionTable): Added. Renders the list of revisions requested for each test configuration as well as
ones used in actual testing, and additional repositories being reported (e.g. repositories for helper scripts).
(TestGroupRevisionTable.prototype.setTestGroup): Added.
(TestGroupRevisionTable.prototype.setAnalysisResults): Added.
(TestGroupRevisionTable.prototype.render): Added.
(TestGroupRevisionTable.prototype._renderTable): Added. The basic algorithm here is to first create a row entry
object for each build request, merge cells that use the same revision of the same repository, and then render
the entire table.
(TestGroupRevisionTable.prototype._buildCommitCell): Added.
(TestGroupRevisionTable.prototype._buildCustomRootsCell): Added.
(TestGroupRevisionTable.prototype._mergeCellsWithSameCommitsAcrossRows): Added. Compute rowspan for each cell
by traversing the rows that use the same revision per repository, and store it in rowCountByRepository while
adding the repository to each succeeding row's repositoriesToSkip.
(TestGroupRevisionTable.htmlTemplate): Added.
(TestGroupRevisionTable.cssTemplate): Added.

* public/v3/index.html:
* public/v3/models/analysis-results.js:
(AnalysisResults): Added _metricIds and _lazilyComputedHighestTests as instance variables.
(AnalysisResults.prototype.findResult): Renamed from find.
(AnalysisResults.prototype.highestTests): Added.
(AnalysisResults.prototype._computeHighestTests): Added. Finds the root tests for this analysis result.
(AnalysisResults.prototype.add): Update _metricIds.
(AnalysisResults.prototype.commitSetForRequest): Added. Returns the reported commit set for the build request.
This commit set contains the set of revisions reported to /api/report by A/B testers.
(AnalysisResultsView.prototype.resultForRequest): Renamed from resultForBuildId.

* public/v3/models/metric.js:
(Metric.prototype.relativeName): Added. Computes the relative name given the test/metric path. This function is
used to determine the label for each test/metric in TestGroupResultsViewer.
(Metric.prototype.aggregatorLabel): Extracted from label.
(Metric.prototype.label):
(Metric.makeFormatter): Added the default value of false to alwaysShowSign.

* public/v3/models/test-group.js:
(TestGroup.prototype.compareTestResults): Now takes a metric instead of retrieving it from the analysis task
since a custom analysis task may not have a metric associated with it.

* public/v3/models/test.js:
(Test): Added _computePathLazily as an instance variable.
(Test.prototype.path): Lazily computes the path now that this function can be called on the same test for many
times in TestGroupResultsViewer while computing relative names of tests and metrics.
(Test.prototype._computePath): Extracted path.
(Test.prototype.fullName): Modernized the code.
(Test.prototype.relativeName): Added.

* public/v3/models/uploaded-file.js:
(UploadedFile):
(UploadedFile.prototype.deletedAt): Added.
(UploadedFile.prototype.label): Added.
(UploadedFile.prototype.url): Added.

* public/v3/pages/analysis-task-page.js:
(AnalysisTaskTestGroupPane.prototype.setTestGroups):
(AnalysisTaskTestGroupPane.prototype.setAnalysisResults): Replaced setAnalysisResultsView. Now takes an
analysisResults instead of its view.
(AnalysisTaskTestGroupPane.prototype.render): No longer enqueues the results table and the retry form to render
since the results table no longer exists, and the retry form re-renders itself as needed.
(AnalysisTaskTestGroupPane.htmlTemplate): Now uses test-group-results-viewer and test-group-revision-table
instead of test-group-results-table, which has been removed.
(AnalysisTaskTestGroupPane.cssTemplate):
(AnalysisTaskPage.prototype._assignTestResultsIfPossible):

* public/v3/pages/create-analysis-task-page.js:
(CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Removed superflous console.log's.

* tools/js/v3-models.js: Import LazilyEvaluatedFunction now that it's used in the Test model.

* unit-tests/test-model-tests.js: Added.

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

3 years agoValidate vImage arguments
bfulgham@apple.com [Fri, 21 Apr 2017 20:07:07 +0000 (20:07 +0000)]
Validate vImage arguments
https://bugs.webkit.org/show_bug.cgi?id=171109
Source/WebCore:

rdar://problem/30236606

Patch by Per Arne Vollan <pvollan@apple.com> on 2017-04-21
Reviewed by Brent Fulgham.

When writing data to a canvas context, clip the source rectangle to the data rectangle
to make sure we will not attempt to read data outside of the buffer.

Test: fast/canvas/canvas-crash.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::putImageData):

LayoutTests:

Patch by Per Arne Vollan <pvollan@apple.com> on 2017-04-21
Reviewed by Brent Fulgham.

* fast/canvas/canvas-crash-expected.txt: Added.
* fast/canvas/canvas-crash.html: Added.

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

3 years agoWeb Inspector: Add titles to Network grid items for easier reading when text overflows
webkit@devinrousso.com [Fri, 21 Apr 2017 20:06:09 +0000 (20:06 +0000)]
Web Inspector: Add titles to Network grid items for easier reading when text overflows
https://bugs.webkit.org/show_bug.cgi?id=170792

Reviewed by Brian Burg.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ResourceTimelineDataGridNode.prototype._cachedCellContent):
Do not add a title if the text is an em-dash, as that title will not convey any information.

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

3 years agoWeb Inspector: Don't show the Search tab if it's open and matches the representedObject
commit-queue@webkit.org [Fri, 21 Apr 2017 20:05:32 +0000 (20:05 +0000)]
Web Inspector: Don't show the Search tab if it's open and matches the representedObject
https://bugs.webkit.org/show_bug.cgi?id=168709

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-04-21
Reviewed by Brian Burg.

* UserInterface/Base/Main.js:
(WebInspector.handlePossibleLinkClick):
(WebInspector.openURL):
(WebInspector.showSourceCode):
(WebInspector.showOriginalUnformattedSourceCodeLocation):
(WebInspector.showOriginalOrFormattedSourceCodeLocation):
(WebInspector.showOriginalOrFormattedSourceCodeTextRange):
(WebInspector._frameWasAdded):
(WebInspector.createSourceCodeLocationLink):
(WebInspector.linkifyLocation):
(WebInspector.linkifyElement):
Add `options` parameter to provide greater customization.  Also fix some style issues.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView.prototype.hasRepresentedObject): Deleted.
* UserInterface/Views/NetworkSidebarPanel.js:
(WebInspector.NetworkSidebarPanel.prototype.hasRepresentedObject): Deleted.
* UserInterface/Views/NetworkTabContentView.js:
(WebInspector.NetworkTabContentView.prototype.canShowRepresentedObject):
* UserInterface/Views/SearchTabContentView.js:
(WebInspector.SearchTabContentView.prototype.canShowRepresentedObject):
Ensure that the Search tab can only display resources that it has entries for in its view.
Also rework the way in which this is determined.

* UserInterface/Controllers/BreakpointPopoverController.js:
(WebInspector.BreakpointPopoverController.prototype.appendContextMenuItems):
* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.showMainResourceForFrame):
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.refresh):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.tokenTrackingControllerHighlightedRangeWasClicked.showRangeInSourceCode):
(WebInspector.CSSStyleDeclarationTextEditor.tokenTrackingControllerHighlightedRangeWasClicked):
* UserInterface/Views/ComputedStyleDetailsPanel.js:
(WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty):
* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView.prototype._linkifyLocation):
* UserInterface/Views/DOMDetailsSidebarPanel.js:
(WebInspector.DOMDetailsSidebarPanel.prototype._mouseWasClicked):
* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype._mouseWasClicked.followLink):
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._showCustomElementDefinition):
* UserInterface/Views/DebuggerDashboardView.js:
(WebInspector.DebuggerDashboardView.prototype._rebuildLocation):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel.prototype._treeSelectionDidChange):
(WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonGotoArrow):
* UserInterface/Views/ErrorObjectView.js:
(WebInspector.ErrorObjectView.makeSourceLinkWithPrefix):
* UserInterface/Views/EventListenerSectionGroup.js:
(WebInspector.EventListenerSectionGroup.prototype._functionTextOrLink):
* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populatePreview):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._mouseoverHandler.appendPathRow):
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
(WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
(WebInspector.ObjectTreeBaseTreeElement):
* UserInterface/Views/ProbeSetDetailsSection.js:
(WebInspector.ProbeSetDetailsSection.prototype._updateLinkElement):
* UserInterface/Views/ProfileDataGridNode.js:
(WebInspector.ProfileDataGridNode.prototype._displayContent):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshRelatedResourcesSection):
(WebInspector.ResourceDetailsSidebarPanel.prototype._goToRequestDataClicked):
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange):
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype._dataGridNodeGoToArrowClicked):
* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel.prototype.refresh.insertMediaOrInheritanceLabel):
* UserInterface/Views/SearchSidebarPanel.js:
(WebInspector.SearchSidebarPanel.prototype._treeElementDoubleClick):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
* UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js:
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype._createNameCellContent):
* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype._popoverCallStackTreeSelectionDidChange):
* UserInterface/Views/TimelineDataGridNode.js:
(WebInspector.TimelineDataGridNode.prototype.createCellContent):
* UserInterface/Views/VisualStyleSelectorTreeItem.js:
(WebInspector.VisualStyleSelectorTreeItem.prototype.populateContextMenu):
Ensure that the Search tab is never shown from links generated by these functions.
Also do the same for the Network tab in some cases.

* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype.canShowContentViewForTreeElement): Deleted.
(WebInspector.NetworkTimelineView.prototype.showContentViewForTreeElement): Deleted.
Drive-by cleanup: remove dead code.

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

3 years agoSwitch from -std=gnu++11 to -std=gnu++14 for consistency in DerivedSources.make
ddkilzer@apple.com [Fri, 21 Apr 2017 20:02:04 +0000 (20:02 +0000)]
Switch from -std=gnu++11 to -std=gnu++14 for consistency in DerivedSources.make
<https://webkit.org/b/171122>

Reviewed by Brent Fulgham.

* DerivedSources.make: Switch to -std=gnu++14 for preprocessing
headers to check for build settings.

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

3 years ago[WK2][MediaCapture] Pass muted and enabled state across process boundary when capturi...
jer.noble@apple.com [Fri, 21 Apr 2017 20:01:50 +0000 (20:01 +0000)]
[WK2][MediaCapture] Pass muted and enabled state across process boundary when capturing in UIProcess
https://bugs.webkit.org/show_bug.cgi?id=170846

Reviewed by Jon Lee.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::setMuted):
(WebKit::UserMediaCaptureManagerProxy::setEnabled):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::setMuted):
(WebKit::UserMediaCaptureManager::Source::setEnabled):
(WebKit::UserMediaCaptureManager::setMuted):
(WebKit::UserMediaCaptureManager::setEnabled):
* WebProcess/cocoa/UserMediaCaptureManager.h:

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

3 years ago[WK2][MediaCapture] Remove now-unused WKWebViewConfiguration property for shouldCaptu...
jer.noble@apple.com [Fri, 21 Apr 2017 20:01:16 +0000 (20:01 +0000)]
[WK2][MediaCapture] Remove now-unused WKWebViewConfiguration property for shouldCaptureAudioInUIProcess
https://bugs.webkit.org/show_bug.cgi?id=170847

Reviewed by Jon Lee.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _shouldCaptureAudioInUIProcess]): Deleted.
(-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]): Deleted.

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

3 years ago[MediaCapture][iOS] AVAudioSession must be active and the correct category before...
jer.noble@apple.com [Fri, 21 Apr 2017 19:59:07 +0000 (19:59 +0000)]
[MediaCapture][iOS] AVAudioSession must be active and the correct category before IO AudioUnits start producing data.
https://bugs.webkit.org/show_bug.cgi?id=171095

Reviewed by Youenn Fablet.

If an input audio unit is asked to start before the AVAudioSession is in a recording category and active,
CoreAudio will return an error stating that no input device is available.

The PlatformMediaSessionManager will automatically set the category of and activate the AVAudioSession when one
of its associated MediaStreams has a capturing RealtimeMediaSource and is currently producing data.  To solve
the chicken-or-egg problem of activating the AVAudioSession before the source produces data, move the state bit
of "producing data" directly into MediaStreams, and notify the PlatformMediaSessionManager that capturing is
occurring after flipping that bit, but before asking the constituent tracks to begin producing data.

In places (i.e. UserMediaRequest) where we previously told a stream's tracks to begin producing data, instead
allow the stream to handle that by telling it to produce data directly.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::startProducingData):
(WebCore::MediaStream::stopProducingData):
(WebCore::MediaStream::mediaState):
(WebCore::MediaStream::mediaType):
(WebCore::MediaStream::characteristics):
(WebCore::MediaStream::canProduceAudio):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::allow):
* platform/mediastream/mac/CoreAudioCaptureSource.h:

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

3 years agoAdd a method to retrieve the current I/O buffer size from AudioSession
jer.noble@apple.com [Fri, 21 Apr 2017 19:56:05 +0000 (19:56 +0000)]
Add a method to retrieve the current I/O buffer size from AudioSession
https://bugs.webkit.org/show_bug.cgi?id=171126

Reviewed by Eric Carlson.

There is an existing method to get and set the preferred I/O buffer size; add a matching method to return
the acutal I/O buffer size.

* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::bufferSize):
* platform/audio/AudioSession.h:
* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::bufferSize):
* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::bufferSize):

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

3 years agoMake AudioSampleBufferList::reset() less expensive.
jer.noble@apple.com [Fri, 21 Apr 2017 19:22:47 +0000 (19:22 +0000)]
Make AudioSampleBufferList::reset() less expensive.
https://bugs.webkit.org/show_bug.cgi?id=171124

Reviewed by Eric Carlson.

Previously, AudioSampleBufferList would reallocate its constituent WebAudioBufferList every time reset() was
called. Instead, add a reset() method to WebAudioBufferList which re-initializes its AudioBufferList (which is a
simple memcpy of a 24-byte struct), reusing the existing memory buffers.

While making these changes, we'll also take the opportunity to clean up the AudioSampleBufferList class by
making some of its members into UniqueRefs instead of unique_ptrs, thus removing the possibility of null-
dereferences.

* platform/audio/WebAudioBufferList.cpp:
(WebCore::WebAudioBufferList::WebAudioBufferList):
(WebCore::WebAudioBufferList::reset):
* platform/audio/WebAudioBufferList.h:
* platform/audio/mac/AudioSampleBufferList.cpp:
(WebCore::AudioSampleBufferList::AudioSampleBufferList):
(WebCore::AudioSampleBufferList::applyGain):
(WebCore::AudioSampleBufferList::mixFrom):
(WebCore::AudioSampleBufferList::reset):
(WebCore::AudioSampleBufferList::zero):
(WebCore::AudioSampleBufferList::~AudioSampleBufferList): Deleted.
* platform/audio/mac/AudioSampleBufferList.h:
(WebCore::AudioSampleBufferList::bufferList):

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

3 years agoUnreviewed, fix Cloop build.
keith_miller@apple.com [Fri, 21 Apr 2017 19:04:56 +0000 (19:04 +0000)]
Unreviewed, fix Cloop build.

* jit/ExecutableAllocator.h:
(JSC::isJITPC):

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

3 years agoMark webrtc/datachannel/bufferedAmountLowThreshold.html as flaky.
ryanhaddad@apple.com [Fri, 21 Apr 2017 18:50:20 +0000 (18:50 +0000)]
Mark webrtc/datachannel/bufferedAmountLowThreshold.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170701

Unreviewed test gardening.

* TestExpectations:

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

3 years agoStop using deprecated APIs, part 4
andersca@apple.com [Fri, 21 Apr 2017 18:40:34 +0000 (18:40 +0000)]
Stop using deprecated APIs, part 4
https://bugs.webkit.org/show_bug.cgi?id=171125
rdar://problem/31589635

Reviewed by Tim Horton.

It doesn't really matter what we pass to these completion functions, since the sheet has already been dismissed at this point
so just remove the status parameter.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):

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

3 years agoAdd signaling API
keith_miller@apple.com [Fri, 21 Apr 2017 18:35:42 +0000 (18:35 +0000)]
Add signaling API
https://bugs.webkit.org/show_bug.cgi?id=170976

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Update various uses of sigaction to use the new signaling API.
Also switch VMTraps to use the thread message system instead of
rolling it's own.

* jit/ExecutableAllocator.h:
(JSC::isJITPC):
* runtime/VMTraps.cpp:
(JSC::installSignalHandler):
(JSC::VMTraps::VMTraps):
(JSC::VMTraps::SignalSender::send):
(JSC::handleSigusr1): Deleted.
(JSC::handleSigtrap): Deleted.
(JSC::installSignalHandlers): Deleted.
* runtime/VMTraps.h:
* tools/SigillCrashAnalyzer.cpp:
(JSC::installCrashHandler):
(JSC::handleCrash): Deleted.
* wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::trapHandler):
(JSC::Wasm::enableFastMemory):

Source/WTF:

This patch adds a bunch of new functionality to WTF. First, it add
a new data structure of a lockless bag. The LocklessBag class can
be used as either a multi-writer multi-reader lockless bag or a
multi-writer single consumer lockless bag.

Next, this patch adds an abstraction around sigaction in WTF.
Basically, you can add a handler, which can be an arbitrary
lambda. Although it should still be safe for the signal you are
handling.  the signal handler manager will then do all the
appropriate handling of chaining:

In the SIGUSR case we always forward the signal to any other
non-default handler installed before us. We need to do this,
otherwise, since it's not possible to tell if a SIGUSR was
intended exlusively for our handlers. Signal handlers don't record
how many times they were sent only that there is at least one
unhandled signal.

In the faulting cases we require that every handle be able to
recognise a fault they installed, vs crashes. If none of our
handlers claim to have handled the fault we will forward the
fault. If a handler was installed before the first fault handler
we simply call that handler and rely on them to take the
appropriate action. If no handler was installed before our first
handler we restore the default handler and allow the fault to
happen again.

Finally, this patch adds a signal based messaging system.  This
system allows the user to run an arbitrary lambda from the SIGUSR2
signal handler of any target WTF::Thread. This is already in use
for the VMTraps API which allows us to kill rogue VMs by sending
the VM's running WTF::Thread a SIGUSR and requesting it jetison
all optimized code and throw an uncatchable exception from all
function entries/loop backedges.  In the future, we will also use
this API for Wasm to reset the instruction caches in currently
executing Wasm threads.

* WTF.xcodeproj/project.pbxproj:
* wtf/Atomics.h:
(WTF::Atomic::Atomic):
* wtf/LocklessBag.h: Added.
(WTF::LocklessBag::LocklessBag):
(WTF::LocklessBag::add):
(WTF::LocklessBag::iterate):
(WTF::LocklessBag::consumeAll):
* wtf/ThreadMessage.cpp: Added.
(WTF::ThreadMessageData::ThreadMessageData):
(WTF::initializeThreadMessages):
(WTF::sendMessageScoped):
* wtf/ThreadMessage.h: Added.
(WTF::sendMessage):
* wtf/Threading.cpp:
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::threadMessages):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::currentMayBeNull):
(WTF::Thread::current):
(WTF::Thread::signal):
* wtf/threads/Signals.cpp: Added.
(WTF::jscSignalHandler):
(WTF::installSignalHandler):
* wtf/threads/Signals.h: Added.
(WTF::toSystemSignal):
(WTF::fromSystemSignal):

Tools:

Add tests for ThreadMessages.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/ThreadMessages.cpp: Added.
(runThreadMessageTest):
(TEST):

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

3 years ago-[WKUIDelegatePrivate _webView:requestUserMediaAuthorizationForMicrophone:camera...
commit-queue@webkit.org [Fri, 21 Apr 2017 18:32:58 +0000 (18:32 +0000)]
-[WKUIDelegatePrivate _webView:requestUserMediaAuthorizationForMicrophone:camera:url:mainFrameURL:decisionHandler:]
decision handler should only have one parameter.
https://bugs.webkit.org/show_bug.cgi?id=171081

Patch by Andrew Gold <agold@apple.com> on 2017-04-21
Reviewed by Tim Horton.

Because user media authorization is all or nothing, we should not have separate booleans
to indicate authorization. Additionally, rather than passing two separate booleans to the
UIDelegate, we now pass an NS_OPTIONS parameter.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _WKCaptureDevice NS_OPTIONS.

* UIProcess/Cocoa/UIDelegate.mm:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate): Uses new WKUIDelegatePrivate method.
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Ditto.

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

3 years agoX86-64 Assembler doesn't handle xchg with byte register src
msaboff@apple.com [Fri, 21 Apr 2017 18:28:51 +0000 (18:28 +0000)]
X86-64 Assembler doesn't handle xchg with byte register src
https://bugs.webkit.org/show_bug.cgi?id=171118

Reviewed by Saam Barati.

* assembler/X86Assembler.h:
(JSC::X86Assembler::xchgb_rm): Use oneByteOp8() since these are 8 bit opcodes.

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

3 years agoFix some spurious ASSERTs when working with capturing media elements
jer.noble@apple.com [Fri, 21 Apr 2017 18:09:41 +0000 (18:09 +0000)]
Fix some spurious ASSERTs when working with capturing media elements
https://bugs.webkit.org/show_bug.cgi?id=171096

Reviewed by Youenn Fablet.

Two related ASSERTS:

1) When we added a new PlatformMediaSession MediaType (MediaStreamCapturingAudio), we did not update all the
places that validated the enum. This would lead to spurious ASSERTs when an element capturing audio would
fail various checks to enusre it's type's validity.

2) Audio elements will ASSERT when they change page visibility, as they do not have a renderer which implements
visibleInViewportStateChanged(). So opt out of visibility-state checking for non-video media elements.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::resetRestrictions):
(WebCore::PlatformMediaSessionManager::addRestriction):
(WebCore::PlatformMediaSessionManager::removeRestriction):
(WebCore::PlatformMediaSessionManager::restrictions):
* platform/audio/PlatformMediaSessionManager.h:

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

3 years ago[INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
commit-queue@webkit.org [Fri, 21 Apr 2017 17:58:32 +0000 (17:58 +0000)]
[INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
https://bugs.webkit.org/show_bug.cgi?id=169458

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2017-04-21
Reviewed by JF Bastien.

Source/JavaScriptCore:

Use udat_formatForFields to iterate through the parts of a formatted date string.
Make formatToParts and related functions dependent on ICU version >= 55.

* icu/unicode/udat.h: Update to 55.1.
* icu/unicode/ufieldpositer.h: Added from 55.1.
* icu/unicode/uvernum.h: Update to 55.1
* runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::partTypeString): Convert UDateFormatField to string.
(JSC::IntlDateTimeFormat::formatToParts): Return parts of formatted date string.
* runtime/IntlDateTimeFormat.h:
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatPrototypeFuncFormatToParts): Add prototype function formatToParts.

LayoutTests:

Add tests for formatToParts

* js/intl-datetimeformat-expected.txt:
* js/script-tests/intl-datetimeformat.js:

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

3 years agocommit-log-editor should respect the git editor if one is set
conrad_shultz@apple.com [Fri, 21 Apr 2017 17:26:14 +0000 (17:26 +0000)]
commit-log-editor should respect the git editor if one is set
https://bugs.webkit.org/show_bug.cgi?id=171085
<rdar://problem/31745506>

Reviewed by Daniel Bates.

* Scripts/commit-log-editor:
If Git is available, consider GIT_LOG_EDITOR and any global Git editor preference when
deciding which editor to present. We examine the global editor preference since that may be
set automatically by installers or third-party tools.

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

3 years ago[cmake] WTF target should not have wtf and subdirectries in public interface
annulen@yandex.ru [Fri, 21 Apr 2017 17:26:07 +0000 (17:26 +0000)]
[cmake] WTF target should not have wtf and subdirectries in public interface
https://bugs.webkit.org/show_bug.cgi?id=171115

Reviewed by Michael Catanzaro.

In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of
targets as their public interface, so that linked targets can use them
implicitly without copying directory lists around. This matches existing
practice for all targets except WTF, headers from which are always included
with full path starting from "<wtf/...".

Since r209665 it became possible to include headers from wtf or its
subdirectories in CMake builds without using "<wtf/..." path. It should
not be allowed.

.:

* Source/cmake/WebKitMacros.cmake: Support xxx_PRIVATE_HEADERS
CMake variables.

Source/WebCore:

* platform/graphics/texmap/coordinated/TiledBackingStore.cpp: Fix
incorrect include of WTF header.

Source/WTF:

* wtf/CMakeLists.txt: WTF/wtf and its sudirectories should not be in
public include paths of WTF target.

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

3 years agoDo not paint the border of the box if the dirty region does not intersect with border...
yoon@igalia.com [Fri, 21 Apr 2017 16:58:49 +0000 (16:58 +0000)]
Do not paint the border of the box if the dirty region does not intersect with border area
https://bugs.webkit.org/show_bug.cgi?id=170988

Reviewed by Simon Fraser.

No new tests, since there is no change in behavior.

* platform/graphics/GeometryUtilities.cpp:
(WebCore::ellipseContainsPoint):
Checks if a point is within an ellipse.

* platform/graphics/GeometryUtilities.h:
Replace header-guards with #pragma once.

* platform/graphics/RoundedRect.cpp:
(WebCore::RoundedRect::contains):
Implemented to know the dirty rectangle intersects with rounded rectangle or not.
* platform/graphics/RoundedRect.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder):
When typing in decorated text box, the dirty rect generated only for the
inside of the text box, not for the decorations.  So we can avoid the
calculations to draw borders if the inner border totally covers the
target surface. It will optimize the rendering process since we don't
have to render border decorations whenever we type somethings in side of
the text input element.

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

3 years agoRemove another use of toPaymentAuthorizationStatus
andersca@apple.com [Fri, 21 Apr 2017 16:40:57 +0000 (16:40 +0000)]
Remove another use of toPaymentAuthorizationStatus
https://bugs.webkit.org/show_bug.cgi?id=171114

Reviewed by Dan Bernstein.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::completeShippingContactSelection):

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

3 years agoUnreviewed, added missing file to PlatformMac.cmake
annulen@yandex.ru [Fri, 21 Apr 2017 15:13:13 +0000 (15:13 +0000)]
Unreviewed, added missing file to PlatformMac.cmake

* PlatformMac.cmake:

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

3 years agoUnreviewed follow-up for r215609
annulen@yandex.ru [Fri, 21 Apr 2017 15:00:10 +0000 (15:00 +0000)]
Unreviewed follow-up for r215609

* UIProcess/API/Cocoa/WKWebView.mm: Move internal header include too.

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

3 years agoInclude iOS-specific headers inside preprocessor guard
annulen@yandex.ru [Fri, 21 Apr 2017 14:44:30 +0000 (14:44 +0000)]
Include iOS-specific headers inside preprocessor guard
https://bugs.webkit.org/show_bug.cgi?id=171104

Reviewed by Michael Catanzaro.

This patch should fix Mac cmake build.

* UIProcess/API/Cocoa/WKWebView.mm:

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

3 years agoReduce copies and allocations in SharedBuffer::append
achristensen@apple.com [Fri, 21 Apr 2017 14:21:46 +0000 (14:21 +0000)]
Reduce copies and allocations in SharedBuffer::append
https://bugs.webkit.org/show_bug.cgi?id=170956

Reviewed by Andreas Kling.

Source/WebCore:

SharedBuffer was a mess of different data structures added over the years.
SharedBuffer::append would allocate large Vector<char>s and call memcpy, and that
is inefficient and causes crashes when large allocations fail, and the allocations
and copies aren't even necessary.  There were also const correctness problems in
ResourceLoader::addDataOrBuffer, and iterating a SharedBuffer was strange because
sometimes we don't want to add unnecessary copies.

These problems are solved by making SharedBuffer a Vector of read-only data segments,
which can be contained in various ways but we don't care because all we want to do is
read them.  Appending SharedBuffers is now const correct because we just add to a
Vector<Ref<DataSegment>> and neither SharedBuffer can write to the data.  Sometimes,
though, we want all the data to be in continuous memory, and if there are multiple
segments then the data needs to be copied once to a new segment.  We should audit the
call sites of SharedBuffer::data and see if this is really necessary.

No change in functional behavior.  Fewer copies of the data are made when buffering
data in the NetworkProcess.  No extra memory is allocated for bytes we think we might
need to append in the future.  Data is now only copied into one buffer lazily as needed,
which could slightly change when small delays from memcpy happen, but it's an overall
improvement.  We could have a performance hit if we were to call append() then data()
then append() then data() etc. but that doesn't happen in WebKit because we call append
repeatedly when buffering the data then call data() once when reading the data.

* editing/cocoa/EditorCocoa.mm:
(WebCore::archivedDataForAttributedString):
(WebCore::Editor::selectionInWebArchiveFormat):
(WebCore::Editor::dataInRTFDFormat):
(WebCore::Editor::dataInRTFFormat):
* editing/ios/EditorIOS.mm:
(WebCore::Editor::WebContentReader::readURL):
* editing/mac/EditorMac.mm:
(WebCore::Editor::imageInWebArchiveFormat):
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::processNewCueData):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createResource):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::tryReplaceEncodedData):
* loader/cocoa/DiskCacheMonitorCocoa.mm:
(WebCore::DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::SharedBuffer):
(WebCore::SharedBuffer::create):
(WebCore::SharedBuffer::combineToOneSegment):
(WebCore::SharedBuffer::data):
(WebCore::SharedBuffer::createArrayBuffer):
(WebCore::SharedBuffer::append):
(WebCore::SharedBuffer::clear):
(WebCore::SharedBuffer::copy):
(WebCore::SharedBuffer::DataSegment::data):
(WebCore::SharedBuffer::DataSegment::size):
(WebCore::segmentIndex): Deleted.
(WebCore::offsetInSegment): Deleted.
(WebCore::allocateSegment): Deleted.
(WebCore::freeSegment): Deleted.
(WebCore::SharedBuffer::~SharedBuffer): Deleted.
(WebCore::SharedBuffer::size): Deleted.
(WebCore::SharedBuffer::duplicateDataBufferIfNecessary): Deleted.
(WebCore::SharedBuffer::appendToDataBuffer): Deleted.
(WebCore::SharedBuffer::clearDataBuffer): Deleted.
(WebCore::SharedBuffer::copyBufferAndClear): Deleted.
(WebCore::SharedBuffer::buffer): Deleted.
(WebCore::SharedBuffer::getSomeData): Deleted.
(WebCore::SharedBuffer::maybeTransferMappedFileData): Deleted.
(WebCore::SharedBuffer::clearPlatformData): Deleted.
(WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
(WebCore::SharedBuffer::hasPlatformData): Deleted.
(WebCore::SharedBuffer::platformData): Deleted.
(WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
* platform/SharedBuffer.h:
(WebCore::SharedBuffer::create): Deleted.
(WebCore::SharedBuffer::isEmpty): Deleted.
* platform/SharedBufferChunkReader.cpp:
(WebCore::SharedBufferChunkReader::nextChunk):
(WebCore::SharedBufferChunkReader::peek):
* platform/SharedBufferChunkReader.h:
* platform/URLParser.cpp:
(WebCore::URLParser::URLParser):
* platform/cf/KeyedEncoderCF.cpp:
(WebCore::KeyedEncoderCF::finishEncoding):
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::SharedBuffer):
(WebCore::SharedBuffer::createCFData):
(WebCore::SharedBuffer::create):
(WebCore::SharedBuffer::hintMemoryNotNeededSoon):
(WebCore::SharedBuffer::append):
(WebCore::SharedBuffer::wrapCFData): Deleted.
(WebCore::SharedBuffer::hasPlatformData): Deleted.
(WebCore::SharedBuffer::platformData): Deleted.
(WebCore::SharedBuffer::platformDataSize): Deleted.
(WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
(WebCore::SharedBuffer::clearPlatformData): Deleted.
(WebCore::SharedBuffer::tryReplaceContentsWithPlatformBuffer): Deleted.
(WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
(WebCore::SharedBuffer::copyBufferAndClear): Deleted.
(WebCore::SharedBuffer::copySomeDataFromDataArray): Deleted.
(WebCore::SharedBuffer::singleDataArrayBuffer): Deleted.
(WebCore::SharedBuffer::maybeAppendDataArray): Deleted.
* platform/cocoa/NetworkExtensionContentFilter.mm:
(WebCore::NetworkExtensionContentFilter::replacementData):
* platform/cocoa/ParentalControlsContentFilter.mm:
(WebCore::ParentalControlsContentFilter::replacementData):
* platform/cocoa/SharedBufferCocoa.mm:
(-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
(-[WebCoreSharedBufferData length]):
(-[WebCoreSharedBufferData bytes]):
(WebCore::SharedBuffer::create):
(WebCore::SharedBuffer::createCFData):
(WebCore::SharedBuffer::createFromReadingFile):
(WebCore::SharedBuffer::createNSDataArray):
(-[WebCoreSharedBufferData initWithSharedBufferDataBuffer:]): Deleted.
(WebCore::SharedBuffer::wrapNSData): Deleted.
(WebCore::SharedBuffer::existingCFData): Deleted.
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::openTypeTable):
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(ResourceHandleStreamingClient::didReceiveBuffer):
* platform/graphics/mac/ImageMac.mm:
(WebCore::Image::loadPlatformResource):
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::create):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageReader::decode):
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::readBuffer):
* platform/mac/PasteboardMac.mm:
(WebCore::writeFileWrapperAsRTFDAttachment):
(WebCore::Pasteboard::write):
* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::bufferForType):
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyReceiveData):
* platform/network/MIMEHeader.cpp:
* platform/network/MIMEHeader.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData):
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
* platform/soup/SharedBufferSoup.cpp:
(WebCore::SharedBuffer::SharedBuffer):
(WebCore::SharedBuffer::createSoupBuffer):
(WebCore::SharedBuffer::clearPlatformData): Deleted.
(WebCore::SharedBuffer::maybeTransferPlatformData): Deleted.
(WebCore::SharedBuffer::hasPlatformData): Deleted.
(WebCore::SharedBuffer::platformData): Deleted.
(WebCore::SharedBuffer::platformDataSize): Deleted.
(WebCore::SharedBuffer::maybeAppendPlatformData): Deleted.
(WebCore::SharedBuffer::tryReplaceContentsWithPlatformBuffer): Deleted.

Source/WebKit/mac:

* WebView/WebArchive.mm:
(-[WebArchive initWithData:]):
* WebView/WebFrame.mm:
(-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]):
* WebView/WebResource.mm:
(-[WebResource initWithCoder:]):
(-[WebResource _initWithData:URL:MIMEType:textEncodingName:frameName:response:copyData:]):

Source/WebKit2:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
* Platform/IPC/DataReference.cpp:
(IPC::SharedBufferDataReference::encode):
* Shared/ShareableResource.cpp:
(WebKit::ShareableResource::wrapInSharedBuffer):
* UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:
(-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::addArchiveResource):
(WebKit::PDFPlugin::liveResourceData):
(WebKit::PDFPlugin::writeItemsToPasteboard):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::redeliverManualStream):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::declareAndWriteDragImage):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::cachedResponseDataForURL):

Tools:

* TestWebKitAPI/Tests/WebCore/cocoa/SharedBuffer.mm:
(TestWebKitAPI::TEST_F):

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

3 years agoExpose obscured insets to web content (as "safe area insets")
timothy_horton@apple.com [Fri, 21 Apr 2017 07:34:18 +0000 (07:34 +0000)]
Expose obscured insets to web content (as "safe area insets")
https://bugs.webkit.org/show_bug.cgi?id=171013
<rdar://problem/31564652>

Reviewed by Wenson Hsieh and Dave Hyatt.

Tests: fast/css/variables/constants/invalid-constant-name-fallback.html
       fast/css/variables/constants/ios/safe-area-inset-set.html
       fast/css/variables/constants/safe-area-inset-cannot-override.html
       fast/css/variables/constants/safe-area-inset-zero.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSValueKeywords.in:
* css/CSSVariableData.cpp:
(WebCore::CSSVariableData::checkVariablesForCyclesWithRange):
(WebCore::CSSVariableData::resolveTokenRange):
* css/parser/CSSVariableParser.cpp:
(WebCore::isValidConstantName):
(WebCore::classifyBlock):
(WebCore::isValidConstantReference):
Add a constant() function, which takes both custom properties and
arbitrary idents which are looked up in ConstantPropertyMap, allowing
fallback from the arbitrary, UA-defined idents to custom properties.

* dom/ConstantPropertyMap.cpp: Added.
(WebCore::ConstantPropertyMap::ConstantPropertyMap):
(WebCore::ConstantPropertyMap::values):
(WebCore::ConstantPropertyMap::nameForProperty):
(WebCore::ConstantPropertyMap::setValueForProperty):
(WebCore::ConstantPropertyMap::buildValues):
(WebCore::variableDataForSafeAreaInset):
(WebCore::ConstantPropertyMap::didChangeObscuredInsets):
* dom/ConstantPropertyMap.h: Added.
Keep a mapping of UA-defined "constants", which can be looked up
from CSS via the aforementioned function. For now, this mapping
includes only safe-area-inset-{top, right, bottom, left}, which
expose the obscured insets (now that they can be painted into via
the viewport parameter clip-to-safe-area-inset=no).

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::didChangeObscuredInsets):
* dom/Document.h:
(WebCore::Document::constantProperties):
* page/Page.cpp:
(WebCore::Page::setObscuredInsets):
* page/Page.h:
(WebCore::Page::setObscuredInsets): Deleted.
Make setObscuredInsets and related storage not iOS-specific, though
nothing from the other platforms yet calls this code.

* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
Grab the constant properties from ConstantPropertyMap and plop them into
the CustomPropertyValueMap. Constant properties aren't allowed to start
with --, and variable properties must, so there is no opportunity here
for exposing things to var() (or allowing custom properties to override
UA-defined constant properties).

* TestExpectations:
* fast/css/variables/constants/invalid-constant-name-fallback-expected.html: Added.
* fast/css/variables/constants/invalid-constant-name-fallback.html: Added.
* fast/css/variables/constants/ios/safe-area-inset-set-expected.html: Added.
* fast/css/variables/constants/ios/safe-area-inset-set.html: Added.
* fast/css/variables/constants/safe-area-inset-cannot-override-expected.html: Added.
* fast/css/variables/constants/safe-area-inset-cannot-override.html: Added.
* fast/css/variables/constants/safe-area-inset-zero-expected.html: Added.
* fast/css/variables/constants/safe-area-inset-zero.html: Added.
* platform/ios-wk2/TestExpectations:

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

3 years ago[cmake] Define FORWARDING_HEADERS_DIR in WebKitFS and use it everywhere
annulen@yandex.ru [Fri, 21 Apr 2017 06:08:13 +0000 (06:08 +0000)]
[cmake] Define FORWARDING_HEADERS_DIR in WebKitFS and use it everywhere
https://bugs.webkit.org/show_bug.cgi?id=171071

Reviewed by Michael Catanzaro.

"${DERIVED_SOURCES_DIR}/ForwardingHeaders" path occurs very often in the
build system files. GTK-specifc FORWARDING_HEADERS_DIR variable should
be available for all ports.

.:

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/WebKitFS.cmake:
* Source/cmake/WebKitMacros.cmake:

Source/JavaScriptCore:

* CMakeLists.txt:
* PlatformWin.cmake:

Source/ThirdParty/ANGLE:

* CMakeLists.txt:

Source/WebCore:

* CMakeLists.txt:
* PlatformMac.cmake:
* PlatformWin.cmake:
* PlatformWinCairo.cmake:

Source/WebKit:

* CMakeLists.txt:
* PlatformMac.cmake:
* PlatformWin.cmake:

Source/WebKit2:

* CMakeLists.txt:
* PlatformMac.cmake:

Tools:

* DumpRenderTree/PlatformMac.cmake:
* MiniBrowser/mac/CMakeLists.txt:
* MiniBrowser/win/CMakeLists.txt:
* TestWebKitAPI/PlatformJSCOnly.cmake:
* TestWebKitAPI/PlatformMac.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* WebKitTestRunner/PlatformMac.cmake:

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

3 years agoUnreviewed, rolling out r215597.
commit-queue@webkit.org [Fri, 21 Apr 2017 06:04:20 +0000 (06:04 +0000)]
Unreviewed, rolling out r215597.
https://bugs.webkit.org/show_bug.cgi?id=171102

Made all tests crash under GuardMalloc (Requested by ap on
#webkit).

Reverted changeset:

"Expose obscured insets to web content (as "safe area
insets")"
https://bugs.webkit.org/show_bug.cgi?id=171013
http://trac.webkit.org/changeset/215597

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

3 years agoFix typo
dino@apple.com [Fri, 21 Apr 2017 05:36:11 +0000 (05:36 +0000)]
Fix typo

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

3 years agoAdd Web Sharing to the features under consideration.
dino@apple.com [Fri, 21 Apr 2017 05:34:58 +0000 (05:34 +0000)]
Add Web Sharing to the features under consideration.

* features.json:

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

3 years agoAdd Scroll Anchoring to features under consideration.
dino@apple.com [Fri, 21 Apr 2017 05:20:38 +0000 (05:20 +0000)]
Add Scroll Anchoring to features under consideration.

* features.json:

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

3 years agoRemove unused lamda captures
annulen@yandex.ru [Fri, 21 Apr 2017 03:38:16 +0000 (03:38 +0000)]
Remove unused lamda captures
https://bugs.webkit.org/show_bug.cgi?id=171098

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

* bytecompiler/NodesCodegen.cpp:
(JSC::ArrayNode::emitBytecode):
* ftl/FTLState.cpp:
(JSC::FTL::State::State):
* wasm/WasmB3IRGenerator.cpp:

Source/WebCore:

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore):
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):

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

3 years ago[JSC][FTL] FTL should support Arrayify
utatane.tea@gmail.com [Fri, 21 Apr 2017 02:08:28 +0000 (02:08 +0000)]
[JSC][FTL] FTL should support Arrayify
https://bugs.webkit.org/show_bug.cgi?id=169596

Reviewed by Saam Barati.

JSTests:

* stress/arrayify.js: Added.
(arrayifyInt32):
(arrayifyDouble):
(arrayifyContiguous):

Source/JavaScriptCore:

This patch simply expands the coverage of FTL by supporting Arrayify.
While ArrayifyToStructure is already supported, Arrayify is not supported
in FTL. While supporting Arrayify in FTL itself does not offer so much
performance difference from DFG's one, no FTL support for Arrayify
prevents us applying FTL to the code including Arrayify.

* dfg/DFGArrayMode.cpp:
(JSC::DFG::toIndexingShape):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileArrayify):
(JSC::FTL::DFG::LowerDFGToB3::compileCheckArray):
(JSC::FTL::DFG::LowerDFGToB3::isArrayTypeForArrayify):
(JSC::FTL::DFG::LowerDFGToB3::isArrayTypeForCheckArray):
(JSC::FTL::DFG::LowerDFGToB3::compileArrayifyToStructure): Deleted.
(JSC::FTL::DFG::LowerDFGToB3::isArrayType): Deleted.

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

3 years agoTest262 bot does not go red with failures
joepeck@webkit.org [Fri, 21 Apr 2017 01:49:59 +0000 (01:49 +0000)]
Test262 bot does not go red with failures
https://bugs.webkit.org/show_bug.cgi?id=171044

Reviewed by Aakash Jain.

The piped output of run-jsc-stress-tests is different from
its non-piped output. Switch to parsing the correct output.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(RunTest262Tests.countFailures):
Just count the number of lines that start with "FAIL:".

* BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
(RunTest262TestsTest.test_no_regressions_output):
(test_failure_output):
(test_failures_output):
Updated tests with new sample output produced partially from bots and
locally. In cases of failure the return code of run-jsc-stress-tests
is still 0 so update the expected return code in the tests.

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

3 years agoWebContent process becomes unresponsive after returning nil from async version of...
beidson@apple.com [Fri, 21 Apr 2017 01:02:47 +0000 (01:02 +0000)]
WebContent process becomes unresponsive after returning nil from async version of -webView:createWebViewWithConfiguration:...
<rdar://problem/31739023> and https://bugs.webkit.org/show_bug.cgi?id=171090

Reviewed by Andy Estes.

Source/WebKit2:

* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::createNewPageCommon): Handle the perfectly valid "nil webView" case correctly.

Tools:

* TestWebKitAPI/Tests/WebKit2/open-and-close-window.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:
(resetToConsistentState):
(-[OpenAndCloseWindowUIDelegate webViewDidClose:]):
(-[OpenAndCloseWindowUIDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
(TEST):
(-[OpenAndCloseWindowUIDelegateAsync _webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:completionHandler:]):

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

3 years agoExpose obscured insets to web content (as "safe area insets")
timothy_horton@apple.com [Fri, 21 Apr 2017 01:00:46 +0000 (01:00 +0000)]
Expose obscured insets to web content (as "safe area insets")
https://bugs.webkit.org/show_bug.cgi?id=171013
<rdar://problem/31564652>

Reviewed by Wenson Hsieh and Dave Hyatt.

Tests: fast/css/variables/constants/invalid-constant-name-fallback.html
       fast/css/variables/constants/ios/safe-area-inset-set.html
       fast/css/variables/constants/safe-area-inset-cannot-override.html
       fast/css/variables/constants/safe-area-inset-zero.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSValueKeywords.in:
* css/CSSVariableData.cpp:
(WebCore::CSSVariableData::checkVariablesForCyclesWithRange):
(WebCore::CSSVariableData::resolveTokenRange):
* css/parser/CSSVariableParser.cpp:
(WebCore::isValidConstantName):
(WebCore::classifyBlock):
(WebCore::isValidConstantReference):
Add a constant() function, which takes both custom properties and
arbitrary idents which are looked up in ConstantPropertyMap, allowing
fallback from the arbitrary, UA-defined idents to custom properties.

* dom/ConstantPropertyMap.cpp: Added.
(WebCore::ConstantPropertyMap::ConstantPropertyMap):
(WebCore::ConstantPropertyMap::values):
(WebCore::ConstantPropertyMap::nameForProperty):
(WebCore::ConstantPropertyMap::setValueForProperty):
(WebCore::ConstantPropertyMap::buildValues):
(WebCore::variableDataForSafeAreaInset):
(WebCore::ConstantPropertyMap::didChangeObscuredInsets):
* dom/ConstantPropertyMap.h: Added.
Keep a mapping of UA-defined "constants", which can be looked up
from CSS via the aforementioned function. For now, this mapping
includes only safe-area-inset-{top, right, bottom, left}, which
expose the obscured insets (now that they can be painted into via
the viewport parameter clip-to-safe-area-inset=no).

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::didChangeObscuredInsets):
* dom/Document.h:
(WebCore::Document::constantProperties):
* page/Page.cpp:
(WebCore::Page::setObscuredInsets):
* page/Page.h:
(WebCore::Page::setObscuredInsets): Deleted.
Make setObscuredInsets and related storage not iOS-specific, though
nothing from the other platforms yet calls this code.

* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
Grab the constant properties from ConstantPropertyMap and plop them into
the CustomPropertyValueMap. Constant properties aren't allowed to start
with --, and variable properties must, so there is no opportunity here
for exposing things to var() (or allowing custom properties to override
UA-defined constant properties).

* TestExpectations:
* fast/css/variables/constants/invalid-constant-name-fallback-expected.html: Added.
* fast/css/variables/constants/invalid-constant-name-fallback.html: Added.
* fast/css/variables/constants/ios/safe-area-inset-set-expected.html: Added.
* fast/css/variables/constants/ios/safe-area-inset-set.html: Added.
* fast/css/variables/constants/safe-area-inset-cannot-override-expected.html: Added.
* fast/css/variables/constants/safe-area-inset-cannot-override.html: Added.
* fast/css/variables/constants/safe-area-inset-zero-expected.html: Added.
* fast/css/variables/constants/safe-area-inset-zero.html: Added.
* platform/ios-wk2/TestExpectations:

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

3 years agovirtualThunkFor() needs to materialize its of tagMaskRegister for tail calls.
mark.lam@apple.com [Fri, 21 Apr 2017 00:30:44 +0000 (00:30 +0000)]
virtualThunkFor() needs to materialize its of tagMaskRegister for tail calls.
https://bugs.webkit.org/show_bug.cgi?id=171079
<rdar://problem/31684756>

Reviewed by Saam Barati.

JSTests:

* stress/regress-171079.js: Added.

Source/JavaScriptCore:

This is needed because tail calls would restore callee saved registers (and
therefore, potentially clobber the tag registers) before jumping to the thunk.

* jit/ThunkGenerators.cpp:
(JSC::virtualThunkFor):

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

3 years agoBuild fix after r215592.
mark.lam@apple.com [Fri, 21 Apr 2017 00:20:59 +0000 (00:20 +0000)]
Build fix after r215592.
https://bugs.webkit.org/show_bug.cgi?id=171088

Not reviewed.

* assembler/MacroAssemblerPrinter.h:

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

3 years ago[ios-simulator] PositionInformationTests API tests are timing out
wenson_hsieh@apple.com [Fri, 21 Apr 2017 00:00:02 +0000 (00:00 +0000)]
[ios-simulator] PositionInformationTests API tests are timing out
https://bugs.webkit.org/show_bug.cgi?id=171089

Rubber-stamped by Tim Horton.

Addresses failures observed in the new position information tests added in r215573 by only running them if the
DATA_INTERACTION feature flag is enabled.

* TestWebKitAPI/Tests/ios/PositionInformationTests.mm:

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

3 years agoUpdate the MASM probe to only take 1 arg instead of 2 (in addition to the callback...
mark.lam@apple.com [Thu, 20 Apr 2017 23:55:45 +0000 (23:55 +0000)]
Update the MASM probe to only take 1 arg instead of 2 (in addition to the callback function).
https://bugs.webkit.org/show_bug.cgi?id=171088

Reviewed by Michael Saboff and Saam Barati.

Experience shows that we never use the 2nd arg.  So, let's remove it to reduce
the footprint at each probe site.

Also fix the MacroAssembler::print() function so that it is a no-op when
!ENABLE(MASM_PROBE).  This will allow us to have print() statements in JIT code
without a lot of #if ENABLE(MASM_PROBE)s later.

* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssembler.cpp:
(JSC::stdFunctionCallback):
(JSC::MacroAssembler::probe):
* assembler/MacroAssembler.h:
* assembler/MacroAssemblerARM.cpp:
(JSC::MacroAssemblerARM::probe):
* assembler/MacroAssemblerARM.h:
* assembler/MacroAssemblerARM64.cpp:
(JSC::MacroAssemblerARM64::probe):
* assembler/MacroAssemblerARM64.h:
* assembler/MacroAssemblerARMv7.cpp:
(JSC::MacroAssemblerARMv7::probe):
* assembler/MacroAssemblerARMv7.h:
* assembler/MacroAssemblerPrinter.cpp:
(JSC::MacroAssemblerPrinter::printCallback):
* assembler/MacroAssemblerPrinter.h:
(JSC::MacroAssemblerPrinter::print):
(JSC::MacroAssembler::print):
* assembler/MacroAssemblerX86Common.cpp:
(JSC::MacroAssemblerX86Common::probe):
* assembler/MacroAssemblerX86Common.h:

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

3 years agoMark media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel...
ryanhaddad@apple.com [Thu, 20 Apr 2017 23:53:28 +0000 (23:53 +0000)]
Mark media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169109

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoMark imported/w3c/web-platform-tests/WebCryptoAPI/sign_verify/ecdsa.worker.html as...
ryanhaddad@apple.com [Thu, 20 Apr 2017 23:53:25 +0000 (23:53 +0000)]
Mark imported/w3c/web-platform-tests/WebCryptoAPI/sign_verify/ecdsa.worker.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170921

Unreviewed test gardening.

* TestExpectations:

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

3 years agoDisable header postprocessing when building for Sierra
mitz@apple.com [Thu, 20 Apr 2017 23:50:55 +0000 (23:50 +0000)]
Disable header postprocessing when building for Sierra

Absolutely rubber-stamped by Anders Carlsson.

* Configurations/WebKit.xcconfig:

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

3 years agoRemove one use of toPaymentAuthorizationStatus
andersca@apple.com [Thu, 20 Apr 2017 23:49:34 +0000 (23:49 +0000)]
Remove one use of toPaymentAuthorizationStatus
https://bugs.webkit.org/show_bug.cgi?id=171086

Reviewed by Tim Horton.

Just switch on the individual ApplePaySession::STATUS_ values.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::completeShippingMethodSelection):

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

3 years agoCocoa: add private API for suppressing first responder changes
mrajca@apple.com [Thu, 20 Apr 2017 23:42:00 +0000 (23:42 +0000)]
Cocoa: add private API for suppressing first responder changes
https://bugs.webkit.org/show_bug.cgi?id=171069
<rdar://problem/31658967>

Reviewed by Tim Horton.

Some clients may not want the web view to be programmatically made the first responder
and invoking -makeFirstResponder: unconditionally posts 'first responder did change'
notifications.

Added API test.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setShouldSuppressFirstResponderChanges:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setShouldSuppressFirstResponderChanges):
* UIProcess/PageClient.h:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::makeFirstResponder):

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

3 years agoSkip WebKit2.OpenAndCloseWindowAsyncCallbackException for now.
beidson@apple.com [Thu, 20 Apr 2017 23:27:16 +0000 (23:27 +0000)]
Skip WebKit2.OpenAndCloseWindowAsyncCallbackException for now.
https://bugs.webkit.org/show_bug.cgi?id=171083

Unreviewed.

* TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:

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

3 years ago[WinCairo] Fix build break after updating ANGLE
commit-queue@webkit.org [Thu, 20 Apr 2017 23:11:52 +0000 (23:11 +0000)]
[WinCairo] Fix build break after updating ANGLE
https://bugs.webkit.org/show_bug.cgi?id=170980

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-04-20
Reviewed by Brent Fulgham.

Source/ThirdParty/ANGLE:

* CMakeLists.txt: Added some new source files.
* PlatformMac.cmake: Ditto.
* PlatformWin.cmake: Ditto. Remove a macro 'ANGLE_WEBKIT_WIN'
because SoftLinking is not used anymore.
* src/third_party/systeminfo/: Restored.

Source/WebCore:

By stopping using SoftLinking for ANGLE, some changes are needed
for WebCore and WebKit.
  - Define a macro 'GL_GLEXT_PROTOTYPES' before #include <GLES2/gl2.h> or <GLES2/gl2ext.h>.
  - Link libEGL import library explicitly.

* PlatformWin.cmake: Link libEGL to WebCore.
* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::initializeEGLDisplay): Removed the code for SoftLinking.
* platform/graphics/GLContext.cpp: Define GL_GLEXT_PROTOTYPES.
* platform/graphics/egl/GLContextEGL.cpp: Ditto.
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: Ditto.
* platform/graphics/opengl/Extensions3DOpenGLES.h: Ditto.
* platform/graphics/opengl/TemporaryOpenGLSetting.cpp: Ditto.
* platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp: Ditto.

Source/WebKit/win:

* WebCoreSupport/AcceleratedCompositingContext.cpp: Define GL_GLEXT_PROTOTYPES.

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

3 years agoWeb Inspector: Add regular expression support to XHR breakpoints
mattbaker@apple.com [Thu, 20 Apr 2017 23:09:55 +0000 (23:09 +0000)]
Web Inspector: Add regular expression support to XHR breakpoints
https://bugs.webkit.org/show_bug.cgi?id=170099
<rdar://problem/31558082>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/DOMDebugger.json:
New optional `isRegex` parameter denotes whether `url` contains
a regular expression.

Source/WebCore:

* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
Use ContentSearchUtilities for both Text and RegularExpression breakpoints.

* inspector/InspectorDOMDebuggerAgent.h:
Associate XHR breakpoint with a type.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New strings for the Add XHR Breakpoint popover.

* UserInterface/Controllers/DOMDebuggerManager.js:
(WebInspector.DOMDebuggerManager):
(WebInspector.DOMDebuggerManager.prototype.addXHRBreakpoint):
Update for new XHRBreakpoint constructor.
(WebInspector.DOMDebuggerManager.prototype._updateXHRBreakpoint):
Set `isRegex` flag.

* UserInterface/Main.html:
New files for CodeMirror mode and breakpoint popover.

* UserInterface/Models/XHRBreakpoint.js:
Breakpoint can be of type Text or RegularExpression.
(WebInspector.XHRBreakpoint):
(WebInspector.XHRBreakpoint.prototype.get type):
(WebInspector.XHRBreakpoint.prototype.get serializableInfo):

* UserInterface/Views/CodeMirrorRegexMode.css: Added.
(.cm-s-default .cm-regex-character-set):
(.cm-s-default .cm-regex-character-set-negate):
(.cm-s-default :matches(.cm-regex-escape, .cm-regex-escape-2, .cm-regex-escape-3)):
(.cm-s-default :matches(.cm-regex-group, .cm-regex-lookahead)):
(.cm-s-default .cm-regex-quantifier):
(.cm-s-default :matches(.cm-regex-literal, .cm-regex-special, .cm-regex-backreference)):
Colors for regular expression syntax highlighting. The regex mode emits
more class names than we have separate colors for, allowing for further
customization in the future.

* UserInterface/Views/CodeMirrorRegexMode.js: Added.
(characterSetTokenizer):
(consumeEscapeSequence):
(tokenBase):
New CodeMirror mode for highlighting "text/x-regex" content.

* UserInterface/Views/DebuggerSidebarPanel.js:
Use new popover type for creating XHR breakpoints.
(WebInspector.DebuggerSidebarPanel.prototype._addXHRBreakpointButtonClicked):
(WebInspector.DebuggerSidebarPanel.prototype.willDismissPopover):
(WebInspector.DebuggerSidebarPanel):

* UserInterface/Views/XHRBreakpointPopover.css: Added.
(.popover .xhr-breakpoint-content):
(.popover .xhr-breakpoint-content > .editor-wrapper):
(.popover .xhr-breakpoint-content > .editor-wrapper > .editor):
(body[dir=ltr] .popover .xhr-breakpoint-content > .editor-wrapper > .editor):
(body[dir=rtl] .popover .xhr-breakpoint-content > .editor-wrapper > .editor):
(.popover .xhr-breakpoint-content > .editor-wrapper > .editor > .CodeMirror):
(.popover .xhr-breakpoint-content > .editor-wrapper > .editor > .CodeMirror-scroll):
Styles for new popover.

* UserInterface/Views/XHRBreakpointPopover.js: Added.
New popover class. Includes a picker for selecting breakpoint type
(Text or RegularExpression), and has an improved popover caption. Input
field style and placeholder text changes based on the breakpoint type.

(WebInspector.XHRBreakpointPopover):
(WebInspector.XHRBreakpointPopover.prototype.get result):
(WebInspector.XHRBreakpointPopover.prototype.get type):
(WebInspector.XHRBreakpointPopover.prototype.get value):
(WebInspector.XHRBreakpointPopover.prototype.show.addOption):
(WebInspector.XHRBreakpointPopover.prototype.show):
(WebInspector.XHRBreakpointPopover.prototype._createEditor):
(WebInspector.XHRBreakpointPopover.prototype._updateEditor):
(WebInspector.XHRBreakpointPopover.prototype._presentOverTargetElement):

* UserInterface/Views/XHRBreakpointTreeElement.js:
(WebInspector.XHRBreakpointTreeElement):
Differentiate breakpoint type by enclosing subtitle in either double quotes
or regex-literal delimiters, depending on the type of breakpoint.

LayoutTests:

Update tests and expectations for new XHR breakpoint type.

* inspector/dom-debugger/xhr-breakpoints-expected.txt:
* inspector/dom-debugger/xhr-breakpoints.html:

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

3 years ago[MediaStream] Cleanup and simplify CoreAudioCaptureSource
eric.carlson@apple.com [Thu, 20 Apr 2017 23:09:32 +0000 (23:09 +0000)]
[MediaStream] Cleanup and simplify CoreAudioCaptureSource
https://bugs.webkit.org/show_bug.cgi?id=171064

There is no need for a mutex to guard against internal state changes because we
don't currently change configuration after the audio unit is allocated. Once
we do support reconfiguration on the fly, we can just stop the output unit before
changing configuration because the I/O proc isn't called if the output unit
is stopped, and AudioOutputUnitStop blocks until the audio device has stopped.

Reviewed by Jer Noble.

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource): Call cleanupAudioUnits
instead of duplicating logic.
(WebCore::CoreAudioCaptureSource::preferredIOBufferDuration): Change preferred
duration from 20ms to 40ms.
(WebCore::CoreAudioCaptureSource::configureMicrophoneProc): Set mSampleRate to the
preferred sample rate if it is 0.
(WebCore::CoreAudioCaptureSource::configureSpeakerProc): Ditto.
(WebCore::CoreAudioCaptureSource::provideSpeakerData): Only increment counter and
check timestamps in debug builds.
(WebCore::CoreAudioCaptureSource::processMicrophoneSamples): Ditto.
(WebCore::CoreAudioCaptureSource::cleanupAudioUnits): We only need the audio unit
name in debug builds.
(WebCore::CoreAudioCaptureSource::setupAudioUnits): Ditto. No more internal state
lock. Don't try to get the default input device on iOS.
(WebCore::CoreAudioCaptureSource::startProducingData): No more internal state lock.
Assert if not called on the main thread.
(WebCore::CoreAudioCaptureSource::stopProducingData): Ditto.
(WebCore::CoreAudioCaptureSource::suspend): Ditto.
(WebCore::CoreAudioCaptureSource::resume): Ditto.
* platform/mediastream/mac/CoreAudioCaptureSource.h:

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

3 years ago[MediaStream iOS] Hold process assertion while media capture is active
eric.carlson@apple.com [Thu, 20 Apr 2017 22:23:15 +0000 (22:23 +0000)]
[MediaStream iOS] Hold process assertion while media capture is active
https://bugs.webkit.org/show_bug.cgi?id=171017
<rdar://problem/31719177>

Reviewed by Dean Jackson.

Source/WebCore:

* page/ActivityState.h: Add IsCapturingMedia flag.

* page/Page.cpp:
(WebCore::Page::updateTimerThrottlingState): Enable timer throttling when capture is active
like we do when playing audio.
(WebCore::Page::setActivityState): Ditto.

* page/PerformanceMonitor.cpp:
(WebCore::PerformanceMonitor::updateProcessStateForMemoryPressure): A process is active when
capturing media, as it is when playing audio.

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityState): Update IsCapturingMedia when necessary.
(WebKit::WebPageProxy::updateThrottleState): Hold a token when capture is active.
(WebKit::WebPageProxy::setMuted): Capture state may change when the page is muted,
so pass IsCapturingMedia to activityStateDidChange.
(WebKit::WebPageProxy::isPlayingMediaDidChange): Ditto.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateThrottleState): Don't allow page suppression when capture
is active.

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

3 years agoInline anchor elements cannot be dragged when starting the drag from a block descendant
wenson_hsieh@apple.com [Thu, 20 Apr 2017 22:06:24 +0000 (22:06 +0000)]
Inline anchor elements cannot be dragged when starting the drag from a block descendant
https://bugs.webkit.org/show_bug.cgi?id=171062
<rdar://problem/31697835>

Reviewed by Tim Horton.

Source/WebCore:

Tweaks DragController::draggableElement to traverse the DOM instead of the render tree when finding a draggable
element. This prevents us from skipping elements that are in the DOM ancestor chain, but appear as siblings to
the hit-tested node's renderer in the render tree.

There was also previously a check to ensure that we skip anonymous RenderObjects while traversing up the chain,
but this is no longer necessary fter this change, since all the elements we traverse in the DOM should have
renderers that are not anonymous.

Test: fast/events/drag-and-drop-link-containing-block.html

* page/DragController.cpp:
(WebCore::DragController::draggableElement):

LayoutTests:

Adds a new test on WK1 Mac to verify that link dragging succeeds when the link's anchor element is inline and
the drag is started from a block element under the link.

* fast/events/drag-and-drop-link-containing-block-expected.txt: Added.
* fast/events/drag-and-drop-link-containing-block.html: Added.
* platform/ios/TestExpectations:
* platform/mac-wk2/TestExpectations:

Skip the test on iOS and Mac WK2.

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

3 years ago-Wformat warning on HistoryController.cpp:295:5
mcatanzaro@igalia.com [Thu, 20 Apr 2017 21:56:46 +0000 (21:56 +0000)]
-Wformat warning on HistoryController.cpp:295:5
https://bugs.webkit.org/show_bug.cgi?id=171028

Reviewed by Daniel Bates.

Need to cast WebCore::FrameLoadType to int before using it in printf.

* loader/HistoryController.cpp:
(WebCore::HistoryController::goToItem):

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

3 years agoThe toleranceBefore parameter in the AVPlayerItem method seekToTime should not be...
pvollan@apple.com [Thu, 20 Apr 2017 21:42:55 +0000 (21:42 +0000)]
The toleranceBefore parameter in the AVPlayerItem method seekToTime should not be negative.
https://bugs.webkit.org/show_bug.cgi?id=171063

Reviewed by Eric Carlson.

The AVPlayerItem method seekToTime will throw an exception if toleranceBefore is negative.

No new tests since the change is a sanity check.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::seekTask):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):

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

3 years agoFix build.
andersca@apple.com [Thu, 20 Apr 2017 21:30:35 +0000 (21:30 +0000)]
Fix build.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):

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

3 years agoAdd CompletionHandlerCallChecker to SPI added in r215545.
beidson@apple.com [Thu, 20 Apr 2017 20:53:03 +0000 (20:53 +0000)]
Add CompletionHandlerCallChecker to SPI added in r215545.
https://bugs.webkit.org/show_bug.cgi?id=171067

Reviewed by Dan Bernstein.

Source/WebKit2:

* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::createNewPageCommon):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm:
(TEST):
(-[OpenAndCloseWindowUIDelegateAsync _webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:completionHandler:]):

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

3 years agoReplace isFinalStateStatus with isFinalStateResult
andersca@apple.com [Thu, 20 Apr 2017 20:52:02 +0000 (20:52 +0000)]
Replace isFinalStateStatus with isFinalStateResult
https://bugs.webkit.org/show_bug.cgi?id=171072
rdar://problem/31589635

Reviewed by Tim Horton.

Source/WebCore:

This will let us get rid of some of the status enum declarations.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::completePayment):
* Modules/applepay/PaymentAuthorizationStatus.h:
(WebCore::isFinalStateStatus): Deleted.
* Modules/applepay/PaymentCoordinator.cpp:
(WebCore::PaymentCoordinator::completePaymentSession):
* Modules/applepay/PaymentRequest.cpp:
(WebCore::isFinalStateResult):
* Modules/applepay/PaymentRequest.h:

Source/WebKit2:

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::completePaymentSession):

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

3 years ago[Win] REGRESSION(r215486): Windows Release build is broken
bfulgham@apple.com [Thu, 20 Apr 2017 20:14:55 +0000 (20:14 +0000)]
[Win] REGRESSION(r215486): Windows Release build is broken
https://bugs.webkit.org/show_bug.cgi?id=171024
<rdar://problem/31722618>

Reviewed by Mark Lam.

Add missing include needed for clean Release build on Windows (proper
fix found by Fujii Hironori).

* bindings/js/JSDOMGlobalObject.h:

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

3 years agoCachedImage should cancel loading images for unsupported/unknown types
commit-queue@webkit.org [Thu, 20 Apr 2017 20:09:47 +0000 (20:09 +0000)]
CachedImage should cancel loading images for unsupported/unknown types
https://bugs.webkit.org/show_bug.cgi?id=170697

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-04-20
Reviewed by Youenn Fablet.

Currently when the image decoder detects an error with the incoming encoded
data of an image, we mark the image to be a broken image. But the network
process keeps feeding the web process with the rest of the data. We should
cancel loading the rest of the data to save network bandwidth and CPU time
loading and processing useless data.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::addIncrementalDataBuffer):
(WebCore::CachedImage::finishLoading):

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

3 years ago[WK2] -[WKContentView doAfterPositionInformationUpdate:atPosition:] should be robust...
wenson_hsieh@apple.com [Thu, 20 Apr 2017 19:59:46 +0000 (19:59 +0000)]
[WK2] -[WKContentView doAfterPositionInformationUpdate:atPosition:] should be robust against synchronous reentrancy
https://bugs.webkit.org/show_bug.cgi?id=170922
<rdar://problem/31634990>

Reviewed by Tim Horton.

Source/WebKit2:

Refactors part of the asynchronous position information mechanism introduced in
<https://trac.webkit.org/changeset/215171>, and introduces infrastructure for unit testing UI-side position
information requests.

_invokeAndRemovePendingHandlersValidForCurrentPositionInformation is a helper method on WKContentView
responsible for invoking queued position information handlers after receiving a position information response
from the web process. Previously, this method would iterate over the list of pending callbacks and invoke all
callbacks whose requests are satisfied by the incoming position information update, saving the indices of these
handled callbacks in the process. At the end, it would then remove callbacks at these indices from the array of
pending callbacks. This is problematic when a synchronous position update (via
ensurePositionInformationIsUpToDate:) is triggered from within one of these callbacks, since
_invokeAndRemovePendingHandlersValidForCurrentPositionInformation will be called from within itself, and then we
will attempt to remove a callback at the same index twice.

To fix this, we change the array of pending position information handlers to be an array of optionals instead.
When invoking and removing pending handlers after a position information response arrives, we now mark callbacks
as handled by setting them to std::nullopt. Then, when the top-level invocation to
_invokeAndRemovePendingHandlersValidForCurrentPositionInformation is finished, we remove all marked handlers
from the pending vector.

Covered by 6 new unit tests:
- PositionInformationTests.FindDraggableLinkAtPosition
- PositionInformationTests.RequestDraggableLinkAtPosition
- PositionInformationTests.FindDraggableLinkAtDifferentPositionWithinRequestBlock
- PositionInformationTests.FindDraggableLinkAtSamePositionWithinRequestBlock
- PositionInformationTests.RequestDraggableLinkAtSamePositionWithinRequestBlock
- PositionInformationTests.RequestDraggableLinkAtDifferentPositionWithinRequestBlock

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView draggableElementAtPosition:]):
(-[WKWebView requestDraggableElementAtPosition:completionBlock:]):

Uses WKContentView's position information request helpers to search for draggable elements on the page. There
are both synchronous and asynchronous versions of this, both of which retrieve a _WKDraggableElementInfo.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKDraggableElementInfo.h: Added.
* UIProcess/API/Cocoa/_WKDraggableElementInfo.mm: Added.

Exposes what elements are draggable at a given position as SPI (only for use in testing code, at the moment).

(-[_WKDraggableElementInfo initWithInteractionInformationAtPosition:]):
(-[_WKDraggableElementInfo copyWithZone:]):
* UIProcess/API/Cocoa/_WKDraggableElementInfoInternal.h: Added.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView currentPositionInformation]):
(-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
(-[WKContentView _invokeAndRemovePendingHandlersValidForCurrentPositionInformation]):
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Adds six new unit tests for retrieving interaction information at a given position in the UI process. See
WebKit2 ChangeLog for more details.

* TestWebKitAPI/Tests/ios/PositionInformationTests.mm:
(-[_WKDraggableElementInfo expectToBeLink:image:atPoint:]):
(TestWebKitAPI::TEST):
(TestWebKitAPI::expectCGPointsToBeEqual): Deleted.

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

3 years agoAX: Modern Media Controls Timeline slider should be operable
commit-queue@webkit.org [Thu, 20 Apr 2017 19:45:19 +0000 (19:45 +0000)]
AX: Modern Media Controls Timeline slider should be operable
https://bugs.webkit.org/show_bug.cgi?id=170250

Patch by Aaron Chu <aaron_chu@apple.com> on 2017-04-20
Reviewed by Antoine Quint.

Source/WebCore:

Added a "change" event listener and aria-valuetext to the slider so that when a
VoiceOver user operates the timeline control, VO speaks the updated timestamp

Test: media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html

* English.lproj/modern-media-controls-localized-strings.js:
* Modules/modern-media-controls/controls/scrubber.js:
(Scrubber.prototype.set inputAccessibleLabel):
(Scrubber.prototype._formatTime):
* Modules/modern-media-controls/controls/slider.js:
(Slider.prototype.handleEvent):
(Slider.prototype._handleInputEvent): Deleted.
* Modules/modern-media-controls/controls/time-control.js:
(TimeControl.prototype.updateScrubberLabel):
* Modules/modern-media-controls/controls/time-label.js:
(TimeLabel.prototype.commitProperty):
(TimeLabel.prototype._formattedTime):
* Modules/modern-media-controls/main.js:
(formatTimeByUnit):
(unitizeTime):

LayoutTests:

* media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt: Added.
* media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html: Added.

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

3 years agoMove notFound into its own file
weinig@apple.com [Thu, 20 Apr 2017 19:44:12 +0000 (19:44 +0000)]
Move notFound into its own file
https://bugs.webkit.org/show_bug.cgi?id=170972

Reviewed by Zalan Bujtas.

It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
This is not causing any current problems, but does in few changes I have
queued up.

* WTF.xcodeproj/project.pbxproj:
* wtf/NotFound.h: Added.
* wtf/Vector.h:
* wtf/text/StringCommon.h:

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

3 years agoFix indentation in AVKitSPI.h
aestes@apple.com [Thu, 20 Apr 2017 19:39:16 +0000 (19:39 +0000)]
Fix indentation in AVKitSPI.h
https://bugs.webkit.org/show_bug.cgi?id=171066

Reviewed by Jer Noble.

* platform/spi/cocoa/AVKitSPI.h:

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

3 years agoFix a PassKit function declaration typo
andersca@apple.com [Thu, 20 Apr 2017 19:34:21 +0000 (19:34 +0000)]
Fix a PassKit function declaration typo
https://bugs.webkit.org/show_bug.cgi?id=171068
rdar://problem/31635008

Reviewed by Tim Horton.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):

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