WebKit-https.git
2 years agoAdd test expectations and baselines for Catalina
ryanhaddad@apple.com [Mon, 8 Jul 2019 19:12:00 +0000 (19:12 +0000)]
Add test expectations and baselines for Catalina
https://bugs.webkit.org/show_bug.cgi?id=199328

Reviewed by Jonathan Bedard.

Tools:

* Scripts/webkitpy/port/mac.py:
(MacPort): Increment current version to 10.15 so that baseline search paths are correctly constructed for High Sierra.

LayoutTests:

* platfrom/mac/*: Adding Catalina test expectations and baselines.
* platform/mac-mojave/*: Migrating Mojave baselines from platform/mac directory.

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

2 years agoImplement MappedFileData for Windows
chris.reid@sony.com [Mon, 8 Jul 2019 19:09:24 +0000 (19:09 +0000)]
Implement MappedFileData for Windows
https://bugs.webkit.org/show_bug.cgi?id=198269

Reviewed by Darin Adler.

Source/WTF:

Original patch by Fujii Hironori.

Add Windows implementations for MappedFileData constructor and destructor.

* wtf/FileSystem.cpp:
* wtf/FileSystem.h:
* wtf/win/FileSystemWin.cpp:

Tools:

* TestWebKitAPI/PlatformWin.cmake:

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

2 years ago[iPadOS] Viewport pops while loading sohu.com, xinhuanet.com, and various other websites
wenson_hsieh@apple.com [Mon, 8 Jul 2019 19:03:42 +0000 (19:03 +0000)]
[iPadOS] Viewport pops while loading sohu.com, xinhuanet.com, and various other websites
https://bugs.webkit.org/show_bug.cgi?id=199575
<rdar://problem/51842220>

Reviewed by Simon Fraser.

Source/WebKit:

Currently, the shrink-to-fit-content heuristic added to scale desktop sites fit within the viewport on iPadOS
only runs during two intervals: after document load, and after page load. On very script-heavy websites, this
may cause a visible jump, as rendering may commence well before the document is finished parsing.

To mitigate this, we move the first opportunity for the shrink-to-fit heuristic from after document, to right
after the page transition has completed (before we unfreeze the layer tree).

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCompletePageTransition):
(WebKit::WebPage::didFinishDocumentLoad): Deleted.

Remove this didFinishDocumentLoad hook, which was only used to schedule the shrink-to-fit timer.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::immediatelyShrinkToFitContent):

m_mainFrame might be null after page transition completes, so we need to ensure immediatelyShrinkToFitContent is
robust in this scenario.

LayoutTests:

Adjusts an existing layout test, and introduces a new test to verify that the shrink-to-fit heuristic is given a
chance to run before document load. See WebKit ChangeLog for more details.

* fast/viewport/ios/shrink-to-fit-content-before-document-load-expected.txt: Added.
* fast/viewport/ios/shrink-to-fit-content-before-document-load.html: Added.
* fast/viewport/ios/shrink-to-fit-content-temporary-overflow.html:

Tweak this layout test to add the temporarily overflowing element after document load.

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

2 years agoUnable to paste from Notes into Excel 365 spreadsheet
wenson_hsieh@apple.com [Mon, 8 Jul 2019 18:59:49 +0000 (18:59 +0000)]
Unable to paste from Notes into Excel 365 spreadsheet
https://bugs.webkit.org/show_bug.cgi?id=199565
<rdar://problem/43615497>

Reviewed by Chris Dumez.

Source/WebCore:

When pasting into Microsoft Excel 365, the copied data is all inserted into a single cell, even when copying a
table. To understand why this happens, we first need to understand how Excel's logic for handling paste works.
When tapping on the "Paste" button, Excel performs and expects the following:

1.  Before triggering programmatic paste, move focus into a hidden contenteditable area specifically intended to
    capture pasted content.
2.  Run a promise that resolves immediately; the promise callback restores focus to the originally focused
    element prior to (1).
3.  Invoke programmatic paste using `document.execCommand("Paste")`.
4.  The callback scheduled in step (2) then runs, restoring focus to the main editable element representing a
    table cell.

However, what ends up happening is this:

Steps (1)-(3): same as before.
4.  We (WebKit) create a temporary Page for the purposes of sanitizing copied web content before exposing it to
    the paste handler. This involves creating and loading a document; when this is finished, we call into
    Document::finishedParsing which flushes the microtask queue.
5.  This causes us to immediately run the microtask enqueued in step (2), which restores focus to the previously
    focused element (importantly, this is not the element that was focused in step (1)).
6.  The paste commences, and inserts the sanitized fragment into the originally focused element rather than the
    content editable area intended to capture pasted content.

Excel's script then gets confused, and does not end up using their special paste logic to handle the paste. The
pasted content is instead just inserted as plain text in a cell. To address this, we simply prevent document
load in the Page for web content sanitization from triggering a microtask checkpoint; this allows any scheduled
main thread microtasks to be deferred until the next turn of the runloop.

Test: editing/pasteboard/paste-does-not-fire-promises-while-sanitizing-web-content.html

* dom/Document.cpp:
(WebCore::Document::finishedParsing):

Don't immediately dispatch microtasks when we finish document parsing, in the case where the page is intended
only for web content sanitization, since this may end up executing script in the original document. As explained
above, this causes compatibility issues when pasting in Excel.

* editing/markup.cpp:
(WebCore::createPageForSanitizingWebContent):

When creating a page for sanitizing web content, mark it as such.

* page/Page.h:

Add a new flag to indicate that a Page is only intended for sanitizing web content.

(WebCore::Page::setIsForSanitizingWebContent):
(WebCore::Page::isForSanitizingWebContent const):

LayoutTests:

Add a test to verify that promises scheduled right before a programmatic paste resolve in the middle of the
paste, while creating a document for web content sanitization. See WebCore ChangeLog for more details.

* editing/pasteboard/paste-does-not-fire-promises-while-sanitizing-web-content-expected.txt: Added.
* editing/pasteboard/paste-does-not-fire-promises-while-sanitizing-web-content.html: Added.

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

2 years agoRemove unused #include "ImageBufferData.h"
annulen@yandex.ru [Mon, 8 Jul 2019 18:44:15 +0000 (18:44 +0000)]
Remove unused #include "ImageBufferData.h"
https://bugs.webkit.org/show_bug.cgi?id=199574

Reviewed by Michael Catanzaro.

* html/canvas/ImageBitmapRenderingContext.h:

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

2 years agoFix thread safety issue in Database::scheduleTransactionCallback()
cdumez@apple.com [Mon, 8 Jul 2019 18:38:32 +0000 (18:38 +0000)]
Fix thread safety issue in Database::scheduleTransactionCallback()
https://bugs.webkit.org/show_bug.cgi?id=199557

Reviewed by Alex Christensen.

I am working on adding threading assertions to WeakPtr and found a potentially
unsafe call to makeWeakPtr() on a Document from Database::scheduleTransactionCallback()
via Document::postTask(), on a background database thread. Document is a main thread
object and we should therefore not be interacting with it from a background thread.

For clarity, this patch also switches the webdatabase code to use Document instead
of ScriptExecution as type since it is only exposed to Window contexts, not workers.

* Modules/webdatabase/Database.cpp:
(WebCore::Database::Database):
(WebCore::Database::~Database):
(WebCore::Database::runTransaction):
(WebCore::Database::scheduleTransactionCallback):
(WebCore::Database::logErrorMessage):
(WebCore::Database::securityOrigin):
(WebCore::Database::didExceedQuota):
* Modules/webdatabase/Database.h:
(WebCore::Database::document):
* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::DatabaseContext):
* Modules/webdatabase/DatabaseContext.h:
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::databaseContext):
(WebCore::logOpenDatabaseError):
(WebCore::DatabaseManager::openDatabaseBackend):
(WebCore::DatabaseManager::tryToOpenDatabaseBackend):
(WebCore::DatabaseManager::openDatabase):
(WebCore::DatabaseManager::hasOpenDatabases):
(WebCore::DatabaseManager::stopDatabases):
(WebCore::DatabaseManager::logErrorMessage):
* Modules/webdatabase/DatabaseManager.h:
* Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::SQLStatement):
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::SQLTransaction):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didOpenDatabase):
* inspector/agents/InspectorDatabaseAgent.cpp:
(WebCore::InspectorDatabaseAgent::executeSQL):

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

2 years agoAdd threading assertion to WTF::CompletionHandler
cdumez@apple.com [Mon, 8 Jul 2019 18:26:47 +0000 (18:26 +0000)]
Add threading assertion to WTF::CompletionHandler
https://bugs.webkit.org/show_bug.cgi?id=199516

Reviewed by Alex Christensen.

Source/WebCore:

Update some MessagePort-related code to use WTF::Function instead of WTF::CompletionHandler
since the callback is always called on the main thread, even when it was created on a
worker thread. Ideally, this code would be refactored so that the callback gets called on
the worker thread directly.

* dom/messageports/MessagePortChannel.cpp:
(WebCore::MessagePortChannel::checkRemotePortForActivity):
* dom/messageports/MessagePortChannel.h:
* dom/messageports/MessagePortChannelProvider.h:
* dom/messageports/MessagePortChannelProviderImpl.cpp:
(WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
* dom/messageports/MessagePortChannelProviderImpl.h:
* dom/messageports/MessagePortChannelRegistry.cpp:
(WebCore::MessagePortChannelRegistry::checkRemotePortForActivity):
* dom/messageports/MessagePortChannelRegistry.h:

Source/WebKit:

Update some MessagePort-related code to use WTF::Function instead of WTF::CompletionHandler
since the callback is always called on the main thread, even when it was created on a
worker thread. Ideally, this code would be refactored so that the callback gets called on
the worker thread directly.

* UIProcess/UIMessagePortChannelProvider.cpp:
(WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity):
* UIProcess/UIMessagePortChannelProvider.h:
* WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
(WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
* WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:

Source/WTF:

Add threading assertion to WTF::CompletionHandler to try and catch common cases
of unsafe usage (completion handler constructed on one thread but called on
another).

* wtf/CompletionHandler.h:
(WTF::CompletionHandler<Out):

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

2 years agoREGRESSION(r243197): [GStreamer] Web process hangs when scrolling twitter timeline...
cturner@igalia.com [Mon, 8 Jul 2019 18:16:08 +0000 (18:16 +0000)]
REGRESSION(r243197): [GStreamer] Web process hangs when scrolling twitter timeline which contains HLS videos
https://bugs.webkit.org/show_bug.cgi?id=197558

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Not covered, I have a test locally that would probably trigger the
deadlock if the network requests took a realistic amount of time,
but from a local webserver the window of time to hit this deadlock
is too narrow.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webkit_web_src_init): Make the websrc start asynchronously, this
allows the main thread to be free to complete resource loader
setup.
(webKitWebSrcCreate): Calling start() from the create() vfunc is a
recipe for deadlock, since BaseSrc holds the streaming lock during
seeks, and then calls create(). In these cases, we do not want to
notify async-completion, since we've already completed from the
necessarily preceeding start() vfunc, and calling it again would
require the stream-lock and deadlock us.
(webKitWebSrcStart): Refactor to use webKitWebSrcMakeRequest, but
ensuring that we do perform an async-complete notification.
(webKitWebSrcMakeRequest): What Start() used to be, but now can be
toggled when to notify of async-completion. Start() no longer
blocks, since the return value of initiating a resource loader is
of no interest to the callers.
(webKitWebSrcCloseSession): Similarly to Start(), we do not need
to wait for the completion of cancelled net requests.

Tools:

On shutdown we can easily deadlock the web process if we don't
ensure all network operations are completed before comitting state
changes. In HLS, make sure the network operations are cancelled,
and also prevent hlsdemux's retry logic from scuppering our
efforts.

* gstreamer/jhbuild.modules: Include the patch.
* gstreamer/patches/gst-plugins-bad-do-not-retry-downloads-during-shutdown.patch: Added.

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

2 years agoUnable to play videos on xfinity.com/stream on macOS Catalina
cdumez@apple.com [Mon, 8 Jul 2019 18:14:21 +0000 (18:14 +0000)]
Unable to play videos on xfinity.com/stream on macOS Catalina
https://bugs.webkit.org/show_bug.cgi?id=199576
<rdar://problem/50101264>

Reviewed by Alex Christensen.

Source/WebCore:

Enable invalidate Fetch signal quirk for all sites as the blacklist is getting too large and
we are finding too much breakage too late in the release cycle.

* Modules/fetch/FetchRequest.cpp:
(WebCore::processInvalidSignal):
* page/Quirks.cpp:
(WebCore::Quirks::shouldIgnoreInvalidSignal const):

LayoutTests:

Rebaseline existing test.

* http/wpt/fetch/request-abort-expected.txt:

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

2 years ago[Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
graouts@webkit.org [Mon, 8 Jul 2019 18:00:33 +0000 (18:00 +0000)]
[Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
https://bugs.webkit.org/show_bug.cgi?id=199571
<rdar://problem/51715002>

Reviewed by Wenson Hsieh.

Source/WebKit:

We add a new WKTouchActionGestureRecognizerDelegate method to check whether a gesture recognizer may lead to
zooming the page as a result of double-tapping, which can be caused by two different gesture recognizers
managed by WKContentViewInteraction. If that delegate method returns true and we have "touch-action: none"
set for this touch, we cause those gesture recognizers to fail and prevent double-tap-to-zoom behavior.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizerMayDoubleTapToZoomWebView:]):
* UIProcess/ios/WKTouchActionGestureRecognizer.h:
* UIProcess/ios/WKTouchActionGestureRecognizer.mm:
(-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):

LayoutTests:

Add two new tests that check that setting "touch-action: none" on an element does not allow double-tap-to-zoom
and that "touch-action: manipulation" allows it.

* pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt: Added.
* pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html: Added.
* pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt: Added.
* pointerevents/ios/touch-action-none-double-tap-to-zoom.html: Added.
* pointerevents/utils.js:
(const.ui.new.UIController.prototype.doubleTapToZoom):

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

2 years agoMediaStreamTrackPrivate should always call readyStateChanged on the main thread
youenn@apple.com [Mon, 8 Jul 2019 17:46:27 +0000 (17:46 +0000)]
MediaStreamTrackPrivate should always call readyStateChanged on the main thread
https://bugs.webkit.org/show_bug.cgi?id=199538
<rdar://problem/52709106>

Reviewed by Eric Carlson.

MediaStreamTrackPrivate is sometimes calling readyStateChanged in a
background thread inside its audioSamplesAvailable method.
Instead of doing that, we hop to the main thread to call readyStateChanged.
Once the call is made in the main thread, MediaStreamTrackPrivate will
send the audio samples to its observers.

To make mock audio source closer to real capture audio sources,
audioSamplesAvailable is called on a background thread.
RealtimeMediaSource is updated to always be destroyed in the main
run loop since it is WebKit2 only.

Covered by existing tests and making sure the mock audio source calls
the audioSamplesAvailable method on a background thread.

* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
(WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
* platform/mediastream/MediaStreamTrackPrivate.h:
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::scheduleDeferredTask):
scheduleDeferredTask may be called from a background thread.
It is thus safer to ref the source instead of creating a weak pointer.
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
(WebCore::MockRealtimeAudioSourceMac::MockRealtimeAudioSourceMac):
(WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
(WebCore::MockRealtimeAudioSourceMac::reconfigure):
(WebCore::MockRealtimeAudioSourceMac::render):
(WebCore::MockRealtimeAudioSourceMac::settingsDidChange):
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
(WebCore::MockRealtimeAudioSource::tick):
* platform/mock/MockRealtimeAudioSource.h:

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

2 years ago[iOS] WebContent processes should not globally allow mach lookup to the AX server.
pvollan@apple.com [Mon, 8 Jul 2019 16:51:28 +0000 (16:51 +0000)]
[iOS] WebContent processes should not globally allow mach lookup to the AX server.
https://bugs.webkit.org/show_bug.cgi?id=199386
<rdar://problem/52487468>

Reviewed by Chris Fleizach.

Instead, a mach extension for this service should be issued to the WebContent process. This has already been implemented.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:

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

2 years agoREGRESSION(r246671): [WPE][GTK] Crash in NetworkProcess since the DNS cache landed
csaavedra@igalia.com [Mon, 8 Jul 2019 16:40:02 +0000 (16:40 +0000)]
REGRESSION(r246671): [WPE][GTK] Crash in NetworkProcess since the DNS cache landed
https://bugs.webkit.org/show_bug.cgi?id=199572

Reviewed by Michael Catanzaro.

The GError coming from the wrapped resolver shouldn't be freed,
but passed onto the caller.

* NetworkProcess/glib/WebKitCachedResolver.cpp:
(webkitCachedResolverLookupByNameAsync):
(webkitCachedResolverLookupByNameWithFlagsAsync):

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

2 years agoRegister a MediaStreamTrack as media producer only if it is a capture track
youenn@apple.com [Mon, 8 Jul 2019 16:25:55 +0000 (16:25 +0000)]
Register a MediaStreamTrack as media producer only if it is a capture track
https://bugs.webkit.org/show_bug.cgi?id=199566

Reviewed by Eric Carlson.

MediaStreamTrack registration as a media producer is only useful for capture tracks.
Otherwise, the audio/video playing state is computed through HTMLMediaElement.
Do not register MediaStreamTrack as a media producer if it is not a capture track.

Set the muted state of the track before registering it as an audio
producer. Otherwise, it might create unnecessary small change of playing state.
Covered by existing tests.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack):
(WebCore::MediaStreamTrack::~MediaStreamTrack):
* Modules/mediastream/MediaStreamTrack.h:

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

2 years ago[GStreamer] media/video-volume.html broken after switching from cubic to linear scaling
cturner@igalia.com [Mon, 8 Jul 2019 11:47:13 +0000 (11:47 +0000)]
[GStreamer] media/video-volume.html broken after switching from cubic to linear scaling
https://bugs.webkit.org/show_bug.cgi?id=199505

Reviewed by Xabier Rodriguez-Calvar.

PulseAudio has a conversion process from volume's in
double-precision to uint32_t volumes. Depending on the environment
can introduce rounding errors. Be more lenient in our comparison
code.

* media/video-volume-expected.txt: Update baseline
* media/video-volume.html: Compare volume values within a
reasonable tolerance.

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

2 years ago[Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show...
graouts@webkit.org [Mon, 8 Jul 2019 11:26:24 +0000 (11:26 +0000)]
[Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show tabs in Safari
https://bugs.webkit.org/show_bug.cgi?id=199560
<rdar://problem/52742265>

Reviewed by Dean Jackson.

There are other UIPinchGestureRecognizer objects that may lead to pinch-to-zoom behavior, for instance pinching
out to show open tabs in Safari on iOS. We add a new WKUIDelegatePrivate method that will allow Safari to indicate
that a UIPinchGestureRecognizer considered for prevention would lead to pinch-to-zoom behavior.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):

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

2 years ago[Pointer Events] Enable only on the most recent version of the supported iOS family
graouts@webkit.org [Mon, 8 Jul 2019 11:22:06 +0000 (11:22 +0000)]
[Pointer Events] Enable only on the most recent version of the supported iOS family
https://bugs.webkit.org/show_bug.cgi?id=199562
<rdar://problem/52766511>

Reviewed by Dean Jackson.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cancelPointersForGestureRecognizer:]):
(-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
(-[WKContentView touchActionActiveTouches]):
* UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
(-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
* UIProcess/ios/WKTouchActionGestureRecognizer.h:
* UIProcess/ios/WKTouchActionGestureRecognizer.mm:
(-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

We really don't need HAVE_UI_WEB_TOUCH_EVENTS_GESTURE_RECOGNIZER_WITH_ACTIVE_TOUCHES_BY_ID since the UIKit SPI
that was added in iOS 13 that it's checking for is really required for all parts of the implementation of Pointer
Events, including dispatch of the "pointercancel" event and support for the "touch-action" CSS property.

* wtf/Platform.h:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

* js/dom/navigator-maxtouchpoints-expected.txt: Since ENABLE_POINTER_EVENTS is now disabled by default, navigator.maxTouchPoints
is "undefined" in thed default case.
* platform/mac/js/dom/navigator-maxtouchpoints-expected.txt: But 0 on macOS.

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

2 years ago[GStreamer] The CREATE_TRACK macro is messed up
philn@webkit.org [Mon, 8 Jul 2019 10:08:04 +0000 (10:08 +0000)]
[GStreamer] The CREATE_TRACK macro is messed up
https://bugs.webkit.org/show_bug.cgi?id=199356

Reviewed by Xabier Rodriguez-Calvar.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updateTracks): Fix the
CREATE_TRACK macro for !VIDEO_TRACK builds.

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

2 years ago[GTK] ViewGestureController constructor leaves m_direction uninitialized
mcatanzaro@igalia.com [Mon, 8 Jul 2019 08:17:24 +0000 (08:17 +0000)]
[GTK] ViewGestureController constructor leaves m_direction uninitialized
https://bugs.webkit.org/show_bug.cgi?id=199532

Reviewed by Carlos Garcia Campos.

This is harmless because it should never be read until after it's initialized, but still not
robust. Fix it by assuming Back as the default value until the first swipe begins.

* UIProcess/ViewGestureController.h:

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

2 years ago[ContentChangeObserver] Difficult to control videos on iqiyi.com as the actions are...
zalan@apple.com [Sun, 7 Jul 2019 14:52:17 +0000 (14:52 +0000)]
[ContentChangeObserver] Difficult to control videos on iqiyi.com as the actions are mouse hover
https://bugs.webkit.org/show_bug.cgi?id=199542
<rdar://problem/51886813>

Reviewed by Simon Fraser.

Source/WebCore:

Decouple isVisuallyHidden and isConsideredVisible. Just because an element is not visually hidden (1px wide content)
it is not necessarily qualified to be visible in the context of hover heuristic (e.g. iqiyi.com brings up a 1px wide
clickable element when hovering over the scrubber. This element is clearly not designed to be actionable.)

Tests: fast/events/touch/ios/content-observation/tap-on-1px-height-content.html
       fast/events/touch/ios/content-observation/tap-on-1px-width-content.html

* dom/Node.cpp:
(WebCore::Node::defaultEventHandler):
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::isVisuallyHidden):
(WebCore::ContentChangeObserver::isConsideredVisible):
(WebCore::ContentChangeObserver::didAddTransition):
(WebCore::ContentChangeObserver::didFinishTransition):
(WebCore::ContentChangeObserver::willDestroyRenderer):
(WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
(WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
(WebCore::ContentChangeObserver::isConsideredHidden): Deleted.
* page/ios/ContentChangeObserver.h:

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):

LayoutTests:

* fast/events/touch/ios/content-observation/tap-on-1px-height-content-expected.txt: Added.
* fast/events/touch/ios/content-observation/tap-on-1px-height-content.html: Added.
* fast/events/touch/ios/content-observation/tap-on-1px-width-content-expected.txt: Added.
* fast/events/touch/ios/content-observation/tap-on-1px-width-content.html: Added.

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

2 years ago[LFC][IFC] Introduce splitPosition to LineLayout
zalan@apple.com [Sun, 7 Jul 2019 13:49:57 +0000 (13:49 +0000)]
[LFC][IFC] Introduce splitPosition to LineLayout
https://bugs.webkit.org/show_bug.cgi?id=199558
<rdar://problem/52737649>

Reviewed by Antti Koivisto.

This is in preparation for breaking runs at line end.

* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::LineInput):
(WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const):
(WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
(WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):

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

2 years ago[LFC] Fix formatting context root for inflow positioned inline containers
zalan@apple.com [Sun, 7 Jul 2019 13:47:26 +0000 (13:47 +0000)]
[LFC] Fix formatting context root for inflow positioned inline containers
https://bugs.webkit.org/show_bug.cgi?id=199551
<rdar://problem/52728868>

Reviewed by Antti Koivisto.

Relatively positioned (inflow) inline container lives in the formatting context where its parent lives unless
the parent establishes a formatting context. This is slightly different from the usual behavior which is containing block driven.

div id=outer style="position: absolute">><div id=inner><span style="position: relative">content</span></div></div>

While the relatively positioned inline container (span) is placed relative to its containing block "outer", it lives in the inline formatting context established by "inner".

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::formattingContextRoot const):
* layout/layouttree/LayoutBox.h:
* layout/layouttree/LayoutInlineContainer.cpp:
(WebCore::Layout::InlineContainer::formattingContextRoot const):
* layout/layouttree/LayoutInlineContainer.h:

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

2 years ago[Pointer Events] Use a gesture recognizer to prevent pinch-to-zoom behavior
graouts@webkit.org [Sun, 7 Jul 2019 08:12:54 +0000 (08:12 +0000)]
[Pointer Events] Use a gesture recognizer to prevent pinch-to-zoom behavior
https://bugs.webkit.org/show_bug.cgi?id=199543

Reviewed by Dean Jackson.

We used to set the "enabled" property on the main UIScrollView's UIPinchGestureRecognizer to disable pinch-to-zoom
behavior based on the "touch-action" CSS property. This was sub-optimal since this gesture recognizer can be publicly
accessible by third-party developers, but also because it set state instead of a run-time solution.

We now introduce a new WKTouchActionGestureRecognizer dedicated to preventing clearly identified gesture recognizers
from being recognized to disable some built-in behavior. As a new touch starts, we record the computed touch-action
property for the given touch identifier on the WKTouchActionGestureRecognizer, then WKTouchActionGestureRecognizer
determines, by implementing -[canPreventGestureRecognizer:], whether the possibly-prevented gesture recognizer
is known to lead to a pinch-to-zoom behavior and whether it contains a touch that should prevent it.

To support the WKTouchActionGestureRecognizer, WKContentViewInteraction implements the new WKTouchActionGestureRecognizerDelegate
protocol to indicate whether the possibly-prevented gesture recognizer is the main UIScrollView's UIPinchGestureRecognizer.

No new test since this changes the implementation of existing behavior.

* SourcesCocoa.txt:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView _removeDefaultGestureRecognizers]):
(-[WKContentView _addDefaultGestureRecognizers]):
(-[WKContentView _handleTouchActionsForTouchEvent:]):
(-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):
(-[WKContentView touchActionActiveTouches]):
* UIProcess/ios/WKTouchActionGestureRecognizer.h: Added.
* UIProcess/ios/WKTouchActionGestureRecognizer.mm: Added.
(-[WKTouchActionGestureRecognizer initWithTouchActionDelegate:]):
(-[WKTouchActionGestureRecognizer setTouchActions:forTouchIdentifier:]):
(-[WKTouchActionGestureRecognizer clearTouchActionsForTouchIdentifier:]):
(-[WKTouchActionGestureRecognizer touchesBegan:withEvent:]):
(-[WKTouchActionGestureRecognizer touchesMoved:withEvent:]):
(-[WKTouchActionGestureRecognizer touchesEnded:withEvent:]):
(-[WKTouchActionGestureRecognizer touchesCancelled:withEvent:]):
(-[WKTouchActionGestureRecognizer _updateState]):
(-[WKTouchActionGestureRecognizer canBePreventedByGestureRecognizer:]):
(-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
* WebKit.xcodeproj/project.pbxproj:

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

2 years agoWeb Inspector: Styles: unbalanced quotes and parenthesis aren't displayed as property...
nvasilyev@apple.com [Sun, 7 Jul 2019 02:09:28 +0000 (02:09 +0000)]
Web Inspector: Styles: unbalanced quotes and parenthesis aren't displayed as property closed after editing values
https://bugs.webkit.org/show_bug.cgi?id=199090
<rdar://problem/51965431>

Reviewed by Devin Rousso.

`}` gets added by WI.tokenizeCSSValue (called by SpreadsheetStyleProperty.prototype._renderValue)
when it encounters unbalanced quotes. Fix unbalanced quotes by re-rendering the value from the model,
not the DOM content.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.spreadsheetTextFieldDidCommit):
For consistency, render property name from the model as well.

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

2 years agoLong hang when loading a cnn.com page on iOS
simon.fraser@apple.com [Sun, 7 Jul 2019 00:20:03 +0000 (00:20 +0000)]
Long hang when loading a cnn.com page on iOS
https://bugs.webkit.org/show_bug.cgi?id=199556

Reviewed by Zalan Bujtas.
Source/WebCore:

Loading https://edition.cnn.com/travel/article/brussels-airlines-flight-to-nowhere/index.html in the iOS 13 sim
results in a long hang under OverlapMapContainer::append(). We were creating pathological clipping scopes with
thousands of entries, because OverlapMapContainer::mergeClippingScopesRecursive() had a logic error where
it added 'sourceScope' to the child instead of 'sourceChildScope'. Add a new assertion to detect that case.

I wasn't able to create a testcase that caused a hang, but a number of existing tests would have
hit the assertion.

* rendering/LayerOverlapMap.cpp:
(WebCore::OverlapMapContainer::ClippingScope::addChild):
(WebCore::OverlapMapContainer::mergeClippingScopesRecursive):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges): Drive-by fix: m_overflowControlsHostLayer is null on iOS, so use rootGraphicsLayer().

Tools:

Add code to load a page by default in MobileMiniBrowser so it's easy to hack it
to load a test page of your choice.

* MobileMiniBrowser/MobileMiniBrowserFramework/WebViewController.m:
(-[WebViewController viewDidLoad]):

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

2 years agoswitch(String) needs to check for exceptions when resolving the string
msaboff@apple.com [Sat, 6 Jul 2019 13:34:51 +0000 (13:34 +0000)]
switch(String) needs to check for exceptions when resolving the string
https://bugs.webkit.org/show_bug.cgi?id=199541

Reviewed by Mark Lam.

JSTests:

New tests.

* stress/switch-string-oom.js: Added.
(test):
(testLowerTiers):
(testFTL):

Source/JavaScriptCore:

Added exception checks for resolved Strings in switch processing for all tiers.

* dfg/DFGOperations.cpp:
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

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

2 years agoImport css/cssom-view testcases from WPT.
commit-queue@webkit.org [Sat, 6 Jul 2019 11:03:56 +0000 (11:03 +0000)]
Import css/cssom-view testcases from WPT.
https://bugs.webkit.org/show_bug.cgi?id=199509

Patch by Cathie Chen <cathiechen@igalia.com> on 2019-07-06
Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/css/cssom-view/CaretPosition-001.html:
* web-platform-tests/css/cssom-view/DOMRectList.html:
* web-platform-tests/css/cssom-view/GetBoundingRect.html:
* web-platform-tests/css/cssom-view/HTMLBody-ScrollArea_quirksmode.html:
* web-platform-tests/css/cssom-view/MediaQueryList-001.html:
* web-platform-tests/css/cssom-view/MediaQueryList-with-empty-string.html:
* web-platform-tests/css/cssom-view/Screen-pixelDepth-Screen-colorDepth001.html:
* web-platform-tests/css/cssom-view/cssom-getBoundingClientRect-001.html:
* web-platform-tests/css/cssom-view/cssom-getBoundingClientRect-002.html:
* web-platform-tests/css/cssom-view/cssom-getBoxQuads-001.html:
* web-platform-tests/css/cssom-view/cssom-getClientRects-002.html:
* web-platform-tests/css/cssom-view/cssom-getClientRects.html:
* web-platform-tests/css/cssom-view/cssom-view-img-attributes-001.html:
* web-platform-tests/css/cssom-view/cssom-view-window-screen-interface.html:
* web-platform-tests/css/cssom-view/dom-element-scroll.html:
* web-platform-tests/css/cssom-view/elementFromPoint-001.html:
* web-platform-tests/css/cssom-view/elementFromPoint-002.html:
* web-platform-tests/css/cssom-view/elementFromPoint-003.html:
* web-platform-tests/css/cssom-view/elementFromPoint-dynamic-anon-box.html:
* web-platform-tests/css/cssom-view/elementFromPoint-mixed-font-sizes.html:
* web-platform-tests/css/cssom-view/elementFromPoint-parameters.html:
* web-platform-tests/css/cssom-view/elementFromPoint-subpixel-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementFromPoint-subpixel.html: Added.
* web-platform-tests/css/cssom-view/elementFromPoint.html:
* web-platform-tests/css/cssom-view/elementFromPosition.html:
* web-platform-tests/css/cssom-view/elementScroll-002.html:
* web-platform-tests/css/cssom-view/elementScroll.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-iframes.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-htb-ltr-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-htb-ltr.html: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-htb-rtl-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-htb-rtl.html: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vlr-ltr-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vlr-ltr.html: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vlr-rtl-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vlr-rtl.html: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vrl-ltr-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vrl-ltr.html: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vrl-rtl-expected.txt: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-inline-vrl-rtl.html: Added.
* web-platform-tests/css/cssom-view/elementsFromPoint-invalid-cases.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-shadowroot.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-simple.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-svg-text.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-svg.html:
* web-platform-tests/css/cssom-view/elementsFromPoint-table.html:
* web-platform-tests/css/cssom-view/elementsFromPoint.html:
* web-platform-tests/css/cssom-view/getClientRects-br-htb-ltr-expected.txt: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-htb-ltr.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-htb-rtl-expected.txt: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-htb-rtl.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vlr-ltr-expected.txt: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vlr-ltr.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vlr-rtl-expected.txt: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vlr-rtl.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vrl-ltr-expected.txt: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vrl-ltr.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vrl-rtl-expected.txt: Added.
* web-platform-tests/css/cssom-view/getClientRects-br-vrl-rtl.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-inline-expected.html: Added.
* web-platform-tests/css/cssom-view/getClientRects-inline.html: Added.
* web-platform-tests/css/cssom-view/historical.html:
* web-platform-tests/css/cssom-view/htmlelement-offset-width-001.html:
* web-platform-tests/css/cssom-view/inheritance-expected.txt: Added.
* web-platform-tests/css/cssom-view/inheritance.html: Added.
* web-platform-tests/css/cssom-view/interfaces.html:
* web-platform-tests/css/cssom-view/long_scroll_composited-expected.html: Added.
* web-platform-tests/css/cssom-view/long_scroll_composited.html: Added.
* web-platform-tests/css/cssom-view/matchMedia-display-none-iframe-expected.txt: Added.
* web-platform-tests/css/cssom-view/matchMedia-display-none-iframe.html: Added.
* web-platform-tests/css/cssom-view/matchMedia.xht:
* web-platform-tests/css/cssom-view/matchMediaAddListener.html:
* web-platform-tests/css/cssom-view/mouseEvent.html:
* web-platform-tests/css/cssom-view/negativeMargins.html:
* web-platform-tests/css/cssom-view/offsetParent_element_test.html:
* web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline-expected.txt: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline-offset-expected.txt: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline-offset.html: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline.html: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-inline-expected.html: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-inline.html: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline-expected.txt: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline.html: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-trailing-space-inline-expected.txt: Added.
* web-platform-tests/css/cssom-view/offsetTopLeft-trailing-space-inline.html: Added.
* web-platform-tests/css/cssom-view/offsetTopLeftInScrollableParent.html:
* web-platform-tests/css/cssom-view/outer-svg-expected.txt: Added.
* web-platform-tests/css/cssom-view/outer-svg.html: Added.
* web-platform-tests/css/cssom-view/resize-event-on-initial-layout-expected.txt: Added.
* web-platform-tests/css/cssom-view/resize-event-on-initial-layout.html: Added.
* web-platform-tests/css/cssom-view/screenLeftTop-expected.txt: Added.
* web-platform-tests/css/cssom-view/screenLeftTop.html: Added.
* web-platform-tests/css/cssom-view/scroll-behavior-default-css.html:
* web-platform-tests/css/cssom-view/scroll-behavior-element.html:
* web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html:
* web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html:
* web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html:
* web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html:
* web-platform-tests/css/cssom-view/scroll-behavior-smooth.html:
* web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html:
* web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html:
* web-platform-tests/css/cssom-view/scroll-no-layout-box.html:
* web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction-expected.txt: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction.html: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-expected.txt: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode.html: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin.html:
* web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding.html:
* web-platform-tests/css/cssom-view/scrollIntoView-shadow.html:
* web-platform-tests/css/cssom-view/scrollIntoView-smooth.html:
* web-platform-tests/css/cssom-view/scrollIntoView-svg-shape-expected.txt: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-svg-shape.html: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-and-rtl-direction-expected.txt: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-and-rtl-direction.html: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode-expected.txt: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-vertical-lr-writing-mode.html: Added.
* web-platform-tests/css/cssom-view/scrollIntoView-vertical-rl-writing-mode-expected.txt:
* web-platform-tests/css/cssom-view/scrollIntoView-vertical-rl-writing-mode.html:
* web-platform-tests/css/cssom-view/scrollWidthHeight.xht:
* web-platform-tests/css/cssom-view/scrollWidthHeightWhenNotScrollable.xht:
* web-platform-tests/css/cssom-view/scrolling-no-browsing-context.html:
* web-platform-tests/css/cssom-view/scrolling-quirks-vs-nonquirks.html:
* web-platform-tests/css/cssom-view/scrollingElement.html:
* web-platform-tests/css/cssom-view/scrollintoview.html:
* web-platform-tests/css/cssom-view/table-client-props.html:
* web-platform-tests/css/cssom-view/table-offset-props.html:
* web-platform-tests/css/cssom-view/table-scroll-props.html:
* web-platform-tests/css/cssom-view/ttwf-js-cssomview-getclientrects-length.html:
* web-platform-tests/css/cssom-view/w3c-import.log:
* web-platform-tests/css/cssom-view/window-screen-height-immutable.html:
* web-platform-tests/css/cssom-view/window-screen-height.html:
* web-platform-tests/css/cssom-view/window-screen-width-immutable.html:
* web-platform-tests/css/cssom-view/window-screen-width.html:

LayoutTests:

* TestExpectations:
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline-expected.txt: Added.
* platform/ios-simulator-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction-expected.txt: Added.
* tests-options.json:

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

2 years agoAX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisCli...
cfleizach@apple.com [Sat, 6 Jul 2019 08:14:16 +0000 (08:14 +0000)]
AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
https://bugs.webkit.org/show_bug.cgi?id=199435

Reviewed by Ryosuke Niwa.

Ensure we don't access null observers in speech callbacks.

* WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
(WebKit::WebSpeechSynthesisClient::voiceList):
(WebKit::WebSpeechSynthesisClient::speak):
(WebKit::WebSpeechSynthesisClient::pause):
(WebKit::WebSpeechSynthesisClient::resume):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::speakingErrorOccurred):
(WebKit::WebPage::boundaryEventOccurred):
(WebKit::WebPage::voicesDidChange):

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

2 years agoCarvana.com needs the fetch AbortSignal quirk
youenn@apple.com [Sat, 6 Jul 2019 05:37:36 +0000 (05:37 +0000)]
Carvana.com needs the fetch AbortSignal quirk
https://bugs.webkit.org/show_bug.cgi?id=199540

Reviewed by Chris Dumez.

Manually tested.

* page/Quirks.cpp:
(WebCore::Quirks::shouldIgnoreInvalidSignal const):

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

2 years agoFix thread safety bug in WebResourceLoadStatisticsTelemetry::calculateAndSubmit()
cdumez@apple.com [Sat, 6 Jul 2019 00:33:44 +0000 (00:33 +0000)]
Fix thread safety bug in WebResourceLoadStatisticsTelemetry::calculateAndSubmit()
https://bugs.webkit.org/show_bug.cgi?id=199536

Reviewed by Youenn Fablet.

The resourceLoadStatisticsStore is an object that is created / used / destroyed on the background
queue. It is therefore not safe to create a WeakPtr for it and use that WeakPtr on the main thread.

* NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
(WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):

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

2 years ago[WHLSL] The checker does not need to keep a separate m_typeAnnotations map
rmorisset@apple.com [Sat, 6 Jul 2019 00:33:01 +0000 (00:33 +0000)]
[WHLSL] The checker does not need to keep a separate m_typeAnnotations map
https://bugs.webkit.org/show_bug.cgi?id=199537

Reviewed by Myles C. Maxfield.

Nothing is ever deleted from it, and all of its contents are eventually copied into the expressions.
We might as well put the type annotations directly into the expressions in the first place.
It is about a 5% speedup of the checker.

No new test as there is no inteded functional change.

* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::Checker::assignTypes):
(WebCore::WHLSL::Checker::getInfo):
(WebCore::WHLSL::Checker::assignType):
(WebCore::WHLSL::Checker::forwardType):
(WebCore::WHLSL::Checker::visit):

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

2 years agoUnreviewed, fix -Wswitch warning
mcatanzaro@igalia.com [Fri, 5 Jul 2019 23:46:34 +0000 (23:46 +0000)]
Unreviewed, fix -Wswitch warning

We don't support HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain.

Fun fact, soup's OnlyFromMainDocumentDomain functions the same as Apple's
ExclusivelyFromMainDocumentDomain. These should be renamed....

* NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
(WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):

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

2 years agoTrigger a compositing update when video element is changing
simon.fraser@apple.com [Fri, 5 Jul 2019 23:36:28 +0000 (23:36 +0000)]
Trigger a compositing update when video element is changing
https://bugs.webkit.org/show_bug.cgi?id=199522
<rdar://problem/47297159>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/video/video-update-rendering.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::contentChanged):

LayoutTests:

* compositing/video/video-update-rendering-expected.txt: Added.
* compositing/video/video-update-rendering.html: Added.

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

2 years agoUnreviewed, fix -Wmisleading-indentation warning introduced in r246764
mcatanzaro@igalia.com [Fri, 5 Jul 2019 23:35:49 +0000 (23:35 +0000)]
Unreviewed, fix -Wmisleading-indentation warning introduced in r246764
https://bugs.webkit.org/show_bug.cgi?id=199173
<rdar://problem/45968770>

* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):

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

2 years ago[iOS] Context Menu - Add to Reading List does nothing
dino@apple.com [Fri, 5 Jul 2019 23:34:49 +0000 (23:34 +0000)]
[iOS] Context Menu - Add to Reading List does nothing
https://bugs.webkit.org/show_bug.cgi?id=199504
<rdar://problem/52554137>

Reviewed by Anders Carlsson.

We were holding weak references to the _WKElementAction in
the handler provided to UIAction. By the time the handler was
called, the object had been deallocated.

* UIProcess/API/Cocoa/_WKElementAction.mm:
(-[_WKElementAction uiActionForElementInfo:]): Use strong references in handler.

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

2 years agoMail's use of punchOutWhiteBackgroundsInDarkMode not working on iOS.
timothy@apple.com [Fri, 5 Jul 2019 23:19:34 +0000 (23:19 +0000)]
Mail's use of punchOutWhiteBackgroundsInDarkMode not working on iOS.
https://bugs.webkit.org/show_bug.cgi?id=199534
rdar://problem/52586836

Reviewed by Simon Fraser.

Tests: css3/color-filters/punch-out-white-backgrounds.html

* dom/Document.cpp:
(WebCore::Document::compositeOperatorForBackgroundColor const): Added.
Use CompositeDestinationOut for transparent frames, otherwise CompositeDestinationIn.
* dom/Document.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations): Use compositeOperatorForBackgroundColor.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintRootBoxFillLayers): Ditto.
(WebCore::RenderBox::paintBackground): Ditto.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto.

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

2 years agoArgumentsEliminationPhase::eliminateCandidatesThatInterfere() should not decrement...
mark.lam@apple.com [Fri, 5 Jul 2019 23:05:56 +0000 (23:05 +0000)]
ArgumentsEliminationPhase::eliminateCandidatesThatInterfere() should not decrement nodeIndex pass zero.
https://bugs.webkit.org/show_bug.cgi?id=199533
<rdar://problem/52669111>

Reviewed by Filip Pizlo.

JSTests:

* stress/ArgumentsEliminationPhase-eliminateCandidatesThatEscape-should-not-decrement-nodeIndex-pass-zero.js: Added.

Source/JavaScriptCore:

* dfg/DFGArgumentsEliminationPhase.cpp:

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

2 years agoRevert change to block playback when process is ostensibly "suspended".
jer.noble@apple.com [Fri, 5 Jul 2019 22:24:07 +0000 (22:24 +0000)]
Revert change to block playback when process is ostensibly "suspended".
https://bugs.webkit.org/show_bug.cgi?id=199530

Reviewed by Eric Carlson.

In r243958, a drive-by-fix was added that blocked playback when the WebProcess thought it
was susposed to be suspended. The intent was to keep the AVAudioSession for the process
from being activated just before the process was suspended, and thus avoid receiving an
"interruption" and having the AVAudioSession deactivated out from under us upon resuming.

Unfortunately, this caused problems when another process resumes the WebContent process
in order to start playback; namely the Now Playing UI's play button. Because we may receive
the play command long before whe notice that we've been resumed, the WebContent process
may refuse to honor the play command because it thinks its supposed to be suspended.

* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):

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

2 years ago[iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
rniwa@webkit.org [Fri, 5 Jul 2019 21:56:58 +0000 (21:56 +0000)]
[iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
https://bugs.webkit.org/show_bug.cgi?id=199503

Reviewed by Wenson Hsieh.

Source/WebCore:

* editing/Editor.cpp:
(WebCore::Editor::compositionRange const): Added a FIXME.

Source/WebKit:

The crash was caused because focusedElementPositionInformation asssumes Editor::compositionRange is not null
whenever Editor::hasComposition returns true, which is not necessary the case when Editor::m_compositionNode
contains no text (data is of length 0).

Fixed the crash by adding an early return for when Editor::compositionRange returns nullptr.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::focusedElementPositionInformation):

Tools:

Added UIScriptController.ensurePositionInformationIsUpToDateAt using the existing WKWebView SPI:
_requestActivatedElementAtPosition

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::ensurePositionInformationIsUpToDateAt):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::ensurePositionInformationIsUpToDateAt):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::ensurePositionInformationIsUpToDateAt):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::ensurePositionInformationIsUpToDateAt):
* WebKitTestRunner/ios/UIScriptControllerMac.mm:
(WTR::UIScriptController::ensurePositionInformationIsUpToDateAt):

LayoutTests:

Added a regression test for the crash.

* editing/input/delete-text-in-composition-expected.txt: Added.
* editing/input/delete-text-in-composition.html: Added.
* resources/ui-helper.js:
(window.UIHelper.ensurePositionInformationUpdateForElement): Added.

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

2 years agoWeb Inspector: current call frame indicator not visible in dark mode
drousso@apple.com [Fri, 5 Jul 2019 21:48:54 +0000 (21:48 +0000)]
Web Inspector: current call frame indicator not visible in dark mode
https://bugs.webkit.org/show_bug.cgi?id=199047
<rdar://problem/51922895>

Reviewed by Timothy Hatcher.

* UserInterface/Views/CallFrameTreeElement.css:
(.tree-outline .item.call-frame .status > .status-image):
(.tree-outline .item.call-frame.selected .status > .status-image):
Replace the CSS variables used for `fill` with their actual color value (in `light` mode),
as the semantic "name" of the variable doesn't really match its usage. As an example, the
current call frame shouldn't rely on the value of `--border-color`, as it's not a "border".

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

2 years agoUnreviewed, fix build failure on ARM64_32
ysuzuki@apple.com [Fri, 5 Jul 2019 21:30:31 +0000 (21:30 +0000)]
Unreviewed, fix build failure on ARM64_32
https://bugs.webkit.org/show_bug.cgi?id=182434

Implicit narrowing from uint64_t to uint32_t happens. We should explicitly narrow it because we already checked
the `length` is <= UINT32_MAX.

* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSpeciesCreate):

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

2 years ago[WHLSL] Standard library is too big to directly include in WebCore
mmaxfield@apple.com [Fri, 5 Jul 2019 21:14:59 +0000 (21:14 +0000)]
[WHLSL] Standard library is too big to directly include in WebCore
https://bugs.webkit.org/show_bug.cgi?id=198186
<rdar://problem/51288898>

Reviewed by Saam Barati.

Source/WebCore:

This patch adds almost the entire remainder of the standard library. There are a few
pieces missing:
- step() because of https://bugs.webkit.org/show_bug.cgi?id=199289
- sign() also because of https://bugs.webkit.org/show_bug.cgi?id=199289
- faceforward() because it calls sign()
- Some of the more rarely-used texturing functions (e.g. Gather()) https://bugs.webkit.org/show_bug.cgi?id=195813
- RWTextures https://bugs.webkit.org/show_bug.cgi?id=198985

There were two problems with adding so many standard library functions:
- We didn't want to increase the WebCore binary size that much
- Compiling all the functions at runtime took 7 seconds, which is much too long

This patch addresses the first problem by gzipping the standard library before including it in the binary.
At runtime, we use libcompression to unzip it.

To address the second problem, we did some analysis and found that 14% of that 7 seconds was simply
destroying all the AST nodes. Even if we eliminated all processing of the AST, simply having the AST
of the entire standard library built and destroyed would still be too slow. Therefore, this patch limits
which parts of the standard library get parsed in the first place. All the functions in the standard library
file are sorted by name, and each group of functions with the same name are preceeded by a comment of the
form /* Functions named xyz */. At build time, a Python script looks for all these comments, and builds a
map from function name to character offset inside the file where those functions begin. At run time, we
parse the user program first, look for all function calls within it, and look up those function call names
in the map to see which part of the standard library holds those functions. We then parse just that part.
Because the standard library can call other functions in the standard library, we do this in a loop until
we have exhausted all the functions.

Covered by existing tests.

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make: gzip the standard library, and add a build step to generate the offset map.
* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
(WebCore::WHLSL::AST::CallExpression::setOverloads):
(WebCore::WHLSL::AST::CallExpression::function): Every caller of this ASSERT()s the result. Might as well
move the ASSERT() into the function.
(WebCore::WHLSL::AST::CallExpression::setFunction):
* Modules/webgpu/WHLSL/Cocoa/WHLSLStandardLibraryUtilities.cpp: Added.
(WebCore::WHLSL::decompressStandardLibrary): Use libcompression. This is why this file is in a Cocoa/
subfolder, and is listed in SourcesCocoa.txt instead of Sources.txt.
(WebCore::WHLSL::decompressAndDecodeStandardLibrary):
(WebCore::WHLSL::NameFinder::takeFunctionNames):
(WebCore::WHLSL::includeStandardLibrary): Include only the bits of the standard library which are relevant,
as described above.
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: Only emit MSL code for functions which are actually
reached. The MSL compiler is a significant amount of our compile time, so reducing the size of the emitted
program can significantly improve compile times.
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
(WebCore::WHLSL::Metal::sharedMetalFunctions):
(WebCore::WHLSL::Metal::metalFunctions):
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
(WebCore::WHLSL::Metal::writeNativeFunction):
- Change how load() and store() are written. We need explicit functions because we have explicit atomic
  types, which HLSL doesn't have. load() and store() aren't present in HLSL.
- Delete f16tof32 because they're probably not important and are not obvious how to implement. We can re-add
  them again later if necessary.
- Various fixes to make us generate the correct MSL code for each standard library function.
* Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: Added. Build the function map as described
above.
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveByInstantiation): Previously, the standard library included an operator== for two
pointers. However, that function should be generated by the compiler instead. This fixes the bug in the
compiler which allows the compiler to correctly generate the right function. This also prompted me to file
https://bugs.webkit.org/show_bug.cgi?id=199335
(WebCore::WHLSL::checkOperatorOverload):
(WebCore::WHLSL::Checker::visit):
* Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Update to the new function() signature.
* Modules/webgpu/WHLSL/WHLSLLexer.h: Add a new position() method to the lexer. This isn't actually used
in this patch, but it's useful when doing some analysis during parsing.
(WebCore::WHLSL::Lexer::Lexer):
(WebCore::WHLSL::Lexer::consumeToken):
(WebCore::WHLSL::Lexer::peek const):
(WebCore::WHLSL::Lexer::peekFurther const):
(WebCore::WHLSL::Lexer::position const):
(WebCore::WHLSL::Lexer::state const):
(WebCore::WHLSL::Lexer::setState):
(WebCore::WHLSL::Lexer::isFullyConsumed const): Fixes a bug where isFullyConsumed() might return true even
when there is a token in the ring buffer.
(WebCore::WHLSL::Lexer::peek): Deleted.
(WebCore::WHLSL::Lexer::peekFurther): Deleted.
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
(WebCore::WHLSL::NameResolver::visit): Drive-by partial fix of https://bugs.webkit.org/show_bug.cgi?id=199347
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Call includeStandardLibrary().
(WebCore::WHLSL::prepareShared):
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
* Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
* Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
* Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:

LayoutTests:

The standard library doesn't include any matrix constructors that broadcast a single value
to every field in a matrix. https://bugs.webkit.org/show_bug.cgi?id=199333

* webgpu/whlsl-matrix.html:

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

2 years ago[JSC] Clean up ArraySpeciesCreate
commit-queue@webkit.org [Fri, 5 Jul 2019 20:26:02 +0000 (20:26 +0000)]
[JSC] Clean up ArraySpeciesCreate
https://bugs.webkit.org/show_bug.cgi?id=182434

Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-07-05
Reviewed by Yusuke Suzuki.

JSTests:

Adjusts error message expectations in stress tests.

* stress/array-flatmap.js:
* stress/array-flatten.js:
* stress/array-species-create-should-handle-masquerader.js:
* test262/expectations.yaml: Mark 4 test cases as passing.

Source/JavaScriptCore:

We have duplicate code in arraySpeciesCreate, filter, map, concatSlowPath of ArrayPrototype.js
and speciesConstructArray of ArrayPrototype.cpp. This patch fixes cross-realm Array constructor
detection in native speciesConstructArray, upgrades `length` type to correctly handle large integers,
and exposes it as @arraySpeciesCreate. Also removes now unused @isArrayConstructor private function.
Native speciesConstructArray is preferred because it has fast path via speciesWatchpointIsValid.

Thoroughly benchmarked: this change progresses ARES-6 by 0-1%.

* builtins/ArrayPrototype.js:
(filter):
(map):
(globalPrivate.concatSlowPath):
(globalPrivate.arraySpeciesCreate): Deleted.
* builtins/BuiltinNames.h:
* runtime/ArrayConstructor.cpp:
(JSC::arrayConstructorPrivateFuncIsArrayConstructor): Deleted.
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSpeciesCreate):
* runtime/ArrayPrototype.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):

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

2 years agoAdd fetch quirk for www.bnz.co.nz
youenn@apple.com [Fri, 5 Jul 2019 20:13:08 +0000 (20:13 +0000)]
Add fetch quirk for www.bnz.co.nz
https://bugs.webkit.org/show_bug.cgi?id=199518
rdar://problem/52230914

Reviewed by Chris Dumez.

Use fetch quirk to make bnz main page load properly.
Manually tested.

* page/Quirks.cpp:
(WebCore::Quirks::shouldIgnoreInvalidSignal const):

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

2 years ago[WHLSL] Optimize the lexer
rmorisset@apple.com [Fri, 5 Jul 2019 20:10:36 +0000 (20:10 +0000)]
[WHLSL] Optimize the lexer
https://bugs.webkit.org/show_bug.cgi?id=199520

Reviewed by Myles Maxfield.

This patch includes a number of small optimizations to the lexer:
- By creating two new types of Token (Invalid and EOF), we can avoid having to manipulate Optional<Token> everywhere
- By combining the lexing of identifiers, keywords and operator names, we can avoid re-reading them several times
- By storing mere offsets in the tokens instead of string views, we save space in the common case where the string view is unused (e.g. for keywords)
- By storing mere offsets in the tokens instead of line numbers, we can simplify the whitespace and comment lexing; and we can easily recompute the line number on demand
- By using templates we can avoid constructing and destructing vectors at runtime every time we call tryTypes, consumeTypes or peekTypes; as well as avoiding a call to find().
- I also hoisted the length check out of the loop in Lexer::string()
All of this combined brought the time spent in the parser when running LayoutTests/webgpu/whlsl-test-harness-test.html 5 times on my machine from 612ms to 462ms.

I also removed the 'anyCharacter' method since it was dead code.
I also removed Lexer::position(), but it is directly equivalent now to peek().startOffset.

No new tests as there is no intended functional change.

* Modules/webgpu/WHLSL/WHLSLLexer.cpp:
(WebCore::WHLSL::Lexer::Token::typeName):
(WebCore::WHLSL::Lexer::consumeTokenFromStream):
(WebCore::WHLSL::Lexer::lineNumberFromOffset):
(WebCore::WHLSL::isWhitespace):
(WebCore::WHLSL::isNewline):
(WebCore::WHLSL::Lexer::skipWhitespaceAndComments):
(WebCore::WHLSL::Lexer::digitStar const):
(WebCore::WHLSL::Lexer::completeOperatorName const):
* Modules/webgpu/WHLSL/WHLSLLexer.h:
(WebCore::WHLSL::Lexer::Lexer):
(WebCore::WHLSL::Lexer::Token::stringView):
(WebCore::WHLSL::Lexer::consumeToken):
(WebCore::WHLSL::Lexer::peek const):
(WebCore::WHLSL::Lexer::peekFurther const):
(WebCore::WHLSL::Lexer::state const):
(WebCore::WHLSL::Lexer::setState):
(WebCore::WHLSL::Lexer::isFullyConsumed const):
(WebCore::WHLSL::Lexer::errorString):
(WebCore::WHLSL::Lexer::string const):
* Modules/webgpu/WHLSL/WHLSLNameResolver.h:
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Parser::parse):
(WebCore::WHLSL::Parser::peek):
(WebCore::WHLSL::Parser::peekFurther):
(WebCore::WHLSL::Types::includes):
(WebCore::WHLSL::Types::appendNameTo):
(WebCore::WHLSL::Types<t>::includes):
(WebCore::WHLSL::Types<t>::appendNameTo):
(WebCore::WHLSL::Parser::peekTypes):
(WebCore::WHLSL::Parser::tryType):
(WebCore::WHLSL::Parser::tryTypes):
(WebCore::WHLSL::Parser::consumeType):
(WebCore::WHLSL::Parser::consumeTypes):
(WebCore::WHLSL::Parser::consumeIntegralLiteral):
(WebCore::WHLSL::Parser::parseConstantExpression):
(WebCore::WHLSL::Parser::parseTypeArgument):
(WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
(WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
(WebCore::WHLSL::Parser::parseType):
(WebCore::WHLSL::Parser::parseTypeDefinition):
(WebCore::WHLSL::Parser::parseBuiltInSemantic):
(WebCore::WHLSL::Parser::parseResourceSemantic):
(WebCore::WHLSL::Parser::parseQualifiers):
(WebCore::WHLSL::Parser::parseStructureElement):
(WebCore::WHLSL::Parser::parseStructureDefinition):
(WebCore::WHLSL::Parser::parseEnumerationDefinition):
(WebCore::WHLSL::Parser::parseEnumerationMember):
(WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
(WebCore::WHLSL::Parser::parseParameter):
(WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
(WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
(WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
(WebCore::WHLSL::Parser::parseBlockBody):
(WebCore::WHLSL::Parser::parseSwitchCase):
(WebCore::WHLSL::Parser::parseVariableDeclaration):
(WebCore::WHLSL::Parser::parseStatement):
(WebCore::WHLSL::Parser::parseEffectfulAssignment):
(WebCore::WHLSL::Parser::parseLimitedSuffixOperator):
(WebCore::WHLSL::Parser::parseSuffixOperator):
(WebCore::WHLSL::Parser::completeAssignment):
(WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
(WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
(WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
(WebCore::WHLSL::Parser::completePossibleShift):
(WebCore::WHLSL::Parser::completePossibleAdd):
(WebCore::WHLSL::Parser::completePossibleMultiply):
(WebCore::WHLSL::Parser::parsePossiblePrefix):
(WebCore::WHLSL::Parser::parseCallExpression):
(WebCore::WHLSL::Parser::parseTerm):
* Modules/webgpu/WHLSL/WHLSLParser.h:
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
(WebCore::WHLSL::anonymousToken):

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

2 years ago[WHLSL] Remove the phase resolveCallsInFunctions
rmorisset@apple.com [Fri, 5 Jul 2019 20:09:39 +0000 (20:09 +0000)]
[WHLSL] Remove the phase resolveCallsInFunctions
https://bugs.webkit.org/show_bug.cgi?id=199474

Reviewed by Myles Maxfield.

This pass only stores into each property access and call expression vectors of all the functions it might be calling, for use by the Checker afterwards.
But the checker is perfectly able to compute a pointer to these vectors by itself.
So by removing this pass, we gain the following:
- One less pass over the AST
- No need to copy these vectors (which can be large for heavily overloaded functions, of which there are quite a few in the stdlib)
- No need to have these vectors in the expressions, saving 24 bytes per CallExpression and 72 bytes per PropertyAccessExpression
- No need to allocate and then destroy these vectors.

No new tests as there is no intended functional change.

* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
(WebCore::WHLSL::AST::CallExpression::castReturnType):
* Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
* Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
(WebCore::WHLSL::AutoInitialize::visit):
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveFunction):
(WebCore::WHLSL::Checker::finishVisiting):
(WebCore::WHLSL::Checker::visit):
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
(WebCore::WHLSL::NameResolver::NameResolver):
(WebCore::WHLSL::NameResolver::visit):
* Modules/webgpu/WHLSL/WHLSLNameResolver.h:
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
(WebCore::WHLSL::prepareShared):

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

2 years agoWeb Inspector: Elements: use a CSS transition when showing/hiding DOM breakpoint...
mattbaker@apple.com [Fri, 5 Jul 2019 20:06:47 +0000 (20:06 +0000)]
Web Inspector: Elements: use a CSS transition when showing/hiding DOM breakpoint gutter
https://bugs.webkit.org/show_bug.cgi?id=199411

Reviewed by Devin Rousso.

* UserInterface/Views/DOMTreeContentView.css:
(.content-view.dom-tree .tree-outline.dom):

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

2 years agoTest freshness page should expose revision information for latest build on tooltip.
dewei_zhu@apple.com [Fri, 5 Jul 2019 19:19:28 +0000 (19:19 +0000)]
Test freshness page should expose revision information for latest build on tooltip.
https://bugs.webkit.org/show_bug.cgi?id=199483

Reviewed by Ryosuke Niwa.

Added latest build revision information on test freshness page tooltip.

* public/v3/pages/test-freshness-page.js: Add build revision information on tooltip.
(TestFreshnessPage.prototype.didConstructShadowTree):
(TestFreshnessPage.prototype._fetchTestResults):
(TestFreshnessPage.prototype.render):
(TestFreshnessPage.prototype._renderTooltip):
(TestFreshnessPage.cssTemplate):

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

2 years ago[ContentChangeObserver] REGRESSION (r247015): facebook photo/video upload button...
zalan@apple.com [Fri, 5 Jul 2019 19:12:43 +0000 (19:12 +0000)]
[ContentChangeObserver] REGRESSION (r247015): facebook photo/video upload button is unresponsive to user interaction.
https://bugs.webkit.org/show_bug.cgi?id=199502
<rdar://problem/52547473>

Reviewed by Simon Fraser.

Source/WebKit:

Apparently it's a common practice to put transparent elements over visible click targets (button like divs) and use the invisible
elements to catch the user input (e.g. Facebook's Photo/Video button).
This patch modifies the original "do not trigger click on invisible targets" heuristic to a more restrictive "do not trigger
click if the click target was previously hidden and became visible through touch start".
If this still breaks some use cases, we could turn it into YouTube quirk.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):

LayoutTests:

* fast/events/touch/ios/content-observation/opacity-change-happens-on-touchstart-with-transition3-expected.txt: Added.
* fast/events/touch/ios/content-observation/opacity-change-happens-on-touchstart-with-transition3.html: Added.

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

2 years agoUnreviewed, change the value used to scribble Heap::m_worldState
tzagallo@apple.com [Fri, 5 Jul 2019 18:57:55 +0000 (18:57 +0000)]
Unreviewed, change the value used to scribble Heap::m_worldState
https://bugs.webkit.org/show_bug.cgi?id=199498

Follow-up after r247160. The value used to scribble should have the
conn bit set.

* heap/Heap.cpp:
(JSC::Heap::~Heap):

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

2 years ago[iOS] Local capture MediaStreamTrack does not render in portrait mode
youenn@apple.com [Fri, 5 Jul 2019 18:54:14 +0000 (18:54 +0000)]
[iOS] Local capture MediaStreamTrack does not render in portrait mode
https://bugs.webkit.org/show_bug.cgi?id=199519
<rdar://problem/52689720>

Reviewed by Eric Carlson.

Source/WebCore:

RealtimeVideoSource was badly computing its size in case of rotation.
Whenever its underlying source is notifying of settings change,
compute the size and transpose it only in left/right case.

Update mock video source to cover that case.
Covered by updated test.

* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::sourceSettingsChanged):
* platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::settings):
(WebCore::MockRealtimeVideoSource::orientationChanged):
(WebCore::MockRealtimeVideoSource::monitorOrientation):
* platform/mock/MockRealtimeVideoSource.h:

LayoutTests:

* webrtc/video-rotation-expected.txt:
* webrtc/video-rotation.html:

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

2 years agoUnreviewed, rolling out r247115.
ryanhaddad@apple.com [Fri, 5 Jul 2019 18:05:53 +0000 (18:05 +0000)]
Unreviewed, rolling out r247115.

Breaks lldbWebKitTester (and by extension, test-webkitpy)

Reverted changeset:

"[WHLSL] Standard library is too big to directly include in
WebCore"
https://bugs.webkit.org/show_bug.cgi?id=198186
https://trac.webkit.org/changeset/247115

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

2 years agoUnreviewed, rolling out r247159.
ryanhaddad@apple.com [Fri, 5 Jul 2019 18:00:54 +0000 (18:00 +0000)]
Unreviewed, rolling out r247159.

IndexedDB layout tests are failing the new assert.

Reverted changeset:

"ASSERT that a sessionID is valid when encoding it"
https://bugs.webkit.org/show_bug.cgi?id=199302
https://trac.webkit.org/changeset/247159

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

2 years agoUnreviewed, rolling out r247123.
ryanhaddad@apple.com [Fri, 5 Jul 2019 16:59:42 +0000 (16:59 +0000)]
Unreviewed, rolling out r247123.

Caused TestWebKitAPI.Challenge.BasicProposedCredential to
fail.

Reverted changeset:

"Only allow fetching and removing session credentials from
WebsiteDataStore"
https://bugs.webkit.org/show_bug.cgi?id=199385
https://trac.webkit.org/changeset/247123

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

2 years agoClick events on outer page are not being dispatched correctly after touch-zooming...
wenson_hsieh@apple.com [Fri, 5 Jul 2019 16:58:06 +0000 (16:58 +0000)]
Click events on outer page are not being dispatched correctly after touch-zooming within an iframe
https://bugs.webkit.org/show_bug.cgi?id=185001
<rdar://problem/40569615>

Reviewed by Simon Fraser.

Source/WebKit:

Mitigations introduced in r227759 prevent a touch inside a document of origin A to result in a click event being
dispatched on an element inside a document of origin B. It accomplishes this by keeping track of the security
origin of the last touch via m_potentialTapSecurityOrigin on WebPage. However, there exists a corner case in
which m_potentialTapSecurityOrigin, set after touching a document in a subframe, may persist even after the user
has finished interacting, causing taps in subsequent documents to not result in synthetic click events due to
mismatched potential tap origins.

This may happen if the first user gesture happens inside an element in a subframe with touch event handlers, but
no click event handler (and the touch is additionally not over some clickable element). In this case,
m_potentialTapNode is set to null in WebPage::potentialTapAtPosition, and when we consult it in
WebPage::commitPotentialTap, we just end up calling commitPotentialTapFailed(); and return early. This means
that m_potentialTapNode, m_potentialTapLocation, and (importantly) m_potentialTapSecurityOrigin are not reset.
This causes subsequent taps in the top-level document to never dispatch click events, if the security origin
does not match with that of the subframe.

To fix this, we add a new async IPC message from the UI process to the web process to ensure that our current
security origin is reset before attempting to handle a tap.

Test: http/tests/events/touch/ios/click-after-handling-touch-in-cross-origin-frame.https.html

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetPotentialTapSecurityOrigin):

Reset any stale potential tap security origin if needed.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _webTouchEventsRecognized:]):

Send the new IPC message when starting a touch.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::resetPotentialTapSecurityOrigin):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

LayoutTests:

Add a new layout test to verify that after interacting with an element with touch event handlers in a cross-
origin subframe, the user is still able to click on elements on the top level document.

* http/tests/events/touch/ios/click-after-handling-touch-in-cross-origin-frame.https-expected.txt: Added.
* http/tests/events/touch/ios/click-after-handling-touch-in-cross-origin-frame.https.html: Added.
* http/tests/events/touch/ios/resources/touch-target.html: Added.

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

2 years agoScribble Heap::m_worldState on destructor
tzagallo@apple.com [Fri, 5 Jul 2019 16:38:40 +0000 (16:38 +0000)]
Scribble Heap::m_worldState on destructor
https://bugs.webkit.org/show_bug.cgi?id=199498

Reviewed by Sam Weinig.

The worldState is dumped when we crash due to a failed checkConn, and
this will make it clear if the heap has already been destroyed.

* heap/Heap.cpp:
(JSC::Heap::~Heap):

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

2 years agoASSERT that a sessionID is valid when encoding it
youenn@apple.com [Fri, 5 Jul 2019 16:24:26 +0000 (16:24 +0000)]
ASSERT that a sessionID is valid when encoding it
https://bugs.webkit.org/show_bug.cgi?id=199302

Reviewed by Darin Adler.

Source/WebCore:

For IDBValue, instead of encoding an invalid session ID, encode a boolean that tells there is no sessionID.
For IDBRequestData, keep track of whether there is an IDBDatabaseIdentifier
and encode/decode accordingly to not encode an invalid sessionID.
No observable change of behavior.

* Modules/indexeddb/IDBValue.h:
(WebCore::IDBValue::sessionID const):
(WebCore::IDBValue::encode const):
(WebCore::IDBValue::decode):
* Modules/indexeddb/shared/IDBRequestData.cpp:
(WebCore::IDBRequestData::isolatedCopy):
* Modules/indexeddb/shared/IDBRequestData.h:
(WebCore::IDBRequestData::databaseIdentifier const):
(WebCore::IDBRequestData::decode):

Source/WebCore/PAL:

ASSERT that a sessionID is valid at encoding/decoding time.

* pal/SessionID.h:
(PAL::SessionID::encode const):
(PAL::SessionID::decode):

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

2 years agoTouching media controls sometimes shows software keyboard
wenson_hsieh@apple.com [Fri, 5 Jul 2019 16:22:42 +0000 (16:22 +0000)]
Touching media controls sometimes shows software keyboard
https://bugs.webkit.org/show_bug.cgi?id=199490
<rdar://problem/52076270>

Reviewed by Eric Carlson.

Source/WebKit:

In r243044, we added a compatibility hack for Google Slides (and other G-suite properties) to allow the on-
screen keyboard to show up after a prevented touch event in the case where an element was already focused, even
if the touch event handler doesn't explicitly refocus the element. However, this means that if a regular text
field (or other form control) has been programmatically focused, then interacting with any other element that
prevents default on touchstart will cause us to show the keyboard for that focused element.

To mitigate this, only fall down this refocusing codepath in the case where the focused element is a hidden
editable element (in the style of many Google productivity web apps). For non-hidden editable elements that are
already focused, this refocusing logic is not necessary, since the user should be able to interact with the
control to show the keyboard anyways; for hidden editable areas, this compatibility hack is actually needed,
since there is typically no other way for a user to focus these elements and show an on-screen keyboard.

Tests:  fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
        fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart.html

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::dispatchTouchEvent):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::isTransparentOrFullyClipped const):

Renamed from enclosingLayerIsTransparentOrFullyClipped, and pulled out into a private helper method.

(WebKit::WebPage::platformEditorState const):
(WebKit::WebPage::requestEvasionRectsAboveSelection):
(WebKit::WebPage::getFocusedElementInformation):
(WebKit::enclosingLayerIsTransparentOrFullyClipped): Deleted.

Tools:

Adds plumbing for a new testing hook to check whether or not there is an active input session. See other
ChangeLog entries for more detail.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::hasInputSession const):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::hasInputSession const):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::hasInputSession const):

LayoutTests:

Adds a new layout test to verify that the keyboard only appears after a handled touch event if the focused
element is inside a hidden editable area; otherwise, the keyboard should not be present.

* fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart-expected.txt: Added.
* fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart.html: Added.

This test passes as long as we didn't begin showing the keyboard after tapping.

* fast/events/touch/ios/show-keyboard-after-preventing-touchstart-expected.txt:
* fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html:

Adjust this existing test to make the focused textarea hidden.

* resources/ui-helper.js:
(window.UIHelper.hasInputSession):

Add a new testing hook to check whether there is an active input session.

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

2 years agoVersioning.
bshafiei@apple.com [Fri, 5 Jul 2019 15:15:07 +0000 (15:15 +0000)]
Versioning.

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

2 years ago[LFC][IFC] Inline runs should be relative to the line's top/left initially
zalan@apple.com [Fri, 5 Jul 2019 14:24:23 +0000 (14:24 +0000)]
[LFC][IFC] Inline runs should be relative to the line's top/left initially
https://bugs.webkit.org/show_bug.cgi?id=199157
<rdar://problem/52053415>

Reviewed by Antti Koivisto.

Let's construct the runs relative to the line's top/left and convert them relative to the formatting root's border box top/left
when the line is being closed. When the line moves (floats etc) we don't have to move each runs individually.

* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::close):
(WebCore::Layout::Line::moveLogicalLeft):
(WebCore::Layout::Line::appendInlineContainerStart):
(WebCore::Layout::Line::appendTextContent):
(WebCore::Layout::Line::appendNonReplacedInlineBox):
(WebCore::Layout::Line::appendHardLineBreak):

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

2 years agoREGRESSION(r244218): desmos.com: Cannot scroll formulas region when region is scrollable
antti@apple.com [Fri, 5 Jul 2019 14:18:46 +0000 (14:18 +0000)]
REGRESSION(r244218): desmos.com: Cannot scroll formulas region when region is scrollable
https://bugs.webkit.org/show_bug.cgi?id=199508
<rdar://problem/50925173>

Reviewed by Zalan Bujtas.

The page invokes preventDefault on simulated mouse events which stops scrolling.
To fix, add a quirk that turns simulated mouse events non-cancelable.

* dom/MouseEvent.h:
* dom/ios/MouseEventIOS.cpp:
(WebCore::MouseEvent::create):
* page/Quirks.cpp:
(WebCore::Quirks::simulatedMouseEventTypeForTarget const):
(WebCore::Quirks::shouldDispatchSimulatedMouseEventsOnTarget const): Deleted.

To avoid adding more similar functions, and for future flexibility, make this one return the type too.

* page/Quirks.h:

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

2 years ago[LFC][IFC] Empty text node should generate empty InlineTextItem
zalan@apple.com [Fri, 5 Jul 2019 14:02:22 +0000 (14:02 +0000)]
[LFC][IFC] Empty text node should generate empty InlineTextItem
https://bugs.webkit.org/show_bug.cgi?id=199495
<rdar://problem/52643225>

Reviewed by Antti Koivisto.

Empty text nodes generate empty RenderText renderers but they don't generate inline boxes.
This patch aligns LFC with the current rendering code.

* layout/inlineformatting/InlineLine.cpp:
(WebCore::Layout::Line::appendTextContent):
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):

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

2 years agoRemove Wincorrect WPT test pointerevents/pointerevent_mouse_pointercapture_inactivate...
graouts@webkit.org [Fri, 5 Jul 2019 11:27:47 +0000 (11:27 +0000)]
Remove Wincorrect WPT test pointerevents/pointerevent_mouse_pointercapture_inactivate_pointer.html
https://bugs.webkit.org/show_bug.cgi?id=199512

Unreviewed, just removing a test that was removed from the WPT repository (https://github.com/web-platform-tests/wpt/pull/17614).

* web-platform-tests/pointerevents/pointerevent_mouse_pointercapture_inactivate_pointer-expected.txt: Removed.
* web-platform-tests/pointerevents/pointerevent_mouse_pointercapture_inactivate_pointer.html: Removed.
* web-platform-tests/pointerevents/resources/pointerevent_mouse_pointercapture_inactivate_pointer-iframe.html: Removed.

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

2 years ago[ATK] Do not use C linkage for functions using C++ features
aperez@igalia.com [Fri, 5 Jul 2019 11:23:19 +0000 (11:23 +0000)]
[ATK] Do not use C linkage for functions using C++ features
https://bugs.webkit.org/show_bug.cgi?id=199510
<rdar://problem/52674702>

Reviewed by Carlos Garcia Campos.

No new tests needed.

* accessibility/atk/WebKitAccessible.h: Move function and type declarations involving
C++ features outside of the block delimited by the G_BEGIN_DECLS and G_END_DECLS macros,
which were setting the C linkage.

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

2 years ago[Pointer Events] Respect pointer capture when dispatching mouse boundary events and...
graouts@webkit.org [Fri, 5 Jul 2019 10:25:06 +0000 (10:25 +0000)]
[Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover
https://bugs.webkit.org/show_bug.cgi?id=198999
<rdar://problem/51979477>

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark the progressions in 3 WPT tests.

* web-platform-tests/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-expected.txt:
* web-platform-tests/pointerevents/pointerevent_mouse_capture_change_hover-expected.txt:
* web-platform-tests/pointerevents/pointerevent_setpointercapture_relatedtarget-expected.txt:

Source/WebCore:

Up until now, we would not account for pointer capture (see ​https://w3c.github.io/pointerevents/#pointer-capture) when dispatching
mouse boundary events (mouseover, mouseout, mouseenter, mouseleave) and their counterpart pointer events. We would also not account
for it when updating :hover styles.

Now, when pointer capture changes for an element, we call setCapturingMouseEventsElement() on the EventHandler such that the element
that would naturally hit-test is overridden by the pointer capture element when identifying which target to use for the dispatch of
boundary mouse events. Additionally, when calling Document::prepareMouseEvent(), we also use the pointer capture element to
pass down to Document::updateHoverActiveState() such that :hover styles are applied to the correct element.

* dom/Document.cpp:
(WebCore::Document::prepareMouseEvent): When a new event is going to be dispatched, we must run the Process Pending Capture Element
steps as mandated by the Pointer Events spec. Calling this will dispatch the appropriate pointer capture change events and also
required boundary events since EventHandler::setCapturingMouseEventsElement() calls into EventHandler::updateMouseEventTargetNode().
Since this may update the capturing mouse events element, we ensure that we call updateHoverActiveState() with a flag that indicates that.
Finally, we use the capturing mouse events element instead of the hit-testing element to pass to updateHoverActiveState() to ensure
that is has :hover styles applied.
(WebCore::Document::updateHoverActiveState): Account for the new CaptureChange flag to force the invalidation of the :hover and :active
elements chain at all times when the capturing mouse events element changed.
* dom/Document.h:
* dom/PointerEvent.h: Update PointerEvent::createForPointerCapture() to take specific parameters rather than a single PointerEvent to
set the pointerId, isPrimary and pointerType properties of the generated event. This is required to call processPendingPointerCapture()
outside of PointerEvent dispatch logic since we now call it from Document::prepareMouseEvent() where we haven't yet generated such an
event.
* page/EventHandler.cpp:
(WebCore::EventHandler::pointerCaptureElementDidChange): When a new pointer capture element is set, call updateMouseEventTargetNode()
to ensure that boundary events are fired to indicate the pointer capture state change.
(WebCore::EventHandler::prepareMouseEvent): Keep track of the last PlatformMouseEvent used to prepare a mouse event so that we can use
it when setCapturingMouseEventsElement() is called.
* page/EventHandler.h:
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::pointerCaptureElement): Since Document::prepareMouseEvent() needs to know the current pointer capture
element, add a new public method that indicates the pointer capture element if that element is contained in the provided document. We need
to provide the document since PointerCaptureController is owned by the Page and may manage several documents.
(WebCore::PointerCaptureController::dispatchEvent): Only run the Process Pending Capture Element steps when dealing with a touch or pen
event since those steps are already ran for mouse events in Document::prepareMouseEvent(). Additionally, since the element target is already
set to be the pointer capture element with the changes made to processPendingPointerCapture(), and because on iOS pointer capture is always
active, we can remove the code that would retarget the event to the pointer capture element.
(WebCore::PointerCaptureController::pointerEventWasDispatched):
(WebCore::PointerCaptureController::cancelPointer):
(WebCore::PointerCaptureController::processPendingPointerCapture): We now call into EventHandler::setCapturingMouseEventsElement() when the
capture target element changes. We must be careful to call this method prior to dispatching the "gotpointercapture" event and after dispatching
the "lostpointercapture" event so that boundary events are fired at the right time.
* page/PointerCaptureController.h:

LayoutTests:

Update some WK1-specific expectations.

* platform/mac-wk1/imported/w3c/web-platform-tests/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/pointerevents/pointerevent_setpointercapture_relatedtarget-expected.txt:

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

2 years ago[ContentChangeObserver] didFinishTransition triggers a nested style recalc via isCons...
zalan@apple.com [Fri, 5 Jul 2019 05:44:17 +0000 (05:44 +0000)]
[ContentChangeObserver] didFinishTransition triggers a nested style recalc via isConsideredClickable
https://bugs.webkit.org/show_bug.cgi?id=199506
<rdar://problem/52656221>

Reviewed by Ryosuke Niwa.

Source/WebCore:

isConsideredClickable() may trigger style update through Node::computeEditability. Let's adjust the observer state in the next runloop.

Test: fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-and-recursive-update-style.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::didFinishTransition):
* page/ios/ContentChangeObserver.h:

LayoutTests:

* fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-and-recursive-update-style-expected.txt: Added.
* fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-and-recursive-update-style.html: Added.

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

2 years agoSimplify logic that handles registering WebProcessProxy objects with their WebsiteDat...
cdumez@apple.com [Thu, 4 Jul 2019 23:53:21 +0000 (23:53 +0000)]
Simplify logic that handles registering WebProcessProxy objects with their WebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=199412
<rdar://problem/51899751>

Reviewed by Ryosuke Niwa.

Simplify logic that handles registering WebProcessProxy objects with their WebsiteDataStore to make
it more maintainable and less error-prone (avoid bugs like <rdar://problem/51899751>).

The following changes were made:
1. The WebProcess now registers / unregisters itself directly with its WebsiteDataStore when needed,
   instead of having the WebPageProxy/ProvisionalPageProxy be in charge of calling the right
   WebProcessLifetimeTracker / WebProcessLifetimeObserver abstractions.
2. The WebProcessLifetimeTracker / WebProcessLifetimeObserver abstractions were dropped. The
   WebsiteDataStore was the only observer.
3. The WebProcessProxy is now registered with its WebsiteDataStore as soon as it has a page (provisional
   or not) instead of waiting until the process has finished launching. This simplifies the logic a
   lot and waiting until the process has launched is not needed by the WebsiteDataStore.

* Sources.txt:
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::m_resetRecentCrashCountTimer):
(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::processDidTerminate):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::CachedProcess::CachedProcess):
* UIProcess/WebProcessLifetimeObserver.cpp: Removed.
* UIProcess/WebProcessLifetimeObserver.h: Removed.
* UIProcess/WebProcessLifetimeTracker.cpp: Removed.
* UIProcess/WebProcessLifetimeTracker.h: Removed.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setWebsiteDataStore):
(WebKit::WebProcessProxy::updateRegistrationWithDataStore):
(WebKit::WebProcessProxy::addProvisionalPageProxy):
(WebKit::WebProcessProxy::removeProvisionalPageProxy):
(WebKit::WebProcessProxy::connectionWillOpen):
(WebKit::WebProcessProxy::processWillShutDown):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::removeWebPage):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::registerProcess):
(WebKit::WebsiteDataStore::unregisterProcess):

(WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
Drop change that was added in r246097 to work around the fact that WebProcessProxy objects
were only registering themselves with their data store after their process had finished
launching.

(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::removeData):
(WebKit::WebsiteDataStore::processPools const):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::processes const):
* WebKit.xcodeproj/project.pbxproj:

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

2 years ago[ContentChangeObserver] Limit mouseOut dispatching after synthetic click to YouTube.com
zalan@apple.com [Thu, 4 Jul 2019 22:32:33 +0000 (22:32 +0000)]
[ContentChangeObserver] Limit mouseOut dispatching after synthetic click to YouTube.com
https://bugs.webkit.org/show_bug.cgi?id=199497
<rdar://problem/52361019>

Reviewed by Wenson Hsieh.

Source/WebCore:

r242798 introduced synthetic mouseOut dispatching soon after sythentic click to dismiss certain type of content (e.g. video control bar on YouTube).
However on many sites, it resulted in dismissing useful content, like menu panes and other, non-clickable but informative content.
This patch limits the mouseOut dispatching to YouTube.com.

Test: fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click.html

* page/Quirks.cpp:
(WebCore::Quirks::needsYouTubeMouseOutQuirk const):
* page/Quirks.h:
* page/Settings.yaml:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setShouldDispatchSyntheticMouseOutAfterSyntheticClick):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):

LayoutTests:

* fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html:
* fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-expected.txt: Added.
* fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click.html: Copied from LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html.

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

2 years agoUnreviewed, rolling out r247127.
ryanhaddad@apple.com [Thu, 4 Jul 2019 18:53:37 +0000 (18:53 +0000)]
Unreviewed, rolling out r247127.

Broke the watchOS build.

Reverted changeset:

"[WHLSL] Remove the phase resolveCallsInFunctions"
https://bugs.webkit.org/show_bug.cgi?id=199474
https://trac.webkit.org/changeset/247127

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

2 years ago[ews-build] Remove GTK and WPE queue from old EWS and dashboard
aakash_jain@apple.com [Thu, 4 Jul 2019 17:30:42 +0000 (17:30 +0000)]
[ews-build] Remove GTK and WPE queue from old EWS and dashboard
https://bugs.webkit.org/show_bug.cgi?id=199458

Reviewed by Michael Catanzaro.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueServer.js:
* QueueStatusServer/config/queues.py:

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

2 years agoSome layers inside overflow:scroll don't move back to correct positions when the...
simon.fraser@apple.com [Thu, 4 Jul 2019 14:53:40 +0000 (14:53 +0000)]
Some layers inside overflow:scroll don't move back to correct positions when the contents are shrunk
https://bugs.webkit.org/show_bug.cgi?id=199464
rdar://problem/52613285

Reviewed by Sam Weinig.
Source/WebCore:

When an overflow scroller's content shrink and it becomes non-scrollable, the 'boundsOrigin' in
the ancestor clipping stacks of related layers wouldn't get reset to zero, leaving layers in
the wrong place, so always set boundsOrigin to zero on the clipping layers of non-overflow entries
in the ancestor clipping stack.

Test: compositing/scrolling/async-overflow-scrolling/become-non-scrollable-with-child.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):

LayoutTests:

* compositing/scrolling/async-overflow-scrolling/become-non-scrollable-with-child-expected.html: Added.
* compositing/scrolling/async-overflow-scrolling/become-non-scrollable-with-child.html: Added.

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

2 years agoHyphenationLibHyphen: Include GLib-related headers only for PLATFORM(GTK)
annulen@yandex.ru [Thu, 4 Jul 2019 13:54:50 +0000 (13:54 +0000)]
HyphenationLibHyphen: Include GLib-related headers only for PLATFORM(GTK)
https://bugs.webkit.org/show_bug.cgi?id=199469

Reviewed by Michael Catanzaro.

Also added compile guard for a couple of functions used only in GTK port.

* platform/text/hyphen/HyphenationLibHyphen.cpp:

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

2 years ago[GTK] Fix browserperfdash script after r239522
clopez@igalia.com [Thu, 4 Jul 2019 13:53:30 +0000 (13:53 +0000)]
[GTK] Fix browserperfdash script after r239522
https://bugs.webkit.org/show_bug.cgi?id=199496

Reviewed by Michael Catanzaro.

* Scripts/webkitpy/browserperfdash/browserperfdash_runner.py:
(BrowserPerfDashRunner.run): Pass None for the new required BenchmarkRunner constructor.

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

2 years ago[webkitpy] test-webkitpy is broken on Linux since r246662
clopez@igalia.com [Thu, 4 Jul 2019 13:28:45 +0000 (13:28 +0000)]
[webkitpy] test-webkitpy is broken on Linux since r246662
https://bugs.webkit.org/show_bug.cgi?id=199493

Reviewed by Michael Catanzaro.

* Scripts/webkitpy/test/main.py:
(_supports_building_and_running_lldb_tests): Add a check for None before calling startswith().

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

2 years ago[GTK][WPE] Not longer needed to build woff2 on the JHBuild
clopez@igalia.com [Thu, 4 Jul 2019 10:52:34 +0000 (10:52 +0000)]
[GTK][WPE] Not longer needed to build woff2 on the JHBuild
https://bugs.webkit.org/show_bug.cgi?id=199406

Reviewed by Michael Catanzaro.

Install the Woff2 libraries and headers from the system package
and stop building them on the JHBuild.

* gtk/install-dependencies:
* gtk/jhbuild.modules:
* wpe/install-dependencies:
* wpe/jhbuild.modules:

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

2 years ago[GTK][WPE][CMake] The CMake cache should be clean when the JHBuild is rebuilt
clopez@igalia.com [Thu, 4 Jul 2019 10:50:58 +0000 (10:50 +0000)]
[GTK][WPE][CMake] The CMake cache should be clean when the JHBuild is rebuilt
https://bugs.webkit.org/show_bug.cgi?id=199449

Reviewed by Michael Catanzaro.

* Scripts/webkitdirs.pm:
(shouldRemoveCMakeCache): Clean the CMake cache if we detect that the JHBuild has been rebuilt.

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

2 years agoUpdate my status in contributors.json
clopez@igalia.com [Thu, 4 Jul 2019 10:41:34 +0000 (10:41 +0000)]
Update my status in contributors.json

Due to inactivity I lost my previous status as reviewer in r244705
but I still have svn access, so update my status temporally to
reflect the reality (checked with Alexey)

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

2 years agoUnreviewed, GTK a11y tests fix after r247071
carlosgc@webkit.org [Thu, 4 Jul 2019 07:30:17 +0000 (07:30 +0000)]
Unreviewed, GTK a11y tests fix after r247071

Patch by Philippe Normand <pnormand@igalia.com> on 2019-07-01

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::popupValue const):

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

2 years agoCrash in WebDragClient::startDrag because GraphicsContext is nullptr
rniwa@webkit.org [Thu, 4 Jul 2019 03:39:48 +0000 (03:39 +0000)]
Crash in WebDragClient::startDrag because GraphicsContext is nullptr
https://bugs.webkit.org/show_bug.cgi?id=199491

Reviewed by Wenson Hsieh.

Added a nullptr check.

Unfortunately no new tests since we don't have a reproducible test case.

* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):

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

2 years ago[MSE] Add more debug and error logging
eric.carlson@apple.com [Thu, 4 Jul 2019 03:23:39 +0000 (03:23 +0000)]
[MSE] Add more debug and error logging
https://bugs.webkit.org/show_bug.cgi?id=199473
<rdar://problem/52615882>

Reviewed by Jer Noble.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::provideMediaData): Log if we don't enqueue every buffer.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): Log if we return
without starting playback.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Log if
prerollDecodeWithCompletionHandler fails.

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

2 years agoData Detectors are not working for context menus in clients that use the legacy previ...
timothy_horton@apple.com [Thu, 4 Jul 2019 02:35:07 +0000 (02:35 +0000)]
Data Detectors are not working for context menus in clients that use the legacy preview API
https://bugs.webkit.org/show_bug.cgi?id=199486
<rdar://problem/52117322>

Reviewed by Dean Jackson.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView assignLegacyDataForContextMenuInteraction]):
The Data Detectors code in the legacy preview path is guarded by a
#define that did not survive upstreaming. Remove it.

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

2 years ago[ews-build] Enable WPE and GTK queues on new EWS
aakash_jain@apple.com [Thu, 4 Jul 2019 01:45:38 +0000 (01:45 +0000)]
[ews-build] Enable WPE and GTK queues on new EWS
https://bugs.webkit.org/show_bug.cgi?id=199234

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/config.json: Enabled the triggers for GTK and WPE builders.
* BuildSlaveSupport/ews-build/factories.py: Added required build steps for GTKFactory and WPEFactory.
* BuildSlaveSupport/ews-build/steps.py:
(CompileWebKit.evaluateCommand): Added InstallGtkDependencies/InstallWpeDependencies step before Compiling WebKit without patch.
* BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests.
* BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
(StatusBubble): Enable gtk and wpe status-bubbles.

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

2 years ago[WHLSL] Support float4x4 in test harness
justin_fan@apple.com [Thu, 4 Jul 2019 01:30:15 +0000 (01:30 +0000)]
[WHLSL] Support float4x4 in test harness
https://bugs.webkit.org/show_bug.cgi?id=199484

Reviewed by Myles C. Maxfield.

Support WHLSL float4x4 parameters in the WHLSL test harness.

* webgpu/js/whlsl-test-harness.js:
(isScalar):
(convertTypeToArrayType):
(convertTypeToWHLSLType):
(Data):
(makeFloat4):
(makeFloat4x4):
(processArrays):
(async.callFloat4x4Function):
(isVectorType): Deleted. Replaced with isScalar.

Add some float4x4 sanity checks:
* webgpu/whlsl-test-harness-test-expected.txt:
* webgpu/whlsl-test-harness-test.html:

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

2 years agoRELEASE_ASSERT in WebCore: WebCore::ScrollingStateTree::insertNode()
simon.fraser@apple.com [Thu, 4 Jul 2019 01:29:55 +0000 (01:29 +0000)]
RELEASE_ASSERT in WebCore: WebCore::ScrollingStateTree::insertNode()
https://bugs.webkit.org/show_bug.cgi?id=199479
rdar://problem/52392556

Reviewed by Zalan Bujtas.
Source/WebCore:

Certain compositing tree updates could leave a layer with a ScrollingProxy role, but having an
AncestorClippingStack with no overflow scrolling layers - for example, a related scroller could become
scrollable, but we failed to mark the layer with the ancestor clippings stack as needing a geometry update.

When this happened updateScrollingNodeForScrollingProxyRole() would return 0, causing the next child to be
inserted with a parent of 0 (which should only happen for the root), and triggering a release assert in
ScrollingStateTree::insertNode().

Fix by ensuring that updateScrollingNodeForScrollingProxyRole() always returns the existing parentNodeID if we
don't have a new node to insert.

Test: scrollingcoordinator/scrolling-tree/scrolling-proxy-with-no-scrolling-layer.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAncestorClippingStack):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole):

LayoutTests:

* scrollingcoordinator/scrolling-tree/scrolling-proxy-with-no-scrolling-layer-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/scrolling-proxy-with-no-scrolling-layer.html: Added.

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

2 years agoRenderLayerCompositor.cpp should include RenderImage.h
annulen@yandex.ru [Thu, 4 Jul 2019 01:18:09 +0000 (01:18 +0000)]
RenderLayerCompositor.cpp should include RenderImage.h
https://bugs.webkit.org/show_bug.cgi?id=199478

Reviewed by Michael Catanzaro.

* rendering/RenderLayerCompositor.cpp:

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

2 years ago[WHLSL] Remove the phase resolveCallsInFunctions
rmorisset@apple.com [Thu, 4 Jul 2019 01:15:38 +0000 (01:15 +0000)]
[WHLSL] Remove the phase resolveCallsInFunctions
https://bugs.webkit.org/show_bug.cgi?id=199474

Reviewed by Myles C. Maxfield.

This pass only stores into each property access and call expression vectors of all the functions it might be calling, for use by the Checker afterwards.
But the checker is perfectly able to compute a pointer to these vectors by itself.
So by removing this pass, we gain the following:
- One less pass over the AST
- No need to copy these vectors (which can be large for heavily overloaded functions, of which there are quite a few in the stdlib)
- No need to have these vectors in the expressions, saving 24 bytes per CallExpression and 72 bytes per PropertyAccessExpression
- No need to allocate and then destroy these vectors.

No new tests as there is no intended functional change.

* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
(WebCore::WHLSL::AST::CallExpression::castReturnType):
* Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
* Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
(WebCore::WHLSL::AutoInitialize::visit):
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveFunction):
(WebCore::WHLSL::Checker::finishVisiting):
(WebCore::WHLSL::Checker::visit):
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
(WebCore::WHLSL::NameResolver::NameResolver):
(WebCore::WHLSL::NameResolver::visit):
* Modules/webgpu/WHLSL/WHLSLNameResolver.h:
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
(WebCore::WHLSL::prepareShared):

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

2 years agoStorageManager::suspend() sometimes fails to call its completion handler
cdumez@apple.com [Thu, 4 Jul 2019 01:13:08 +0000 (01:13 +0000)]
StorageManager::suspend() sometimes fails to call its completion handler
https://bugs.webkit.org/show_bug.cgi?id=199482

Reviewed by Youenn Fablet.

Make sure the completion handler gets called in the early return cases.

* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::suspend):

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

2 years agoMake CacheStorage::Engine directory listing operations in a background thread
youenn@apple.com [Thu, 4 Jul 2019 01:10:27 +0000 (01:10 +0000)]
Make CacheStorage::Engine directory listing operations in a background thread
https://bugs.webkit.org/show_bug.cgi?id=199470

Reviewed by Chris Dumez.

Use the io work queue to get the list of directories.
Then go back to main thread and trigger clear/fetch operation as currently done.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::ReadOriginsTaskCounter::create):
(WebKit::CacheStorage::ReadOriginsTaskCounter::ReadOriginsTaskCounter):
(WebKit::CacheStorage::Engine::getDirectories):
(WebKit::CacheStorage::Engine::fetchEntries):
(WebKit::CacheStorage::Engine::fetchDirectoryEntries):
(WebKit::CacheStorage::Engine::clearCachesForOriginFromDisk):
(WebKit::CacheStorage::Engine::clearCachesForOriginFromDirectories):
* NetworkProcess/cache/CacheStorageEngine.h:

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

2 years ago[WHLSL] Make the destructor of VariableDeclaration non-virtual
rmorisset@apple.com [Thu, 4 Jul 2019 01:06:35 +0000 (01:06 +0000)]
[WHLSL] Make the destructor of VariableDeclaration non-virtual
https://bugs.webkit.org/show_bug.cgi?id=199460

Reviewed by Myles C. Maxfield.

Three steps:
- Remove WHLSL::AST::Value, inlining it into its children (it is trivial, it just has one field m_origin with a getter and nothing else)
- Mark WHLSL::AST::VariableDeclaration final
- Now that it inherits from nothing and nothing can inherit from it, there is no reason for it to have any virtual method, including its destructor.

This not only saves 8 bytes from every variable declaration (for the virtual table pointer), it also should make destructing the AST at the end of compilation a bit faster by removing the virtual destructor call.

No new tests as there is no intended functional change.

* Modules/webgpu/WHLSL/AST/WHLSLAST.h:
* Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
(WebCore::WHLSL::AST::Expression::Expression):
(WebCore::WHLSL::AST::Expression::origin const):
* Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
(WebCore::WHLSL::AST::Statement::Statement):
(WebCore::WHLSL::AST::Statement::origin const):
* Modules/webgpu/WHLSL/AST/WHLSLValue.h: Removed.
* Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
* Modules/webgpu/WHLSL/WHLSLParser.h:
* WebCore.xcodeproj/project.pbxproj:

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

2 years agoOnly allow fetching and removing session credentials from WebsiteDataStore
sihui_liu@apple.com [Thu, 4 Jul 2019 00:58:43 +0000 (00:58 +0000)]
Only allow fetching and removing session credentials from WebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=199385

Reviewed by Alex Christensen.

Source/WebCore:

Fetch and remove only session credentials from NSURLCredentialStorage.

Modified existing API tests: WKWebsiteDataStore.FetchPersistentCredentials

* platform/network/CredentialStorage.cpp:
(WebCore::CredentialStorage::originsWithCredentials const):
(WebCore::CredentialStorage::originsWithSessionCredentials):
(WebCore::CredentialStorage::removeSessionCredentialsWithOrigins):
(WebCore::CredentialStorage::clearSessionCredentials):
* platform/network/CredentialStorage.h:
* platform/network/mac/CredentialStorageMac.mm:
(WebCore::CredentialStorage::originsWithSessionCredentials):
(WebCore::CredentialStorage::removeSessionCredentialsWithOrigins):
(WebCore::CredentialStorage::clearSessionCredentials):
(WebCore::CredentialStorage::originsWithPersistentCredentials): Deleted.

Source/WebKit:

Stop sending an extra message to network process for fetching or removing persistent credentials.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
(WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
(WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
(WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::computeWebProcessAccessTypeForDataRemoval):
(WebKit::WebsiteDataStore::removeData):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):

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

2 years agoAdded a domain check for validation URLs in Apple Pay demo.
aakash_jain@apple.com [Thu, 4 Jul 2019 00:57:53 +0000 (00:57 +0000)]
Added a domain check for validation URLs in Apple Pay demo.
https://bugs.webkit.org/show_bug.cgi?id=199433

Patch by Jon Davis <jond@apple.com> on 2019-07-03
Reviewed by David Kilzer.

* demos/payment-request/merchant-validation.php:

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

2 years agoThe destructor of CSSAnimationControllerPrivate must explicitly clear the composite...
said@apple.com [Thu, 4 Jul 2019 00:49:01 +0000 (00:49 +0000)]
The destructor of CSSAnimationControllerPrivate must explicitly clear the composite animations
https://bugs.webkit.org/show_bug.cgi?id=199415

Reviewed by Simon Fraser.

After the destructor of CSSAnimationControllerPrivate exists, the non
static members are deleted. When the HashMap m_compositeAnimations is
deleted, its entries are deleted. The destructor of CompositeAnimation
calls the method CSSAnimationControllerPrivate::animationWillBeRemoved()
back through its back reference m_animationController. The non static
members of CSSAnimationControllerPrivate are being deleted and it is
incorrect to try to use any of these members after exiting the destructor.

We need to explicitly clear the composite animations before exiting the
destructor of CSSAnimationControllerPrivate.

* page/animation/CSSAnimationController.cpp:
(WebCore::CSSAnimationControllerPrivate::~CSSAnimationControllerPrivate):

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

2 years agoUI process exception when dragging an <attachment> with no content type
timothy_horton@apple.com [Thu, 4 Jul 2019 00:42:30 +0000 (00:42 +0000)]
UI process exception when dragging an <attachment> with no content type
https://bugs.webkit.org/show_bug.cgi?id=199480
<rdar://problem/44351353>

Reviewed by Wenson Hsieh.

Source/WebKit:

* UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
(API::Attachment::mimeType const):
(API::Attachment::utiType const):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::startDrag):
Make null or empty contentType fail the drag, instead of crashing.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(TestWebKitAPI::TEST):
Add a test; before the change, it crashes.

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

2 years agoClarify threading model for WebResourceLoadStatisticsStore::dumpResourceLoadStatistics()
cdumez@apple.com [Thu, 4 Jul 2019 00:23:25 +0000 (00:23 +0000)]
Clarify threading model for WebResourceLoadStatisticsStore::dumpResourceLoadStatistics()
https://bugs.webkit.org/show_bug.cgi?id=199468

Reviewed by Youenn Fablet.

Our convention is that the WebResourceLoadStatisticsStore is always created, used and
destroyed on the main thread, while the ResourceLoadStatisticsStore is always created,
used and destroyed on the background queue.

r245517 broke this convention by introducing a tryDumpResourceLoadStatistics() method
to WebResourceLoadStatisticsStore which gets called on the background queue. This patch
fixes this since this has been a huge source of thread-safety bugs in the past.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics):
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::removeDataRecords):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
(WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved const):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::dumpResourceLoadStatistics):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:

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

2 years agoHTMLMediaElement can hold onto display sleep assertion while process is suspended.
jer.noble@apple.com [Thu, 4 Jul 2019 00:08:00 +0000 (00:08 +0000)]
HTMLMediaElement can hold onto display sleep assertion while process is suspended.
https://bugs.webkit.org/show_bug.cgi?id=199471
<rdar://problem/52124320>

If the WebContent process is suspended before HTMLMediaElement gets a callback telling it
that the MediaPlayer has stopped playing, the SleepDisabler may stay set (and hold a display
or system sleep assertion) for the entire duration the process is suspended, causing excess
power drain.

Add a PlatformMediaSessionClient method (and an implementation in HTMLMediaElement) which will
be called during the preperation for process suspension, and in this callback, clear the
SleepDisabler token.

Reviewed by Eric Carlson.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldDisableSleep const):
(WebCore::HTMLMediaElement::processIsSuspendedChanged):
* html/HTMLMediaElement.h:
* platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSessionClient::processIsSuspendedChanged):
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::processWillSuspend):
(WebCore::PlatformMediaSessionManager::processDidResume):
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::processIsSuspended const):

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

2 years ago[Catalina] Enable WebKit build
jbedard@apple.com [Wed, 3 Jul 2019 23:26:03 +0000 (23:26 +0000)]
[Catalina] Enable WebKit build
https://bugs.webkit.org/show_bug.cgi?id=199209

Reviewed by Darin Adler.

Source/WebCore:

No new tests, Catalina test expectations will be migrated in the near future.

* WebCorePrefix.h: Exclude the header which declares SecTrustedApplicationCreateFromPath unavailable on Mac.
* crypto/mac/SerializedCryptoKeyWrapMac.mm: Ensure that we define SecTrustedApplicationCreateFromPath
before other headers declare it unavailable on Mac.

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h: Add new NSURLSessionConfiguration SPI.
* pal/spi/mac/AVFoundationSPI.h: resourceConservationLevelWhilePaused should
be defined after AVPlayerResourceConservationLevel.
* pal/spi/mac/NSViewSPI.h: Add subviewsIvar.

Source/WebKit:

* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: AppSSO is SPI.
* WebKit2Prefix.h: SecTask.h declares SecTaskGetCodeSignStatus(...) unavailable
on Mac, exclude this header.

Source/WebKitLegacy:

* mac/WebView/WebHTMLView.mm: Move NSView declaration to SPI header.
* mac/WebView/WebView.mm: Use _subviewsIvar instead of _subviews.

Source/WTF:

* wtf/spi/cocoa/SecuritySPI.h: Declare SecTrustedApplicationCreateFromPath(...).

Tools:

* TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig: Add Mac framework stubs.

WebKitLibraries:

* WebKitPrivateFrameworkStubs/Mac: Added.
* WebKitPrivateFrameworkStubs/Mac/101500: Added.
* WebKitPrivateFrameworkStubs/Mac/101500/AuthKit.framework: Added.
* WebKitPrivateFrameworkStubs/Mac/101500/AuthKit.framework/AuthKit.tbd: Added.

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

2 years agoREGRESSION (r246817): fast/events/ios/key-events-comprehensive/key-events-{control...
dbates@webkit.org [Wed, 3 Jul 2019 23:22:46 +0000 (23:22 +0000)]
REGRESSION (r246817): fast/events/ios/key-events-comprehensive/key-events-{control, control-shift}.html are failing
https://bugs.webkit.org/show_bug.cgi?id=199465
<rdar://problem/52613496>

Reviewed by Wenson Hsieh.

Don't advertise that WebKit can perform cursor movements when there isn't some kind of selection.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformAction:withSender:]):

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

2 years ago[WHLSL] Standard library is too big to directly include in WebCore
mmaxfield@apple.com [Wed, 3 Jul 2019 22:52:26 +0000 (22:52 +0000)]
[WHLSL] Standard library is too big to directly include in WebCore
https://bugs.webkit.org/show_bug.cgi?id=198186
<rdar://problem/51288898>

Reviewed by Saam Barati.

Source/WebCore:

This patch adds almost the entire remainder of the standard library. There are a few
pieces missing:
- step() because of https://bugs.webkit.org/show_bug.cgi?id=199289
- sign() also because of https://bugs.webkit.org/show_bug.cgi?id=199289
- faceforward() because it calls sign()
- Some of the more rarely-used texturing functions (e.g. Gather()) https://bugs.webkit.org/show_bug.cgi?id=195813
- RWTextures https://bugs.webkit.org/show_bug.cgi?id=198985

There were two problems with adding so many standard library functions:
- We didn't want to increase the WebCore binary size that much
- Compiling all the functions at runtime took 7 seconds, which is much too long

This patch addresses the first problem by gzipping the standard library before including it in the binary.
At runtime, we use libcompression to unzip it.

To address the second problem, we did some analysis and found that 14% of that 7 seconds was simply
destroying all the AST nodes. Even if we eliminated all processing of the AST, simply having the AST
of the entire standard library built and destroyed would still be too slow. Therefore, this patch limits
which parts of the standard library get parsed in the first place. All the functions in the standard library
file are sorted by name, and each group of functions with the same name are preceeded by a comment of the
form /* Functions named xyz */. At build time, a Python script looks for all these comments, and builds a
map from function name to character offset inside the file where those functions begin. At run time, we
parse the user program first, look for all function calls within it, and look up those function call names
in the map to see which part of the standard library holds those functions. We then parse just that part.
Because the standard library can call other functions in the standard library, we do this in a loop until
we have exhausted all the functions.

Covered by existing tests.

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make: gzip the standard library, and add a build step to generate the offset map.
* Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
(WebCore::WHLSL::AST::CallExpression::setOverloads):
(WebCore::WHLSL::AST::CallExpression::function): Every caller of this ASSERT()s the result. Might as well
move the ASSERT() into the function.
(WebCore::WHLSL::AST::CallExpression::setFunction):
* Modules/webgpu/WHLSL/Cocoa/WHLSLStandardLibraryUtilities.cpp: Added.
(WebCore::WHLSL::decompressStandardLibrary): Use libcompression. This is why this file is in a Cocoa/
subfolder, and is listed in SourcesCocoa.txt instead of Sources.txt.
(WebCore::WHLSL::decompressAndDecodeStandardLibrary):
(WebCore::WHLSL::NameFinder::takeFunctionNames):
(WebCore::WHLSL::includeStandardLibrary): Include only the bits of the standard library which are relevant,
as described above.
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: Only emit MSL code for functions which are actually
reached. The MSL compiler is a significant amount of our compile time, so reducing the size of the emitted
program can significantly improve compile times.
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
(WebCore::WHLSL::Metal::sharedMetalFunctions):
(WebCore::WHLSL::Metal::metalFunctions):
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
(WebCore::WHLSL::Metal::writeNativeFunction):
- Change how load() and store() are written. We need explicit functions because we have explicit atomic
  types, which HLSL doesn't have. load() and store() aren't present in HLSL.
- Delete f16tof32 because they're probably not important and are not obvious how to implement. We can re-add
  them again later if necessary.
- Various fixes to make us generate the correct MSL code for each standard library function.
* Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: Added. Build the function map as described
above.
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveByInstantiation): Previously, the standard library included an operator== for two
pointers. However, that function should be generated by the compiler instead. This fixes the bug in the
compiler which allows the compiler to correctly generate the right function. This also prompted me to file
https://bugs.webkit.org/show_bug.cgi?id=199335
(WebCore::WHLSL::checkOperatorOverload):
(WebCore::WHLSL::Checker::visit):
* Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Update to the new function() signature.
* Modules/webgpu/WHLSL/WHLSLLexer.h: Add a new position() method to the lexer. This isn't actually used
in this patch, but it's useful when doing some analysis during parsing.
(WebCore::WHLSL::Lexer::Lexer):
(WebCore::WHLSL::Lexer::consumeToken):
(WebCore::WHLSL::Lexer::peek const):
(WebCore::WHLSL::Lexer::peekFurther const):
(WebCore::WHLSL::Lexer::position const):
(WebCore::WHLSL::Lexer::state const):
(WebCore::WHLSL::Lexer::setState):
(WebCore::WHLSL::Lexer::isFullyConsumed const): Fixes a bug where isFullyConsumed() might return true even
when there is a token in the ring buffer.
(WebCore::WHLSL::Lexer::peek): Deleted.
(WebCore::WHLSL::Lexer::peekFurther): Deleted.
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
(WebCore::WHLSL::NameResolver::visit): Drive-by partial fix of https://bugs.webkit.org/show_bug.cgi?id=199347
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Call includeStandardLibrary().
(WebCore::WHLSL::prepareShared):
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
* Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
* Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
* Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:

LayoutTests:

The standard library doesn't include any matrix constructors that broadcast a single value
to every field in a matrix. https://bugs.webkit.org/show_bug.cgi?id=199333

* webgpu/whlsl-matrix.html:

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

2 years agoSkip the test added in r246810 as it requires the simulator to be preconfigured with...
dbates@webkit.org [Wed, 3 Jul 2019 22:42:28 +0000 (22:42 +0000)]
Skip the test added in r246810 as it requires the simulator to be preconfigured with a Pinyin keyboard
<rdar://problem/52608620>

We will remove this prerequisite in <https://bugs.webkit.org/show_bug.cgi?id=199472>.

* platform/ios/TestExpectations:

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

2 years agoException thrown from -[AVSampleBufferRenderSynchronizer addRenderer:], not a valid...
jer.noble@apple.com [Wed, 3 Jul 2019 22:16:47 +0000 (22:16 +0000)]
Exception thrown from -[AVSampleBufferRenderSynchronizer addRenderer:], not a valid renderer.
https://bugs.webkit.org/show_bug.cgi?id=199419
<rdar://problem/52141139>

Reviewed by Eric Carlson.

Sometimes, -[AVSampleBufferDisplayLayer init] will return nil. When that happens, passing a nil
pointer to -addRenderer: will throw an exception.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):

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