WebKit-https.git
14 months agoCSSValuePool should be non-copyable
antti@apple.com [Mon, 19 Apr 2021 17:08:31 +0000 (17:08 +0000)]
CSSValuePool should be non-copyable
https://bugs.webkit.org/show_bug.cgi?id=224764

Reviewed by Alan Bujtas.

* css/CSSValuePool.h:

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

14 months agoBuild fix for Debug -O3 after r276162.
mark.lam@apple.com [Mon, 19 Apr 2021 16:59:03 +0000 (16:59 +0000)]
Build fix for Debug -O3 after r276162.
https://bugs.webkit.org/show_bug.cgi?id=224681
rdar://76698113

Not reviewed.

* runtime/JSObject.cpp:

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

14 months agoUnreviewed, GLIB gardening
philn@webkit.org [Mon, 19 Apr 2021 16:53:53 +0000 (16:53 +0000)]
Unreviewed, GLIB gardening

* platform/glib/TestExpectations: Flag a few more media tests to skip or as flaky crash.

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

14 months agoAdd more GPUProcess release logging to facilitate debugging
cdumez@apple.com [Mon, 19 Apr 2021 16:46:44 +0000 (16:46 +0000)]
Add more GPUProcess release logging to facilitate debugging
https://bugs.webkit.org/show_bug.cgi?id=224761

Reviewed by Darin Adler.

* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::GPUProcess):
(WebKit::GPUProcess::createGPUConnectionToWebProcess):
(WebKit::GPUProcess::removeGPUConnectionToWebProcess):
(WebKit::GPUProcess::initializeGPUProcess):

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

14 months agoUnreviewed, GLIB gardening
philn@webkit.org [Mon, 19 Apr 2021 16:45:58 +0000 (16:45 +0000)]
Unreviewed, GLIB gardening

* platform/glib/TestExpectations: Flag imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-implicit.html as flaky crash.

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

14 months ago[LFC] The layout containment box establishes an absolute positioning containing block...
zalan@apple.com [Mon, 19 Apr 2021 15:41:44 +0000 (15:41 +0000)]
[LFC] The layout containment box establishes an absolute positioning containing block and a fixed positioning containing block
https://bugs.webkit.org/show_bug.cgi?id=224754

Reviewed by Antti Koivisto.

https://www.w3.org/TR/css-contain-2/#containment-layout.

"The layout containment box establishes an absolute positioning containing block and a fixed positioning containing block."

* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isContainingBlockForFixedPosition const):
(WebCore::Layout::Box::isContainingBlockForOutOfFlowPosition const):

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

14 months ago[LFC] Layout containment box establishes an independent formatting context
zalan@apple.com [Mon, 19 Apr 2021 15:21:58 +0000 (15:21 +0000)]
[LFC] Layout containment box establishes an independent formatting context
https://bugs.webkit.org/show_bug.cgi?id=224753

Reviewed by Antti Koivisto.

https://www.w3.org/TR/css-contain-2/#containment-layout.

"The layout containment box establishes an independent formatting context."

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::establishesIndependentFormattingContext const):

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

14 months agoSilence various -Wreturn-type warnings
commit-queue@webkit.org [Mon, 19 Apr 2021 15:18:33 +0000 (15:18 +0000)]
Silence various -Wreturn-type warnings
https://bugs.webkit.org/show_bug.cgi?id=224756

Patch by Michael Catanzaro <mcatanzaro@gnome.org> on 2021-04-19
Reviewed by Don Olmstead.

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::mixColorComponents):
* inspector/InspectorOverlay.cpp:
(WebCore::expectedSizeForLayoutLabel):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::usedClear):
(WebCore::RenderStyle::usedFloat):

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

14 months agoUnreviewed, fix the build after r276181
wenson_hsieh@apple.com [Mon, 19 Apr 2021 14:16:05 +0000 (14:16 +0000)]
Unreviewed, fix the build after r276181
<rdar://problem/76832595>

Add a couple of missing forward declarations for `IntRect` and `IntPoint`.

* page/ContextMenuClient.h:

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

14 months agoAdd assertions to check for no memory allocation in AudioMediaStreamTrackRendererUnit...
youenn@apple.com [Mon, 19 Apr 2021 13:54:15 +0000 (13:54 +0000)]
Add assertions to check for no memory allocation in AudioMediaStreamTrackRendererUnit rendering thread
https://bugs.webkit.org/show_bug.cgi?id=224674

Reviewed by Eric Carlson.

Add ForbidMallocUseForCurrentThreadScope in audio rendering code path to prevent memory allocation.
Rename inputProc to renderingCallback.
Remove use of AudioMediaStreamTrackRendererUnit::singleton and instead use the pointer given to renderingCallback.
This is safe as AudioMediaStreamTrackRendererUnit destructor stops the audio unit.

* platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp:
(WebCore::AudioMediaStreamTrackRendererUnit::createAudioUnitIfNeeded):
(WebCore::AudioMediaStreamTrackRendererUnit::render):
(WebCore::AudioMediaStreamTrackRendererUnit::renderingCallback):
(WebCore::AudioMediaStreamTrackRendererUnit::inputProc): Deleted.
* platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h:

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

14 months agoUnreviewed, WPE Minibrowser build warning fix.
philn@webkit.org [Mon, 19 Apr 2021 13:43:09 +0000 (13:43 +0000)]
Unreviewed, WPE Minibrowser build warning fix.

* MiniBrowser/wpe/main.cpp: No need to use typedef for this struct declaration.

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

14 months ago[LFC] Implement Box::isLayoutContainmentBox
zalan@apple.com [Mon, 19 Apr 2021 13:28:40 +0000 (13:28 +0000)]
[LFC] Implement Box::isLayoutContainmentBox
https://bugs.webkit.org/show_bug.cgi?id=224740

Reviewed by Antti Koivisto.

This is part of https://www.w3.org/TR/css-contain-2/#containment-layout

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isLayoutContainmentBox const):
(WebCore::Layout::Box::isInternalTableBox const):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isInternalRubyBox const):

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

14 months agoUnreviewed, WPE gardening
philn@webkit.org [Mon, 19 Apr 2021 13:22:54 +0000 (13:22 +0000)]
Unreviewed, WPE gardening

Share more media tests baselines between the GTK and WPE ports.

* platform/glib/TestExpectations:
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-implicit-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-implicit-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-negative-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-negative-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-without-codecs-parameter-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-changetype-play-without-codecs-parameter-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-getvideoplaybackquality-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-getvideoplaybackquality-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-remove-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-remove-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-removesourcebuffer-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-removesourcebuffer-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt: Renamed from LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt.
* platform/glib/media/W3C/video/canPlayType/canPlayType_codecs_order_1-expected.txt: Renamed from LayoutTests/platform/gtk/media/W3C/video/canPlayType/canPlayType_codecs_order_1-expected.txt.
* platform/glib/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_1-expected.txt: Renamed from LayoutTests/platform/gtk/media/W3C/video/canPlayType/canPlayType_supported_but_no_codecs_parameter_1-expected.txt.
* platform/glib/media/W3C/video/canPlayType/canPlayType_two_implies_one_1-expected.txt: Renamed from LayoutTests/platform/gtk/media/W3C/video/canPlayType/canPlayType_two_implies_one_1-expected.txt.
* platform/glib/media/W3C/video/canPlayType/canPlayType_two_implies_one_2-expected.txt: Renamed from LayoutTests/platform/gtk/media/W3C/video/canPlayType/canPlayType_two_implies_one_2-expected.txt.
* platform/glib/media/audio-controls-rendering-expected.png: Renamed from LayoutTests/platform/gtk/media/audio-controls-rendering-expected.png.
* platform/glib/media/audio-repaint-expected.png: Renamed from LayoutTests/platform/gtk/media/audio-repaint-expected.png.
* platform/glib/media/context-menu-actions-expected.txt: Renamed from LayoutTests/platform/gtk/media/context-menu-actions-expected.txt.
* platform/glib/media/controls-after-reload-expected.png: Renamed from LayoutTests/platform/gtk/media/controls-after-reload-expected.png.
* platform/glib/media/controls-layout-direction-expected.png: Renamed from LayoutTests/platform/gtk/media/controls-layout-direction-expected.png.
* platform/glib/media/controls-strict-expected.png: Renamed from LayoutTests/platform/gtk/media/controls-strict-expected.png.
* platform/glib/media/controls-styling-expected.png: Renamed from LayoutTests/platform/gtk/media/controls-styling-expected.png.
* platform/glib/media/controls-styling-strict-expected.png: Renamed from LayoutTests/platform/gtk/media/controls-styling-strict-expected.png.
* platform/glib/media/controls-without-preload-expected.png: Renamed from LayoutTests/platform/gtk/media/controls-without-preload-expected.png.
* platform/glib/media/media-can-play-ogg-expected.txt: Renamed from LayoutTests/platform/gtk/media/media-can-play-ogg-expected.txt.
* platform/glib/media/media-controls-clone-expected.png: Renamed from LayoutTests/platform/gtk/media/media-controls-clone-expected.png.
* platform/glib/media/media-document-audio-repaint-expected.png: Renamed from LayoutTests/platform/gtk/media/media-document-audio-repaint-expected.png.
* platform/glib/media/media-fullscreen-inline-expected.txt: Renamed from LayoutTests/platform/gtk/media/media-fullscreen-inline-expected.txt.
* platform/glib/media/media-fullscreen-not-in-document-expected.txt: Renamed from LayoutTests/platform/gtk/media/media-fullscreen-not-in-document-expected.txt.
* platform/glib/media/media-source/media-source-resize-expected.txt: Renamed from LayoutTests/platform/gtk/media/media-source/media-source-resize-expected.txt.
* platform/glib/media/video-canvas-alpha-expected.png: Renamed from LayoutTests/platform/gtk/media/video-canvas-alpha-expected.png.
* platform/glib/media/video-controls-rendering-expected.png: Renamed from LayoutTests/platform/gtk/media/video-controls-rendering-expected.png.
* platform/glib/media/video-display-toggle-expected.png: Renamed from LayoutTests/platform/gtk/media/video-display-toggle-expected.png.
* platform/glib/media/video-empty-source-expected.png: Renamed from LayoutTests/platform/gtk/media/video-empty-source-expected.png.
* platform/glib/media/video-no-audio-expected.png: Renamed from LayoutTests/platform/gtk/media/video-no-audio-expected.png.
* platform/glib/media/video-playing-and-pause-expected.png: Renamed from LayoutTests/platform/gtk/media/video-playing-and-pause-expected.png.
* platform/glib/media/video-playing-and-pause-expected.txt: Renamed from LayoutTests/platform/gtk/media/video-playing-and-pause-expected.txt.
* platform/glib/media/video-volume-slider-expected.png: Renamed from LayoutTests/platform/gtk/media/video-volume-slider-expected.png.
* platform/glib/media/video-zoom-controls-expected.png: Renamed from LayoutTests/platform/gtk/media/video-zoom-controls-expected.png.
* platform/glib/media/video-zoom-expected.png: Renamed from LayoutTests/platform/gtk/media/video-zoom-expected.png.
* platform/glib/media/video-zoom-expected.txt: Renamed from LayoutTests/platform/gtk/media/video-zoom-expected.txt.
* platform/gtk/TestExpectations:
* platform/wpe/TestExpectations:
* platform/wpe/media/video-aspect-ratio-expected.txt: Added.
* platform/wpe/media/video-canvas-createPattern-expected.png: Added.
* platform/wpe/media/video-colorspace-yuv420-expected.png: Added.
* platform/wpe/media/video-colorspace-yuv420-expected.txt: Added.
* platform/wpe/media/video-colorspace-yuv422-expected.png: Added.
* platform/wpe/media/video-colorspace-yuv422-expected.txt: Added.
* platform/wpe/media/video-frame-accurate-seek-expected.png: Added.
* platform/wpe/media/video-frame-accurate-seek-expected.txt: Added.
* platform/wpe/media/video-layer-crash-expected.txt: Added.
* platform/wpe/media/video-transformed-expected.txt: Added.

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

14 months agoEnable -Wthread-safety, add attributes to custom lock classes, and provide macros...
commit-queue@webkit.org [Mon, 19 Apr 2021 13:12:23 +0000 (13:12 +0000)]
Enable -Wthread-safety, add attributes to custom lock classes, and provide macros to declare guards
https://bugs.webkit.org/show_bug.cgi?id=221614
<rdar://problem/74396781>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-04-19
Reviewed by David Kilzer.

PerformanceTests:

Add -Wthread-safety to compile flags.

* DecoderTest/Configurations/Base.xcconfig:

Source/bmalloc:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/JavaScriptCore:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/WebCore:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/WebCore/PAL:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/WebInspectorUI:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/WebKit:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/WebKitLegacy/mac:

Add -Wthread-safety to compile flags.

* Configurations/Base.xcconfig:

Source/WTF:

Implement rudimentary support for clang thread safety analysis.
The added macros can be used to declare which member variables or
global variables are locked by which mutexes. The compiler will
check statically that the mutexes are held correctly. The checking
is intra procedural, not global.

* Configurations/Base.xcconfig:
    Add -Wthread-safety to compile flags.

* wtf/CheckedLock.h: Added.
Add CheckedLock, a Lock variant that is amenable to static
analysis.
Add a Locker specialization for CheckedLock that is amenable to
static analysis.

Locker<CheckedLock> is a std::scoped_lock. The scoped_lock cannot be aliased,
since it appears that (Apple's) libcxx is not compiled with thread safety
analysis support enabled by default.

New types are needed due Locker move constructor and conditional locking.
The Locker has default usage pattern of:
  auto locker = holdLock(m_lock);
This forces dynamism that removes the possibility of simple statical
analysis that thread safety analysis capabilities "mutex" and "scoped_lock"
currently implement. Most likely large fraction of call sites is due to historical
lack of CTAD and as such can be converted to less general form.
Once the pattern is not used by default, CheckedLock can be deleted
and the move dynamism bits of Locker can be moved to some more specific type
("UncheckedLocker").

* wtf/ThreadSafetyAnalysis.h: Added.
Add macro wrappers around clang "mutex" and "scoped_lock" capability attributes.

Tools:

* TestWebKitAPI/Configurations/Base.xcconfig:
Add -Wthread-safety to compile flags.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/CheckedLock.cpp: Added.
(TestWebKitAPI::TEST):
Implement a test for testing that CheckedLock compiles.

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

14 months ago[GTK] Switch to libsoup3 by default
carlosgc@webkit.org [Mon, 19 Apr 2021 11:55:43 +0000 (11:55 +0000)]
[GTK] Switch to libsoup3 by default
https://bugs.webkit.org/show_bug.cgi?id=224741

Reviewed by Sergio Villar Senin.

* Source/cmake/OptionsGTK.cmake:

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

14 months agoMake RealtimeIncomingAudioSourceCocoa preallocate audio buffer
youenn@apple.com [Mon, 19 Apr 2021 10:28:56 +0000 (10:28 +0000)]
Make RealtimeIncomingAudioSourceCocoa preallocate audio buffer
https://bugs.webkit.org/show_bug.cgi?id=224672

Reviewed by Eric Carlson.

Instead of allocating the buffer on valid data, we wait for data to be of the correct sample rate.
We preallocate the buffer accordingly in constructor to avoid allocation in the webrtc audio thread.
Default is 1 channel since mono is what webrtc encoders mostly do these days.
Covered by existing tests.

* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::RealtimeIncomingAudioSourceCocoa):
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):

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

14 months agoMove from RecursiveLock to Lock in RealtimeMediaSource
youenn@apple.com [Mon, 19 Apr 2021 09:56:09 +0000 (09:56 +0000)]
Move from RecursiveLock to Lock in RealtimeMediaSource
https://bugs.webkit.org/show_bug.cgi?id=224671

Reviewed by Eric Carlson.

RecursiveLock is more expensive as it allocates memory and not useful here.
Covered by existing tests.

* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeOutgoingAudioSource.h:
* platform/mediastream/RealtimeOutgoingVideoSource.h:

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

14 months agoReduce crackling at start of playing a live audio track
youenn@apple.com [Mon, 19 Apr 2021 09:53:37 +0000 (09:53 +0000)]
Reduce crackling at start of playing a live audio track
https://bugs.webkit.org/show_bug.cgi?id=218898
<rdar://problem/71625010>

Reviewed by Eric Carlson.

We often hear crackles at the beginning of playing a MediaStreamTrack.
This is due to starting at a point where there is not enough data, so we start rendering and quickly run short of data.
Our heuristic to start was not good since we were not accounting to LibWebRTC audio module which sends audio samples by batch of 5 samples.
So we would have needed to at least have 6 samples to be sure to not run out of data.

What this patch does:
- Add an extra parameter to AudioSampleDataSource so that we do not start until we have at least been pushed a given number of sample count.
- Change LibWebRTAudioModule to send audio samples by batch of 3 (hence 30 ms) instead of 5
- Set this new parameter to 2 for local tracks and 4 for remote tracks
- Add a new boolean to AudioSampleDataSource to know whether we start the track for the first time or not. If we start it, use the new parameter to buffer enough data.
  Otherwise, use current heuristic.

We also reduce the AudioSampleDataSource buffer to 0.5 seconds instead of 2 seconds, since 2 seconds is too much for real time audio.

Manually tested.

* platform/audio/cocoa/AudioSampleDataSource.h:
* platform/audio/cocoa/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::create):
(WebCore::AudioSampleDataSource::AudioSampleDataSource):
(WebCore::AudioSampleDataSource::pullSamplesInternal):
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
(WebCore::LibWebRTCAudioModule::pollFromSource):
* platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
* platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp:
(WebCore::pollSamplesCount):
(WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples):
* platform/mediastream/mac/MediaStreamTrackAudioSourceProviderCocoa.cpp:
(WebCore::MediaStreamTrackAudioSourceProviderCocoa::MediaStreamTrackAudioSourceProviderCocoa):
* platform/mediastream/mac/WebAudioSourceProviderCocoa.h:
* platform/mediastream/mac/WebAudioSourceProviderCocoa.mm:
(WebCore::WebAudioSourceProviderCocoa::prepare):

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

14 months agoMigrate some WebRTC encoded transform tests to WPT
youenn@apple.com [Mon, 19 Apr 2021 09:49:20 +0000 (09:49 +0000)]
Migrate some WebRTC encoded transform tests to WPT
https://bugs.webkit.org/show_bug.cgi?id=224604

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc-encoded-transform/routines.js: Added.
(async createConnections):
(waitFor):
* web-platform-tests/webrtc-encoded-transform/script-audio-transform-worker.js: Added.
(MockRTCRtpTransformer):
(MockRTCRtpTransformer.prototype.start):
(MockRTCRtpTransformer.prototype.process):
(onrtctransform):
* web-platform-tests/webrtc-encoded-transform/script-audio-transform.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/script-audio-transform.https.html: Renamed from LayoutTests/http/wpt/webrtc/audio-script-transform.html.
* web-platform-tests/webrtc-encoded-transform/script-change-transform-worker.js: Renamed from LayoutTests/http/wpt/webrtc/change-encoded-transform.js.
* web-platform-tests/webrtc-encoded-transform/script-change-transform.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/script-change-transform.https.html: Renamed from LayoutTests/http/wpt/webrtc/change-encoded-transform.html.
* web-platform-tests/webrtc-encoded-transform/script-late-transform.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/script-late-transform.https.html: Renamed from LayoutTests/http/wpt/webrtc/webrtc-late-transform.html.
* web-platform-tests/webrtc-encoded-transform/script-metadata-transform-worker.js: Renamed from LayoutTests/http/wpt/webrtc/metadata-transform-worker.js.
* web-platform-tests/webrtc-encoded-transform/script-metadata-transform.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/script-metadata-transform.https.html: Renamed from LayoutTests/http/wpt/webrtc/metadata-transform.html.
* web-platform-tests/webrtc-encoded-transform/script-transform-worker.js: Renamed from LayoutTests/http/wpt/webrtc/script-transform.js.
* web-platform-tests/webrtc-encoded-transform/script-transform.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/script-transform.https.html: Renamed from LayoutTests/http/wpt/webrtc/webrtc-transform.html.
* web-platform-tests/webrtc-encoded-transform/script-write-twice-transform-worker.js: Renamed from LayoutTests/http/wpt/webrtc/write-twice-transform.js.
* web-platform-tests/webrtc-encoded-transform/script-write-twice-transform.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/script-write-twice-transform.https.html: Renamed from LayoutTests/http/wpt/webrtc/write-twice-transform.html.
* web-platform-tests/webrtc-encoded-transform/sframe-keys.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-keys.https.html: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-buffer-source-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-buffer-source.html: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-in-worker.https-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-in-worker.https.html: Renamed from LayoutTests/http/wpt/webrtc/sframe-transform-in-worker.html.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-readable-expected.txt: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-readable.html: Added.
* web-platform-tests/webrtc-encoded-transform/sframe-transform-worker.js: Renamed from LayoutTests/http/wpt/webrtc/sframe-transform.js.
* web-platform-tests/webrtc-encoded-transform/sframe-transform.html: Renamed from LayoutTests/http/wpt/webrtc/sframe-transform.html.

LayoutTests:

* http/wpt/webrtc/sframe-transform-readable-crash.html: Removed.
* platform/glib/TestExpectations:
* platform/ios-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:
* webrtc/script-transform.js: Removed.

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

14 months agoEnable GL_ANGLE_instanced_arrays WebGL extension in WPE
ifernandez@igalia.com [Mon, 19 Apr 2021 09:03:52 +0000 (09:03 +0000)]
Enable GL_ANGLE_instanced_arrays WebGL extension in WPE
https://bugs.webkit.org/show_bug.cgi?id=224438

Reviewed by Darin Adler.

Tested by WebGL WPT.

* html/canvas/ANGLEInstancedArrays.cpp:
(WebCore::ANGLEInstancedArrays::supported):
* platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
(WebCore::ExtensionsGLOpenGLES::supportsExtension):

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

14 months ago[css-flexbox] Table layout disregards overriding height
commit-queue@webkit.org [Mon, 19 Apr 2021 08:39:04 +0000 (08:39 +0000)]
[css-flexbox] Table layout disregards overriding height
https://bugs.webkit.org/show_bug.cgi?id=224665

Patch by Felipe Erias <felipeerias@igalia.com> on 2021-04-19
Reviewed by Sergio Villar Senin.

Source/WebCore:

Update table layout to take into account the overriding height set by the element's parent.
This was causing several WPT tests to fail.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
During layout, set the computed height so that it is at least as large as the overriding height
provided by the element's parent (if any) minus the height that will be taken up by captions.
This additional height will be distributed among the table's sections so its total height matches
the overriding value.

LayoutTests:

* TestExpectations: Removed four WPT tests that now pass.

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

14 months ago[css-scroll-snap] Properly support fractional scroll steps in WebCore::ScrollAnimator...
mrobinson@webkit.org [Mon, 19 Apr 2021 08:23:34 +0000 (08:23 +0000)]
[css-scroll-snap] Properly support fractional scroll steps in WebCore::ScrollAnimator::scroll
https://bugs.webkit.org/show_bug.cgi?id=224176

Reviewed by Simon Fraser.

Stop using the ScrollableArea's position to calculate scroll snap positions in ScrollAnimator::snap.
The position stored in ScrollAnimator is a floating point position, while the one stored in ScrollableArea
is an integer position. This currently isn't an issue, because all callers of ScrollAnimator::scroll
use integer scroll offsets, but this will allow this function to be used in the future for precise
scrolling delta.

No new tests. This doesn't change any behavior, since all callers currently use
integer scroll offsets, but a future change will make use of this fix.

* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scroll): Get the current scroll position from the ScrollAnimator,
which stores it in floating point. Also, only call into the scroll snap code if we actually
have scroll offsets.
(WebCore::ScrollAnimator::offsetFromPosition): Added this helper.
(WebCore::ScrollAnimator::positionFromOffset): Ditto.
(WebCore::ScrollAnimator::deltaFromStep): Return a delta instead of a position so this helper
can be used with offsets or positions.
(WebCore::ScrollAnimator::positionFromStep): Deleted.
* platform/ScrollAnimator.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::scroll): Use the new helper.j

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

14 months ago[WPE][GTK] Enable AVIF decoder as experimental feature and unskip tests
philn@webkit.org [Mon, 19 Apr 2021 08:16:42 +0000 (08:16 +0000)]
[WPE][GTK] Enable AVIF decoder as experimental feature and unskip tests
https://bugs.webkit.org/show_bug.cgi?id=224663

Reviewed by Xabier Rodriguez-Calvar.

.:

Make the USE_AVIF option public and enable it as experimental feature.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebCore:

Refactor the AVIF build options out of the GTK port so they can be reused by other CMake ports.

* PlatformGTK.cmake:
* platform/ImageDecoders.cmake:
* platform/image-decoders/avif/AVIFImageDecoder.cpp:
* platform/image-decoders/avif/AVIFImageReader.cpp:
* platform/image-decoders/avif/AVIFUniquePtr.h:

LayoutTests:

* platform/gtk/TestExpectations: Unskip avif tests.

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

14 months ago[selectors] Update :focus-visible tests from WPT
rego@igalia.com [Mon, 19 Apr 2021 06:57:16 +0000 (06:57 +0000)]
[selectors] Update :focus-visible tests from WPT
https://bugs.webkit.org/show_bug.cgi?id=224601
<rdar://problem/76827947>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Fix expectations that were broken due to a mistake in the previous commit.
The tests had some extra changes due to webkit.org/224658, the tests were modified but not the expectations.

* web-platform-tests/css/selectors/focus-visible-002-expected.txt:
* web-platform-tests/css/selectors/focus-visible-003-expected.txt:
* web-platform-tests/css/selectors/focus-visible-004-expected.txt:

LayoutTests:

Remove glib expectations as they match the main ones.

* platform/glib/imported/w3c/web-platform-tests/css/selectors/focus-visible-002-expected.txt: Removed.
* platform/glib/imported/w3c/web-platform-tests/css/selectors/focus-visible-003-expected.txt: Removed.
* platform/glib/imported/w3c/web-platform-tests/css/selectors/focus-visible-004-expected.txt: Removed.

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

14 months agoSelected image overlay text should never be visible
wenson_hsieh@apple.com [Mon, 19 Apr 2021 06:32:12 +0000 (06:32 +0000)]
Selected image overlay text should never be visible
https://bugs.webkit.org/show_bug.cgi?id=224734
<rdar://problem/76806399>

Reviewed by Darin Adler.

Source/WebCore:

Make a slight adjustment to the UA stylesheet to ensure that image overlay text is never visible. See below for
more details.

Test: fast/images/image-extraction/image-overlay-with-selection-styles.html

* html/shadow/imageOverlay.css:
(div.image-overlay-text::selection):

Enforce selected text styles for image overlay text.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionPseudoStyle const):

Make an additional adjustment when computing selection pseudo styles for UA shadow root content. Currently, for
elements inside a UA shadow root, we always immediately ascend to the shadow host; this means that `::selection`
pseudo selectors currently don't work in UA stylesheets, since they're skipped when resolving styles, upon
painting selected text.

To fix this, we can let the element's own pseudo styles take precedence over the shadow host's renderer in the
case where we have a selection pseudo style. While we're here, also replace a few raw pointers with `RefPtr`.

LayoutTests:

Add a new layout test.

* fast/images/image-extraction/image-overlay-with-selection-styles-expected.html: Added.
* fast/images/image-extraction/image-overlay-with-selection-styles.html: Added.

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

14 months agoSupport contain: layout
commit-queue@webkit.org [Mon, 19 Apr 2021 06:13:38 +0000 (06:13 +0000)]
Support contain: layout
https://bugs.webkit.org/show_bug.cgi?id=223569

Patch by Rob Buis <rbuis@igalia.com> on 2021-04-18
Reviewed by Darin Adler.

Source/WebCore:

This patch implements layout containment as specified[1].
It adds shouldApplyLayoutContainment to check whether the
element applies for layout containment. Is so, then:
- an independent formatting context is established.
- any overflow is treated as ink overflow.
- an absolute positioning and fixed positioning
containing block is established.
- a stacking context is created.
- for baseline handling, the box is treated as having no
baseline. For grid/flexible box containers/items, this needs
a baseline synthesized from the border edges [2], for buttons it
requires a baseline synthesized from the margin edges [2, 3].

[1] https://drafts.csswg.org/css-contain-2/#layout-containment
[2] https://drafts.csswg.org/css-align-3/#synthesize-baseline
[3] https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::firstLineBaseline const):
(WebCore::RenderBlock::inlineBlockBaseline const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::createsNewFormattingContext const):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* rendering/RenderBox.h:
* rendering/RenderButton.cpp:
(WebCore::RenderButton::baselinePosition const):
* rendering/RenderElement.h:
(WebCore::RenderElement::canContainFixedPositionObjects const):
(WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::firstLineBaseline const):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::firstLineBaseline const):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::baselinePosition const):
* rendering/RenderObject.cpp:
(WebCore::objectIsRelayoutBoundary):
(WebCore::shouldApplyLayoutContainment):
* rendering/RenderObject.h:
(WebCore::RenderObject::isAtomicInlineLevelBox const):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::firstLineBaseline const):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::containsLayout const):
* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):

LayoutTests:

Unskip tests that pass now.

* TestExpectations:

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

14 months ago[GLIB] Unreviewed test gardening. Marked css-transforms/animation/rotate-composition...
dpino@igalia.com [Mon, 19 Apr 2021 02:43:33 +0000 (02:43 +0000)]
[GLIB] Unreviewed test gardening. Marked css-transforms/animation/rotate-composition.html as failure after r276231.

* platform/glib/TestExpectations:

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

14 months ago[WinCairo] Unreviewed test gardening
Hironori.Fujii@sony.com [Mon, 19 Apr 2021 01:56:23 +0000 (01:56 +0000)]
[WinCairo] Unreviewed test gardening

* platform/wincairo-wk1/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt: Added.
* platform/wincairo-wk1/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Added.
* platform/wincairo/TestExpectations:

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

14 months agoGraphicsLayer::distributeOpacity, GraphicsLayer::setOpacityInternal and GraphicsLayer...
weinig@apple.com [Sun, 18 Apr 2021 21:14:38 +0000 (21:14 +0000)]
GraphicsLayer::distributeOpacity, GraphicsLayer::setOpacityInternal and GraphicsLayer::accumulatedOpacity are never used
https://bugs.webkit.org/show_bug.cgi?id=224732

Reviewed by Darin Adler.

Remove dead code.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::accumulatedOpacity const): Deleted.
(WebCore::GraphicsLayer::distributeOpacity): Deleted.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setOpacityInternal): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
* platform/graphics/ca/GraphicsLayerCA.h:

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

14 months agoFix interpolation of the rotate CSS property
graouts@webkit.org [Sun, 18 Apr 2021 18:12:23 +0000 (18:12 +0000)]
Fix interpolation of the rotate CSS property
https://bugs.webkit.org/show_bug.cgi?id=224730

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark 123 WPT progressions.

* web-platform-tests/css/css-transforms/animation/rotate-composition-expected.txt:
* web-platform-tests/css/css-transforms/animation/rotate-interpolation-expected.txt:
* web-platform-tests/css/css-transforms/animation/transform-interpolation-001-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:

Source/WebCore:

Implement the CSS Transforms spec about animating the rotateZ() function
for the simplified case where only the angle is interpolated.

* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::blend):

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

14 months agoBlob URLs should use for their owner origin for CSP checks
youenn@apple.com [Sun, 18 Apr 2021 16:42:06 +0000 (16:42 +0000)]
Blob URLs should use for their owner origin for CSP checks
https://bugs.webkit.org/show_bug.cgi?id=224535
<rdar://76458106>

Reviewed by Alex Christensen.

Source/WebCore:

Before the patch, we were checking blob origin directly with ancestors.
As per https://w3c.github.io/webappsec-csp/#match-url-to-source-expression step 4.1,
we need to get the URL origin, which by spec is the origin of the blob creator.
We only do this for navigation loads as script loads should be kept the current way, as a cross-site scripting protection,
and to remain compatible with other browsers.

Make some refactoring to add helper routines to get origin and secure context state of blob URLs in BlobURL.
Make use of it in MixedContentChecker as a refactoring.
Make use of the helper routine in ContentSecurityPolicySource::matches to fix the bug.

Test: http/tests/security/frame-src-and-blob-download.https.html

* fileapi/BlobURL.cpp:
(WebCore::blobOwner):
(WebCore::BlobURL::getOriginURL):
(WebCore::BlobURL::isSecureBlobURL):
* fileapi/BlobURL.h:
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::isBlobURLContainsNullOrigin):
* loader/MixedContentChecker.cpp:
(WebCore::MixedContentChecker::isMixedContent):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::isSecure):
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::urlMatchesSelf const):
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::matches const):

LayoutTests:

* http/tests/security/frame-src-and-blob-download.https-expected.txt: Added.
* http/tests/security/frame-src-and-blob-download.https.html:
* http/tests/security/resources/frame-src-and-blob-download-frame.html: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

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

14 months agoUpdate name in contributors.json
zalan@apple.com [Sun, 18 Apr 2021 13:40:37 +0000 (13:40 +0000)]
Update name in contributors.json
https://bugs.webkit.org/show_bug.cgi?id=224731

Unreviewed.

* Scripts/webkitpy/common/config/contributors.json:

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

14 months agoThe implicit aspect-ratio from width and height attributes with float value is not...
cathiechen@igalia.com [Sun, 18 Apr 2021 12:45:33 +0000 (12:45 +0000)]
The implicit aspect-ratio from width and height attributes with float value is not accurate enough
https://bugs.webkit.org/show_bug.cgi?id=224664

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

The aspect ratio test case with width "0.8" and height "0.2" in img-aspect-ratio.html has passed. This patch doesn't change the behavior of
the original aspect ratio test case(`assert_ratio(images[5], 133/106)`) which is related to bug 206161.

* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt:

Source/WebCore:

The width and height attributes should impact the aspect ratio only not the intrinsic size which should be from the content.
Since computeAspectRatioInformationForRenderBox doesn't change the intrinsic size now, so we can remove it from computePreferredLogicalWidths.

* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicRatioInformation const): Width and height attributes change intrinsicRatio only, not intrinsicSize.
(WebCore::RenderReplaced::computePreferredLogicalWidths): computeAspectRatioInformationForRenderBox doesn't change intrinsicSize now, so we can remove this.

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

14 months agoUnreviewed, build fix
ysuzuki@apple.com [Sun, 18 Apr 2021 08:35:29 +0000 (08:35 +0000)]
Unreviewed, build fix
https://bugs.webkit.org/show_bug.cgi?id=224715

* dfg/DFGDesiredWatchpoints.h:

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

14 months ago[JSC] Do not use Bag<> for DFG / FTL watchpoints
ysuzuki@apple.com [Sun, 18 Apr 2021 08:06:48 +0000 (08:06 +0000)]
[JSC] Do not use Bag<> for DFG / FTL watchpoints
https://bugs.webkit.org/show_bug.cgi?id=224715

Reviewed by Darin Adler.

While Bag<> is useful since its allocated memory will not be moved,
this is really memory-inefficient data structure. Each entry gets a
tail pointer (so adding 8 bytes) and we allocate each entry separately.

In DFG and FTL, we are using Bag<> for watchpoints. But this is not necessary actually: thanks to
concurrent compilers, our watchpoint registration is batched at the end of compilation. This means
that we have a way to know how many watchpoints we should register at that point.

In this patch, we introduce WatchpointCollector. In DesiredGlobalProperties, we run reallyAdd twice
with WatchpointCollector. First time, we just count # of watchpoints. Then we allocate FixedVector<XXXWatchpoint>
and install them. Since we do not (cannot) grow this fixed vector, watchpoint's address will not be changed as required.

We also move DesiredGlobalProperties under DesiredWatchpoints since this basically registers watchpoints.

* bytecode/AdaptiveInferredPropertyValueWatchpointBase.cpp:
(JSC::AdaptiveInferredPropertyValueWatchpointBase::AdaptiveInferredPropertyValueWatchpointBase):
(JSC::AdaptiveInferredPropertyValueWatchpointBase::initialize):
* bytecode/AdaptiveInferredPropertyValueWatchpointBase.h:
* bytecode/CodeBlockJettisoningWatchpoint.h:
* dfg/DFGAdaptiveInferredPropertyValueWatchpoint.cpp:
(JSC::DFG::AdaptiveInferredPropertyValueWatchpoint::AdaptiveInferredPropertyValueWatchpoint):
(JSC::DFG::AdaptiveInferredPropertyValueWatchpoint::initialize):
* dfg/DFGAdaptiveInferredPropertyValueWatchpoint.h:
* dfg/DFGAdaptiveStructureWatchpoint.cpp:
(JSC::DFG::AdaptiveStructureWatchpoint::AdaptiveStructureWatchpoint):
(JSC::DFG::AdaptiveStructureWatchpoint::initialize):
* dfg/DFGAdaptiveStructureWatchpoint.h:
* dfg/DFGCommonData.cpp:
(JSC::DFG::CommonData::validateReferences):
(JSC::DFG::CommonData::clearWatchpoints):
* dfg/DFGCommonData.h:
* dfg/DFGDesiredGlobalProperties.cpp:
(JSC::DFG::DesiredGlobalProperties::reallyAdd):
* dfg/DFGDesiredGlobalProperties.h:
* dfg/DFGDesiredWatchpoints.cpp:
(JSC::DFG::ArrayBufferViewWatchpointAdaptor::add):
(JSC::DFG::SymbolTableAdaptor::add):
(JSC::DFG::FunctionExecutableAdaptor::add):
(JSC::DFG::AdaptiveStructureWatchpointAdaptor::add):
(JSC::DFG::DesiredWatchpoints::addLazily):
(JSC::DFG::DesiredWatchpoints::reallyAdd):
(JSC::DFG::DesiredWatchpoints::areStillValidOnMainThread):
(JSC::DFG::WatchpointCollector::finalize):
* dfg/DFGDesiredWatchpoints.h:
(JSC::DFG::SetPointerAdaptor::add):
(JSC::DFG::GenericDesiredWatchpoints::reallyAdd):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::watchGlobalProperty):
* dfg/DFGGraph.h:
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::reallyAdd):
(JSC::DFG::Plan::isStillValidOnMainThread):
(JSC::DFG::Plan::cancel):
* dfg/DFGPlan.h:
(JSC::DFG::Plan::transitions):
(JSC::DFG::Plan::globalProperties): Deleted.

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

14 months agoUse binary-search in LocaleToScriptMapping
ysuzuki@apple.com [Sun, 18 Apr 2021 07:43:33 +0000 (07:43 +0000)]
Use binary-search in LocaleToScriptMapping
https://bugs.webkit.org/show_bug.cgi?id=224727

Reviewed by Darin Adler.

This patch removes HashMaps in LocaleToScriptMapping, and binary-search onto the constant data arrays.
These maps are not frequently used. Keys of the maps can be encoded into uint32_t or uint64_t so that
comparison becomes super cheap and we can initialize this array at compile-time.

We introduce ScriptName(uint32_t) and LocaleName(uint64_t) instead of String. And ues it and generate
sorted constant data array for mappings. We use binary-search to look entry up. Since # of entries are
not huge (~200), comparisons are extremely cheap (uint32_t / uint64_t comparison), and this is not a
hot code, we can just use binary-search here and eliminate HashMaps' memory allocation.

* platform/text/LocaleToScriptMapping.cpp:
(WebCore::PackedASCIILowerCodes::PackedASCIILowerCodes):
(WebCore::PackedASCIILowerCodes::parse):
(WebCore::PackedASCIILowerCodes::operator==):
(WebCore::PackedASCIILowerCodes::operator!=):
(WebCore::PackedASCIILowerCodes::operator<):
(WebCore::PackedASCIILowerCodes::operator<=):
(WebCore::PackedASCIILowerCodes::operator>):
(WebCore::PackedASCIILowerCodes::operator>=):
(WebCore::PackedASCIILowerCodes::value const):
(WebCore::scriptNameToCode):
(WebCore::localeToScriptCodeForFontSelection):

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

14 months ago[JSC] Make more DFG/FTL data FixedVector/Vector
ysuzuki@apple.com [Sun, 18 Apr 2021 07:14:07 +0000 (07:14 +0000)]
[JSC] Make more DFG/FTL data FixedVector/Vector
https://bugs.webkit.org/show_bug.cgi?id=224713

Reviewed by Darin Adler.

1. DFG::JITCode::m_osrEntry / DFG::JITCode::m_osrExit / DFG::JITCode::m_speculationRecovery are changed to FixedVector.
   They are added at compiling time, and after that, these vectors are not modified. So when finalizing, we can easily make it FixedVector.
   We also change OSREntry::{m_reshufflings,m_expectedValues} to FixedVector and FixedOperands.
2. FTL::JITCode::m_osrExit is changed from SegmentedVector to Vector. We are still using Vector since it also involves osrExitDescriptor.
   But later, we should merge m_osrExit to osrExitDescriptor. Vector is still better than SegmentedVector since it wastes several entries
   per segment. SegmentedVector was used to use a direct pointer of OSRExit (this is not possible in Vector since this pointer can be invalidated
   after growing), but usage of that is fairly limited so that we can just replace them with m_index + osrExit vector.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::tallyFrequentExitSites):
* bytecode/Operands.h:
(JSC::Operands::Operands):
* dfg/DFGJITCode.cpp:
(JSC::DFG::JITCode::shrinkToFit):
(JSC::DFG::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
(JSC::DFG::JITCode::validateReferences):
(JSC::DFG::JITCode::findPC):
(JSC::DFG::JITCode::finalizeOSREntrypoints):
* dfg/DFGJITCode.h:
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::noticeOSREntry):
(JSC::DFG::JITCompiler::appendExceptionHandlingOSRExit):
* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::appendOSRExit):
(JSC::DFG::JITCompiler::appendSpeculationRecovery):
* dfg/DFGOSREntry.h:
* dfg/DFGOSRExit.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::speculationCheck):
(JSC::DFG::SpeculativeJIT::emitInvalidationPoint):
(JSC::DFG::SpeculativeJIT::linkOSREntries):
* ftl/FTLJITCode.cpp:
(JSC::FTL::JITCode::shrinkToFit):
(JSC::FTL::JITCode::validateReferences):
(JSC::FTL::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
(JSC::FTL::JITCode::findPC):
* ftl/FTLJITCode.h:
* ftl/FTLOSRExit.cpp:
(JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
(JSC::FTL::OSRExit::OSRExit):
* ftl/FTLOSRExit.h:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::JSC_DEFINE_JIT_OPERATION):
* ftl/FTLOSRExitHandle.cpp:
(JSC::FTL::OSRExitHandle::emitExitThunk):
* ftl/FTLOSRExitHandle.h:
(JSC::FTL::OSRExitHandle::OSRExitHandle):
* ftl/FTLPatchpointExceptionHandle.cpp:
(JSC::FTL::PatchpointExceptionHandle::scheduleExitCreationForUnwind):

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

14 months agoUpdate LibWebRTCCodecsProxy to use a Lock
cdumez@apple.com [Sun, 18 Apr 2021 07:10:05 +0000 (07:10 +0000)]
Update LibWebRTCCodecsProxy to use a Lock
https://bugs.webkit.org/show_bug.cgi?id=224728

Reviewed by Darin Adler.

Update LibWebRTCCodecsProxy to use a Lock, instead of a std::atomic<bool> that
has to be kept up to date. I think this simplifies the code a bit. Adding / Removing
encoder / decoder is not very hot code as far as I know and there will very rarely
be contention since allowsExitUnderMemoryPressure() is only called on memory pressure.

m_encoder / m_decoder are still always modified from the background thread. However, we
now check from the main thread if they are empty by locking.

* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::close):
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::releaseDecoder):
(WebKit::LibWebRTCCodecsProxy::decodeFrame):
(WebKit::LibWebRTCCodecsProxy::setFrameSize):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
(WebKit::LibWebRTCCodecsProxy::releaseEncoder):
(WebKit::LibWebRTCCodecsProxy::initializeEncoder):
(WebKit::LibWebRTCCodecsProxy::encodeFrame):
(WebKit::LibWebRTCCodecsProxy::setEncodeRates):
(WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
(WebKit::LibWebRTCCodecsProxy::updateHasEncodersOrDecoders): Deleted.

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

14 months agoGPUConnectionToWebProcess::allowsExitUnderMemoryPressure() should check if libWebRTCC...
cdumez@apple.com [Sun, 18 Apr 2021 05:23:02 +0000 (05:23 +0000)]
GPUConnectionToWebProcess::allowsExitUnderMemoryPressure() should check if libWebRTCCodecsProxy is used
https://bugs.webkit.org/show_bug.cgi?id=224709

Reviewed by Darin Adler.

Source/WebKit:

If the libWebRTCCodecsProxy has either encoders or decoders then the GPUProcess should not
exit under memory pressure, since it is not idle.

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::allowsExitUnderMemoryPressure const):
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::releaseDecoder):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
(WebKit::LibWebRTCCodecsProxy::releaseEncoder):
(WebKit::LibWebRTCCodecsProxy::updateHasEncodersOrDecoders):
(WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
Use a std::atomic<bool> to determine if the LibWebRTCCodecsProxy has encoders/decoders since
allowsExitUnderMemoryPressure() gets called on the main thread but m_encoders / m_decoders
get updated on a background thread.

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:
(runMemoryPressureExitTest):
(waitUntilCaptureState):
(TEST):

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

14 months agoUnhandled IPC messages should use correct format with the decoder.destinationID(...
commit-queue@webkit.org [Sun, 18 Apr 2021 04:47:47 +0000 (04:47 +0000)]
Unhandled IPC messages should use correct format with the decoder.destinationID() ASSERT message
https://bugs.webkit.org/show_bug.cgi?id=224335

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-04-17
Reviewed by Antti Koivisto.

Use PRIu64 instead of llu in the ASSERT messages for printing unhandled message destination.
uint64_t is printf'ed with PRIu64.

* Scripts/webkit/messages.py:
(generate_message_handler):
* Scripts/webkit/tests/TestWithIfMessageMessageReceiver.cpp:
(WebKit::TestWithIfMessage::didReceiveMessage):
* Scripts/webkit/tests/TestWithImageDataMessageReceiver.cpp:
(WebKit::TestWithImageData::didReceiveMessage):
(WebKit::TestWithImageData::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp:
(WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage):
(WebKit::TestWithLegacyReceiver::didReceiveSyncTestWithLegacyReceiverMessage):
* Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp:
(WebKit::TestWithSemaphore::didReceiveMessage):
(WebKit::TestWithSemaphore::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithStreamBufferMessageReceiver.cpp:
(WebKit::TestWithStreamBuffer::didReceiveMessage):
* Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp:
(WebKit::TestWithStream::didReceiveStreamMessage):
* Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp:
(WebKit::TestWithSuperclass::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
(WebKit::TestWithoutAttributes::didReceiveSyncMessage):

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

14 months ago[macOS] Add some support for webpage translation in WebKitLegacy
wenson_hsieh@apple.com [Sun, 18 Apr 2021 04:24:59 +0000 (04:24 +0000)]
[macOS] Add some support for webpage translation in WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=224683
<rdar://problem/75641882>

Reviewed by Darin Adler.

Source/WebCore:

Remove compile-time guards around `ContextMenuItemTagAddHighlightToCurrentGroup` and
`ContextMenuItemTagAddHighlightToNewGroup`, so that we can keep these internal WebCore context menu tags in sync
with the SPI-exposed enum values in `WebUIDelegatePrivate.h`. See WebKitLegacy ChangeLog for more details.

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::checkOrEnableIfNeeded const):
* platform/ContextMenuItem.cpp:
(WebCore::isValidContextMenuAction):
* platform/ContextMenuItem.h:

Source/WebKit:

Remove some more compile-time guards, now that the WebCore enum is not conditional on `ENABLE(APP_HIGHLIGHT)`.
See WebCore/ChangeLog for more information.

* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::menuItemIdentifier):

Source/WebKitLegacy/mac:

Add support for the webpage translation context menu item in WebKitLegacy. See below for more details.

* WebView/WebHTMLView.mm:
(toAction):
(toTag):

Introduce the `WebMenuItemTagTranslate` enum value, and use it as the tag value when creating an `NSMenuItem`
for the Translate action.

(createMenuItem):
* WebView/WebUIDelegatePrivate.h:

Unfortunately, in order to support a particular internal client of WebKitLegacy, we need to expose
`WebMenuItemTagTranslate` as an enum value in this existing enumeration of context menu item tags. This is
because the client's implementation of `-webView:contextMenuItemsForElement:defaultMenuItems:` rejects context
menu items by default, unless the item tag is within the set of item tags that they support.

This client will need to add the enum value of `WebMenuItemTagTranslate` into their allow-list.

* WebView/WebView.mm:
(+[WebView _canHandleContextMenuTranslation]):

Softlink against and check with `TranslationUIServices` to see if we should be showing the Translate menu item.

(-[WebView _handleContextMenuTranslation:selectionBounds:menuLocation:]):

Handle the menu action by creating and presenting a new `LTUITranslationViewController` using the given
information.

* WebView/WebViewInternal.h:

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

14 months agoRemove PromisedAttachmentInfo::blobURL and adjacent code
wenson_hsieh@apple.com [Sun, 18 Apr 2021 03:49:07 +0000 (03:49 +0000)]
Remove PromisedAttachmentInfo::blobURL and adjacent code
https://bugs.webkit.org/show_bug.cgi?id=224720

Reviewed by Ryosuke Niwa.

Source/WebCore:

Remove this member of `PromisedAttachmentInfo`. See WebKit ChangeLog for more details.

* editing/Editor.cpp:
(WebCore::Editor::promisedAttachmentInfo):
* platform/PromisedAttachmentInfo.h:
(WebCore::PromisedAttachmentInfo::operator bool const):

Source/WebKit:

The `blobURL` member of `PromisedAttachmentInfo` was originally introduced to facilitate drag and drop support
for attachment elements in WebKit2, by writing blob URL data to temporary file paths on behalf of
`NSFilePromiseProvider` when starting a drag on attachment elements backed by blobs. However, this was
superceded by use of `NSFileWrapper` and the `_WKAttachment` SPI instead, such that we only support dragging
attachment elements if they correspond to API `Attachment` objects in the UI process. This means we can remove
this `blobURL`, along with the file name and content type members of the struct (which were only added to
support the ability to drag blob-backed attachments).

Code that utilized this member was originally introduced in <https://trac.webkit.org/r235202>, and was
subsequently removed in <https://trac.webkit.org/r240687>.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PromisedAttachmentInfo>::encode):
(IPC::ArgumentCoder<PromisedAttachmentInfo>::decode):
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKPromisedAttachmentContext initWithIdentifier:fileName:]):
(WebKit::WebViewImpl::writeToURLForFilePromiseProvider):
(WebKit::WebViewImpl::startDrag):
(-[WKPromisedAttachmentContext initWithIdentifier:blobURL:fileName:]): Deleted.
(-[WKPromisedAttachmentContext blobURL]): Deleted.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _prepareToDragPromisedAttachment:]):

Tools:

Rebaseline a couple of iOS WKAttachment tests that are failing on recent versions of the iOS SDK. The content
type of text files that are inserted as attachments is now a MIME type rather than a UTI, which is still valid
since it is valid for the content type of an attachment to be either a MIME type or UTI.

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

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

14 months agoUse WebProcess::existingGPUProcessConnection() whenever possible
cdumez@apple.com [Sun, 18 Apr 2021 03:40:56 +0000 (03:40 +0000)]
Use WebProcess::existingGPUProcessConnection() whenever possible
https://bugs.webkit.org/show_bug.cgi?id=224725

Reviewed by Darin Adler.

Use WebProcess::existingGPUProcessConnection() whenever possible, instead of WebProcess::ensureGPUProcessConnection().
This avoids relaunching the GPUProcess if it has already exited.

* WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:
(WebKit::RemoteAudioHardwareListener::~RemoteAudioHardwareListener):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
(WebKit::AudioMediaStreamTrackRenderer::~AudioMediaStreamTrackRenderer):
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
(WebKit::RemoteRealtimeAudioSource::~RemoteRealtimeAudioSource):
* WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::~RemoteRealtimeVideoSource):

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

14 months agoUnreviewed, suppress warnings
ysuzuki@apple.com [Sun, 18 Apr 2021 01:19:47 +0000 (01:19 +0000)]
Unreviewed, suppress warnings
https://bugs.webkit.org/show_bug.cgi?id=224616

* runtime/HashMapImpl.h:
* runtime/HashMapImplInlines.h:
(JSC::areKeysEqual):
(JSC::wangsInt64Hash):

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

14 months agoAdd support for inline-{start/end} values to float & clear properties
commit-queue@webkit.org [Sun, 18 Apr 2021 01:03:18 +0000 (01:03 +0000)]
Add support for inline-{start/end} values to float & clear properties
https://bugs.webkit.org/show_bug.cgi?id=218087

Patch by Tim Nguyen <ntim@apple.com> on 2021-04-17
Reviewed by Antti Koivisto & Zalan Bujtas.

Imported reftests from: https://github.com/web-platform-tests/wpt/commit/47e7176242e2ca4ca68d6cfe032619ccf44d55a6
Enabled: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear.html

LayoutTests/imported/w3c:

* web-platform-tests/css/css-box/parsing/clear-computed-expected.txt:
* web-platform-tests/css/css-box/parsing/clear-valid-expected.txt:
* web-platform-tests/css/css-box/parsing/float-computed-expected.txt:
* web-platform-tests/css/css-box/parsing/float-valid-expected.txt:
* web-platform-tests/css/css-logical/logical-values-float-clear-1-expected.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-1.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-2-expected.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-2.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-3-expected.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-3.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-4-expected.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-4.html: Added.
* web-platform-tests/css/css-logical/logical-values-float-clear-expected.txt:
* web-platform-tests/css/css-logical/w3c-import.log:

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-1.html
       imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-2.html
       imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-3.html
       imported/w3c/web-platform-tests/css/css-logical/logical-values-float-clear-4.html

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Clear const):
(WebCore::CSSPrimitiveValue::operator Float const):
* css/CSSValueKeywords.in:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* display/css/DisplayStyle.cpp:
(WebCore::Display::Style::Style):
* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isFloatingPositioned const):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):
(WebCore::Layout::TreeBuilder::buildTableStructure):
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::layoutRunsAndFloats):
(WebCore::ComplexLineLayout::layoutRunsAndFloatsInRange):
* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::FloatingObject):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::marginOffsetForSelfCollapsingBlock):
(WebCore::RenderBlockFlow::marginBeforeEstimateForChild const):
(WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
(WebCore::RenderBlockFlow::positionNewFloats):
(WebCore::RenderBlockFlow::clearFloats):
(WebCore::RenderBlockFlow::getClearDelta):
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
* rendering/RenderBlockFlow.h:
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleBR):
* rendering/line/LineBreaker.cpp:
(WebCore::LineBreaker::reset):
* rendering/line/LineBreaker.h:
(WebCore::LineBreaker::usedClear):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::usedClear):
(WebCore::RenderStyle::usedFloat):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::isFloating const):
(WebCore::RenderStyle::initialFloating):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):

LayoutTests:

* TestExpectations:

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

14 months ago[GLIB] Unreviewed test gardening. Emit new baseline after r276193.
dpino@igalia.com [Sun, 18 Apr 2021 00:27:44 +0000 (00:27 +0000)]
[GLIB] Unreviewed test gardening. Emit new baseline after r276193.

* platform/glib/TestExpectations:
* platform/glib/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Added.

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

14 months agoLibWebRTCCodecs eagerly launches the GPUProcess and always relaunches it on exit
cdumez@apple.com [Sun, 18 Apr 2021 00:10:13 +0000 (00:10 +0000)]
LibWebRTCCodecs eagerly launches the GPUProcess and always relaunches it on exit
https://bugs.webkit.org/show_bug.cgi?id=224704

Reviewed by Darin Adler.

LibWebRTCCodecs eagerly launches the GPUProcess and always relaunches it on exit. The GPUProcess
should only be (re-)launched when needed. In the case of the LibWebRTCCodecs, it seems it only
needs a GPUProcess connection if it has m_decoders / m_encoders are non-empty.

* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThread):
Renamed startListeningForIPC() to ensureGPUProcessConnectionOnMainThread(). Only do the
connection initialization if m_connection is not null.

(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionAndDispatchToThread):
Version of dispatchToThread() which makes sure that the GPUProcessConnection is initialized
before dispatching. It is used when constructing a decoder / encoder. It sets the
m_needsGPUProcessConnection flag to true to indicate someone needed the connection
(and that we should re-initiate it in case it is severed). If the connection is already
initialized, then it does a simple dispatchToThread(). If the connection is not initialized
yet, then we have to hop to the main thread (if not already on it) to initialize the
GPUProcessConnection.

(WebKit::LibWebRTCCodecs::gpuProcessConnectionMayNoLongerBeNeeded):
Function that gets called on the background thread every time a encoder / decoder is
removed. Its purpose is to set m_needsGPUProcessConnection back to false once we no
longer have any encoder / decoder, so that gpuProcessConnectionDidClose() does not
attempt to relaunch the GPUProcess if it goes away.

LibWebRTCCodecs::setCallbacks():
Check if VP9Support is enabled via PlatformMediaSessionManager instead of from the
GPUProcessConnection. This avoids eagerly launching the GPUProcess. The
GPUProcessConnection constructor gets its VPx support information from
PlatformMediaSessionManager anyway. The WebPage constructor is where the VPx support
information comes from and it updates the VPx flags on the PlatformMediaSessionManager.
The WebPage constructor only updates the VPx flags on the GPUProcessConnection if this
connection already exists to avoid eagerly launching the GPUProcess.

(WebKit::LibWebRTCCodecs::createDecoder):
- Call ensureGPUProcessConnectionAndDispatchToThread() instead of dispatchToThread()
  to make sure we have a GPUProcessConnection before creating the decoder.
- Add a missing locker for m_connectionLock on the background thread since it is using
  m_connection (pre-existing bug).

(WebKit::LibWebRTCCodecs::releaseDecoder):
Call gpuProcessConnectionMayNoLongerBeNeeded() to reset the m_needsGPUProcessConnection
flag to false if necessary.

(WebKit::LibWebRTCCodecs::createEncoder):
- Call ensureGPUProcessConnectionAndDispatchToThread() instead of dispatchToThread()
  to make sure we have a GPUProcessConnection before creating the encoder.

(WebKit::LibWebRTCCodecs::releaseEncoder):
Call gpuProcessConnectionMayNoLongerBeNeeded() to reset the m_needsGPUProcessConnection
flag to false if necessary.

(WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose):
- Clear m_connection when the GPUProcess connection is severed (note that this does not
  necessarily indicate a crash since the GPUProcess exits when idle and under memory
  pressure).
- Only re-initiate the GPUProcess connection if m_needsGPUProcessConnection is true,
  meaning that we have encoders/decoders. I use this flag instead of checking m_encoders
  & m_decoders since those containers are modified on the background thread and this
  function is called on the main thread.

* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
(WebKit::LibWebRTCCodecs::create):
- Stop calling startListeningForIPC() on construction as we don't want to launch the GPUProcess
until an encoder / decoder is created.
- Fix a pre-existing issue where the class subclasses ThreadSafeRefCounted (via
  ThreadMessageReceiverRefCounted) and yet was using std::unique_ptr<> instead of
  RefPtr<>.

* WebProcess/WebProcess.h:

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

14 months agoUnreviewed, reverting r276178.
commit-queue@webkit.org [Sat, 17 Apr 2021 23:55:13 +0000 (23:55 +0000)]
Unreviewed, reverting r276178.
https://bugs.webkit.org/show_bug.cgi?id=224724

tests still broken

Reverted changeset:

"[ macOS Wk2 ] media/media-fragments/TC0051.html is flakey
crashing"
https://bugs.webkit.org/show_bug.cgi?id=222277
https://trac.webkit.org/changeset/276178

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

14 months agoRemoteImageDecoderAVFManager should never re-launch the GPUProcess on destruction
cdumez@apple.com [Sat, 17 Apr 2021 23:22:13 +0000 (23:22 +0000)]
RemoteImageDecoderAVFManager should never re-launch the GPUProcess on destruction
https://bugs.webkit.org/show_bug.cgi?id=224723

Reviewed by Darin Adler.

RemoteImageDecoderAVFManager was calling ensureGPUProcessConnection() it is destructor,
just to remove itself as an IPC message receiver. This means it could unnecessarily
relaunch the GPUProcess. This patch addresses that.

This patch also makes it so that RemoteImageDecoderAVFManager registers itself as a
client of the GPUProcessConnection, so that it gets notified when the connection gets
severed. Right now, I only do very basic crash handling but this paves the way to do
better in the future. I did fix a bug where the RemoteImageDecoderAVFManager would
not re-register itself as a message receiver after a GPUProcess re-launch.

* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::RemoteImageDecoderAVF):
* WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp:
(WebKit::RemoteImageDecoderAVFManager::createImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::deleteRemoteImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::~RemoteImageDecoderAVFManager):
(WebKit::RemoteImageDecoderAVFManager::gpuProcessConnectionDidClose):
(WebKit::RemoteImageDecoderAVFManager::ensureGPUProcessConnection):
(WebKit::RemoteImageDecoderAVFManager::gpuProcessConnection const): Deleted.
* WebProcess/GPU/media/RemoteImageDecoderAVFManager.h:

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

14 months ago[Curl] Remove warnings on curl layer.
basuke.suzuki@sony.com [Sat, 17 Apr 2021 22:55:14 +0000 (22:55 +0000)]
[Curl] Remove warnings on curl layer.
https://bugs.webkit.org/show_bug.cgi?id=224721

Reviewed by Darin Adler.

Remove unused parameters to prevent warnings. For CurlRequest, it passes
member variable to private method which is meaningless so that it was
removed.

Covered by existing test files.

* platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::createPrepareStatement):
* platform/network/curl/CurlFormDataStream.cpp:
(WebCore::CurlFormDataStream::read):
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::setupTransfer):
(WebCore::CurlRequest::setupPUT):
(WebCore::CurlRequest::setupPOST):
* platform/network/curl/CurlRequest.h:
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::NetworkStorageSession::setCookiesFromDOM const):

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

14 months agoCreate local copy of CSSParserContext in CSSPropertyParserWorkerSafe
clord@igalia.com [Sat, 17 Apr 2021 22:40:08 +0000 (22:40 +0000)]
Create local copy of CSSParserContext in CSSPropertyParserWorkerSafe
https://bugs.webkit.org/show_bug.cgi?id=224675

Reviewed by Darin Adler.

Make sure to hold a copy of the CSSParserContext in
CSSPropertyParserWorkerSafe functions as CSSParserImpl only takes a
reference.

* css/parser/CSSParserWorkerSafe.cpp:

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

14 months agoConsider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules().
commit-queue@webkit.org [Sat, 17 Apr 2021 22:38:29 +0000 (22:38 +0000)]
Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules().
https://bugs.webkit.org/show_bug.cgi?id=197725

Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-17
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

To match other browsers and the below WPT, CSSStyleSheet.rules now aliases
CSSStyleSheet.cssRulesForBindings, meaning we pass two more tests.

* web-platform-tests/css/cssom/CSSStyleSheet-expected.txt:

Source/WebCore:

To match other browsers (Blink and Gecko) and pass a WPT, CSSStyleSheet.rules now aliases
CSSStyleSheet.cssRulesForBindings.  CSSStyleSheet.rulesForBindings is deleted.

Tested by
imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet.html.

* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::rulesForBindings): Deleted.
(WebCore::CSSStyleSheet::rules): Deleted.

* css/CSSStyleSheet.h:
Change `rules()` to be an inlined alias for `cssRulesForBindings()`.

* css/CSSStyleSheet.idl:
Remove [ImplementedAs=rulesForBindings], as this function has been
deleted.

Source/WebKit:

CSSStyleSheet.rules has been changed to alias CSSStyleSheet.cssRulesForBindings.  Now,
to access just the CSSRuleList, CSSStyleSheet.cssRules must be called.

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
(webkit_dom_css_style_sheet_get_rules):
Use CSSStyleSheet.cssRules instead of CSSStyleSheet.rules (deleted
with this patch) to get access to the CSSRuleList of this
stylesheet.

Source/WebKitLegacy/mac:

CSSStyleSheet.rules has been changed to alias CSSStyleSheet.cssRulesForBindings.  Now,
to access just the CSSRuleList, CSSStyleSheet.cssRules must be called.

* DOM/DOMCSSStyleSheet.mm:
(-[DOMCSSStyleSheet rules]):
Update this function to call IMPL->cssRules instead of IMPL->rules.

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

14 months agoMedia queries with max-width greater than 999999999px evaluate to false
commit-queue@webkit.org [Sat, 17 Apr 2021 22:21:20 +0000 (22:21 +0000)]
Media queries with max-width greater than 999999999px evaluate to false
https://bugs.webkit.org/show_bug.cgi?id=224097

Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-17
Reviewed by Darin Adler.

We now evaluate <length> values in media queries with double
Source/WebCore:

precision instead of int precision to match other browsers and pass a WPT.

See similar method in Chromium:
https://github.com/chromium/chromium/blob/09a0b960b27f6e08fbe67ad97e6c4fb55ada383f/third_party/blink/renderer/core/css/media_query_evaluator.cc#L436

Test: fast/media/media-query-lengths-evaluate-with-double-precision.html
and WPT imported/w3c/web-platform-tests/css/mediaqueries/min-width-001.xht

* css/MediaQueryEvaluator.cpp:
(WebCore::computeLength):
Return Optional<double> rather than int& out-value.

(WebCore::deviceHeightEvaluate):
(WebCore::deviceWidthEvaluate):
(WebCore::heightEvaluate):
(WebCore::widthEvaluate):
Evaluate `length` values as doubles instead of ints.

LayoutTests:

precision instead of int precision to match other browsers and pass another WPT.

* TestExpectations:
Remove ImageOnlyFailure for imported/w3c/web-platform-tests/css/mediaqueries/min-width-001.xht
because it passes now.

* fast/media/media-query-lengths-evaluate-with-double-precision-expected.html:
Added.

* fast/media/media-query-lengths-evaluate-with-double-precision.html:
Added to test properties that WPT min-width-001.xht doesn't
(min-height, device-min-height, device-min-width).

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

14 months ago[Cleanup] Remove redundant BreakingContext::m_currentStyle
zalan@apple.com [Sat, 17 Apr 2021 21:13:20 +0000 (21:13 +0000)]
[Cleanup] Remove redundant BreakingContext::m_currentStyle
https://bugs.webkit.org/show_bug.cgi?id=224717

Reviewed by Antti Koivisto.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::BreakingContext):
(WebCore::BreakingContext::initializeForCurrentObject):
(WebCore::BreakingContext::handleBR):
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

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

14 months agoPerform port blocking earlier in the load
bfulgham@apple.com [Sat, 17 Apr 2021 20:59:39 +0000 (20:59 +0000)]
Perform port blocking earlier in the load
https://bugs.webkit.org/show_bug.cgi?id=224525
<rdar://problem/75440591>

Unreviewed follow-up (suggested by David Kilzer)

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest): Restore an m_frame nullptr check.,

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

14 months ago[clang 11] Remove warning when converting WebCore::maxValueForCssLength from int...
basuke.suzuki@sony.com [Sat, 17 Apr 2021 20:16:22 +0000 (20:16 +0000)]
[clang 11] Remove warning when converting WebCore::maxValueForCssLength from int to float
https://bugs.webkit.org/show_bug.cgi?id=224714

Reviewed by Chris Dumez.

On clang 11, the conversion from const int WebCore::maxValueForCssLength (= 33554429) to
float generates conversion warning:
> warning: implicit conversion from 'const int' to 'float' changes value from 33554429 to 33554428

Changing the target type from float to double works for this. Length constructor accept double
so that there's no drawback with this change.

No test because it's compiler behavior.

* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertWordSpacing):

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

14 months agoMove RuntimeEnabledFeatures to Settings (Part 1)
weinig@apple.com [Sat, 17 Apr 2021 20:07:30 +0000 (20:07 +0000)]
Move RuntimeEnabledFeatures to Settings (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=224440

Reviewed by Alex Christensen.

Move a few RuntimeEnabledFeatures to Settings to consolidate settings
in one object and removes the need for additional boilerplate. This
is now possible as Settings are now accessible in workers.

Moves PeerConnectionEnabled, WebGLUsingMetal, WebGL2Enabled, WebGPUEnabled
and MaskWebGLStringsEnabled.

Source/WebCore:

* Modules/mediastream/RTCAnswerOptions.idl:
* Modules/mediastream/RTCCertificate.idl:
* Modules/mediastream/RTCConfiguration.idl:
* Modules/mediastream/RTCDTMFSender.idl:
* Modules/mediastream/RTCDTMFToneChangeEvent.idl:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCDataChannelEvent.idl:
* Modules/mediastream/RTCIceCandidate.idl:
* Modules/mediastream/RTCIceCandidateInit.idl:
* Modules/mediastream/RTCIceConnectionState.idl:
* Modules/mediastream/RTCIceGatheringState.idl:
* Modules/mediastream/RTCIceServer.idl:
* Modules/mediastream/RTCIceTransport.idl:
* Modules/mediastream/RTCIceTransportState.idl:
* Modules/mediastream/RTCOfferAnswerOptions.idl:
* Modules/mediastream/RTCOfferOptions.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl:
* Modules/mediastream/RTCPeerConnectionIceEvent.idl:
* Modules/mediastream/RTCPeerConnectionState.idl:
* Modules/mediastream/RTCPriorityType.idl:
* Modules/mediastream/RTCRtcpParameters.idl:
* Modules/mediastream/RTCRtpCapabilities.idl:
* Modules/mediastream/RTCRtpCodecCapability.idl:
* Modules/mediastream/RTCRtpCodecParameters.idl:
* Modules/mediastream/RTCRtpCodingParameters.idl:
* Modules/mediastream/RTCRtpContributingSource.idl:
* Modules/mediastream/RTCRtpDecodingParameters.idl:
* Modules/mediastream/RTCRtpEncodingParameters.idl:
* Modules/mediastream/RTCRtpFecParameters.idl:
* Modules/mediastream/RTCRtpHeaderExtensionParameters.idl:
* Modules/mediastream/RTCRtpParameters.idl:
* Modules/mediastream/RTCRtpReceiver.idl:
* Modules/mediastream/RTCRtpRtxParameters.idl:
* Modules/mediastream/RTCRtpSendParameters.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpSynchronizationSource.idl:
* Modules/mediastream/RTCRtpTransceiver.idl:
* Modules/mediastream/RTCRtpTransceiverDirection.idl:
* Modules/mediastream/RTCSdpType.idl:
* Modules/mediastream/RTCSessionDescription.idl:
* Modules/mediastream/RTCSignalingState.idl:
* Modules/mediastream/RTCStatsReport.idl:
* Modules/mediastream/RTCTrackEvent.idl:
* Modules/webgpu/GPUBindGroupLayoutBinding.idl:
* Modules/webgpu/GPUBindGroupLayoutDescriptor.idl:
* Modules/webgpu/GPUBlendDescriptor.idl:
* Modules/webgpu/GPUBufferDescriptor.idl:
* Modules/webgpu/GPUBufferUsage.idl:
* Modules/webgpu/GPUCanvasContext.idl:
* Modules/webgpu/GPUColor.idl:
* Modules/webgpu/GPUColorStateDescriptor.idl:
* Modules/webgpu/GPUColorWrite.idl:
* Modules/webgpu/GPUCompareFunction.idl:
* Modules/webgpu/GPUDepthStencilStateDescriptor.idl:
* Modules/webgpu/GPUErrorFilter.idl:
* Modules/webgpu/GPUExtent3D.idl:
* Modules/webgpu/GPULoadOp.idl:
* Modules/webgpu/GPUOrigin3D.idl:
* Modules/webgpu/GPUOutOfMemoryError.idl:
* Modules/webgpu/GPURequestAdapterOptions.idl:
* Modules/webgpu/GPUSamplerDescriptor.idl:
* Modules/webgpu/GPUShaderStage.idl:
* Modules/webgpu/GPUStoreOp.idl:
* Modules/webgpu/GPUTextureDescriptor.idl:
* Modules/webgpu/GPUTextureFormat.idl:
* Modules/webgpu/GPUTextureUsage.idl:
* Modules/webgpu/GPUUncapturedErrorEvent.idl:
* Modules/webgpu/GPUValidationError.idl:
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexBufferDescriptor.idl:
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/Navigator+GPU.idl:
* Modules/webgpu/NavigatorGPU.cpp:
* Modules/webgpu/WebGPU.idl:
* Modules/webgpu/WebGPUAdapter.idl:
* Modules/webgpu/WebGPUBindGroup.idl:
* Modules/webgpu/WebGPUBindGroupBinding.idl:
* Modules/webgpu/WebGPUBindGroupDescriptor.idl:
* Modules/webgpu/WebGPUBindGroupLayout.idl:
* Modules/webgpu/WebGPUBuffer.idl:
* Modules/webgpu/WebGPUBufferBinding.idl:
* Modules/webgpu/WebGPUCommandBuffer.idl:
* Modules/webgpu/WebGPUCommandEncoder.idl:
* Modules/webgpu/WebGPUComputePassEncoder.idl:
* Modules/webgpu/WebGPUComputePipeline.idl:
* Modules/webgpu/WebGPUComputePipelineDescriptor.idl:
* Modules/webgpu/WebGPUDevice.idl:
* Modules/webgpu/WebGPUDeviceErrorScopes.idl:
* Modules/webgpu/WebGPUDeviceEventHandler.idl:
* Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
* Modules/webgpu/WebGPUPipelineLayout.idl:
* Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl:
* Modules/webgpu/WebGPUProgrammablePassEncoder.idl:
* Modules/webgpu/WebGPUProgrammableStageDescriptor.idl:
* Modules/webgpu/WebGPUQueue.idl:
* Modules/webgpu/WebGPURenderPassDescriptor.idl:
* Modules/webgpu/WebGPURenderPassEncoder.idl:
* Modules/webgpu/WebGPURenderPipeline.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Modules/webgpu/WebGPUSampler.idl:
* Modules/webgpu/WebGPUShaderModule.idl:
* Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
* Modules/webgpu/WebGPUSwapChain.idl:
* Modules/webgpu/WebGPUTexture.idl:
* Modules/webgpu/WebGPUTextureView.idl:
* Modules/webgpu/WorkerNavigator+GPU.idl:
* Modules/webgpu/WorkerNavigatorGPU.cpp:
* Modules/webxr/Navigator+WebXR.idl:
* Modules/webxr/WebXRBoundedReferenceSpace.idl:
* Modules/webxr/WebXRFrame.idl:
* Modules/webxr/WebXRInputSource.idl:
* Modules/webxr/WebXRInputSourceArray.idl:
* Modules/webxr/WebXRLayer.idl:
* Modules/webxr/WebXRPose.idl:
* Modules/webxr/WebXRReferenceSpace.idl:
* Modules/webxr/WebXRRenderState.idl:
* Modules/webxr/WebXRRigidTransform.idl:
* Modules/webxr/WebXRSession.idl:
* Modules/webxr/WebXRSpace.idl:
* Modules/webxr/WebXRSystem.cpp:
* Modules/webxr/WebXRSystem.idl:
* Modules/webxr/WebXRView.idl:
* Modules/webxr/WebXRViewerPose.idl:
* Modules/webxr/WebXRViewport.idl:
* Modules/webxr/WebXRWebGLLayer.idl:
* Modules/webxr/XREnvironmentBlendMode.idl:
* Modules/webxr/XREye.idl:
* Modules/webxr/XRHandedness.idl:
* Modules/webxr/XRInputSourceEvent.idl:
* Modules/webxr/XRInputSourcesChangeEvent.idl:
* Modules/webxr/XRInteractionMode.idl:
* Modules/webxr/XRReferenceSpaceEvent.idl:
* Modules/webxr/XRReferenceSpaceType.idl:
* Modules/webxr/XRRenderStateInit.idl:
* Modules/webxr/XRSessionEvent.idl:
* Modules/webxr/XRSessionInit.idl:
* Modules/webxr/XRSessionMode.idl:
* Modules/webxr/XRTargetRayMode.idl:
* Modules/webxr/XRVisibilityState.idl:
* Modules/webxr/XRWebGLLayerInit.idl:
* html/HTMLCanvasElement.cpp:
* html/canvas/WebGL2RenderingContext.cpp:
* html/canvas/WebGL2RenderingContext.idl:
* html/canvas/WebGLRenderingContextBase.cpp:
* html/canvas/WebGLTransformFeedback.idl:
* html/canvas/WebGLVertexArrayObject.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::peerConnectionEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setPeerConnectionEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebGLUsingMetal): Deleted.
(WebCore::RuntimeEnabledFeatures::webGLUsingMetal const): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebGL2Enabled): Deleted.
(WebCore::RuntimeEnabledFeatures::webGL2Enabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebGPUEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::webGPUEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setMaskWebGLStringsEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::maskWebGLStringsEnabled const): Deleted.
* testing/FakeXRBoundsPoint.idl:
* testing/FakeXRButtonStateInit.idl:
* testing/FakeXRInputSourceInit.idl:
* testing/FakeXRRigidTransformInit.idl:
* testing/FakeXRViewInit.idl:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setWebGL2Enabled): Deleted.
(WebCore::InternalSettings::setWebGPUEnabled): Deleted.
* testing/InternalSettings.h:
* testing/InternalSettings.idl:
* testing/Internals.cpp:
* testing/WebFakeXRDevice.idl:
* testing/WebFakeXRInputController.idl:
* testing/WebXRTest.idl:
* testing/XRSimulateUserActivationFunction.idl:

Source/WebKit:

* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI):
* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::enableFrontendFeatures):
(WebKit::WebInspectorUI::WebInspectorUI):
* WebProcess/Inspector/WebInspectorUI.h:

Source/WTF:

* Scripts/Preferences/WebPreferences.yaml:
* Scripts/Preferences/WebPreferencesExperimental.yaml:

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

14 months agoDon't omit conic gradient starting angle when serializing when starting angle is...
commit-queue@webkit.org [Sat, 17 Apr 2021 19:02:05 +0000 (19:02 +0000)]
Don't omit conic gradient starting angle when serializing when starting angle is under 0
https://bugs.webkit.org/show_bug.cgi?id=224719

Patch by Tim Nguyen <ntim@apple.com> on 2021-04-17
Reviewed by Ryosuke Niwa.

Updated pre-existing test to cover this case.

Test: LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/background-image-computed.sub.html

LayoutTests/imported/w3c:

* web-platform-tests/css/css-backgrounds/parsing/background-image-computed.sub-expected.txt:
* web-platform-tests/css/css-backgrounds/parsing/background-image-computed.sub.html:

Source/WebCore:

* css/CSSGradientValue.cpp:
(WebCore::CSSConicGradientValue::customCSSText const):

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

14 months ago[Cleanup] Modernize TrailingObjects
zalan@apple.com [Sat, 17 Apr 2021 18:22:35 +0000 (18:22 +0000)]
[Cleanup] Modernize TrailingObjects
https://bugs.webkit.org/show_bug.cgi?id=224712

Reviewed by Antti Koivisto.

Remove redundant c'tor and start using enum class.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
(WebCore::checkWhitespaceCollapsingTransitions):
(WebCore::BreakingContext::handleEndOfLine):
* rendering/line/TrailingObjects.cpp:
(WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes):
* rendering/line/TrailingObjects.h:
(WebCore::TrailingObjects::setTrailingWhitespace):
(WebCore::TrailingObjects::clear):
(WebCore::TrailingObjects::TrailingObjects): Deleted.

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

14 months ago[Cleanup] BreakingContext::handleText should consistently use the cached renderer
zalan@apple.com [Sat, 17 Apr 2021 15:38:31 +0000 (15:38 +0000)]
[Cleanup] BreakingContext::handleText should consistently use the cached renderer
https://bugs.webkit.org/show_bug.cgi?id=224711

Reviewed by Antti Koivisto.

Since this function is not supposed to increment the renderer, let's replace m_current.renderer() with "renderer".

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):
* rendering/line/TrailingObjects.h:
(WebCore::TrailingObjects::setTrailingWhitespace):

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

14 months ago[Cleanup] inlineLogicalWidth should take const RenderObject&
zalan@apple.com [Sat, 17 Apr 2021 13:48:00 +0000 (13:48 +0000)]
[Cleanup] inlineLogicalWidth should take const RenderObject&
https://bugs.webkit.org/show_bug.cgi?id=224700

Reviewed by Antti Koivisto.

1. inlineLogicalWidth takes const RenderObject& now.
2. Both previousInFlowSibling and shouldAddBorderPaddingMargin moved to inlineLogicalWidth

* rendering/line/BreakingContext.h:
(WebCore::inlineLogicalWidth):
(WebCore::BreakingContext::handleOutOfFlowPositioned):
(WebCore::BreakingContext::handleEmptyInline):
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::handleText):
(WebCore::shouldAddBorderPaddingMargin): Deleted.
(WebCore::previousInFlowSibling): Deleted.

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

14 months agoDo not configure Janitor to delete old logs in local testing mode
aakash_jain@apple.com [Sat, 17 Apr 2021 12:20:32 +0000 (12:20 +0000)]
Do not configure Janitor to delete old logs in local testing mode
https://bugs.webkit.org/show_bug.cgi?id=224552

Reviewed by Jonathan Bedard.

* CISupport/build-webkit-org/master_buildbot2.cfg:
* CISupport/ews-build/master.cfg:

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

14 months agoUnreviewed, GTK LTS build fix after r276197
philn@webkit.org [Sat, 17 Apr 2021 12:08:32 +0000 (12:08 +0000)]
Unreviewed, GTK LTS build fix after r276197

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::configureMediaStreamAudioTracks):

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

14 months ago[GStreamer][MediaStream] fast/mediastream/play-newly-added-audio-track.html is failin...
philn@webkit.org [Sat, 17 Apr 2021 11:23:09 +0000 (11:23 +0000)]
[GStreamer][MediaStream] fast/mediastream/play-newly-added-audio-track.html is failing since added in r260380
https://bugs.webkit.org/show_bug.cgi?id=210840

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

The test was failing mainly because our mediastreamsrc GStreamer element wasn't creating the
corresponding AudioTrackPrivateMediaStream object. The media player should propagate its
volume/mute/is-playing states to the source element. And also until now our mediastreamsrc
element was handling at most one audio track and at most one audio track, but it turns out
multiple audio tracks can be added actually. So I refactored the element internals
accordingly. The InternalSource is now directly observing the corresponding
RealtimeMediaSource, which simplified some code. Observing is also now suspended/resumed
depending on the element state.

We don't implement a GStreamer AudioMediaStreamTrackRenderer class yet, because actual
rendering is still performed from the WebProcess, so early returns were added in
AudioTrackPrivateMediaStream to handle this case.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
(WebCore::MediaPlayerPrivateGStreamer::configureMediaStreamAudioTracks):
(WebCore::MediaPlayerPrivateGStreamer::setVolume):
(WebCore::MediaPlayerPrivateGStreamer::setMuted):
(WebCore::MediaPlayerPrivateGStreamer::updateStates):
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/mediastream/AudioTrackPrivateMediaStream.cpp:
(WebCore::AudioTrackPrivateMediaStream::createRenderer):
(WebCore::AudioTrackPrivateMediaStream::setLogger):
(WebCore::AudioTrackPrivateMediaStream::clear):
(WebCore::AudioTrackPrivateMediaStream::setVolume):
(WebCore::AudioTrackPrivateMediaStream::setAudioOutputDevice):
(WebCore::AudioTrackPrivateMediaStream::volume const):
(WebCore::AudioTrackPrivateMediaStream::audioSamplesAvailable):
(WebCore::AudioTrackPrivateMediaStream::startRenderer):
(WebCore::AudioTrackPrivateMediaStream::stopRenderer):
(WebCore::AudioTrackPrivateMediaStream::createNewRenderer):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
(mediaStreamTrackPrivateGetTags):
(WebKitMediaStreamObserver::didRemoveTrack):
(webkitMediaStreamSrcConstructed):
(webkitMediaStreamSrcDispose):
(webkitMediaStreamSrcChangeState):
(webkitMediaStreamSrcPostStreamCollection):
(webkitMediaStreamSrcAddPad):
(ProbeData::ProbeData):
(webkitMediaStreamSrcPadProbeCb):
(webkitMediaStreamSrcAddTrack):
(webkitMediaStreamSrcSetStream):
(webkitMediaStreamSrcTrackEnded):
(InternalSource::trackEnded):
(webkitMediaStreamSrcConfigureAudioTracks):
* platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:

LayoutTests:

Remove flakyness from test and unflag it on GTK.

* fast/mediastream/play-newly-added-audio-track.html: addTrack might have asynchronous
effects, so it's better to rely on the trackadded event when testing its result.
* platform/gtk/TestExpectations:

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

14 months agoREGRESSION(r275755): [GStreamer] Crashes on surfaceless i915 platforms
commit-queue@webkit.org [Sat, 17 Apr 2021 09:03:51 +0000 (09:03 +0000)]
REGRESSION(r275755): [GStreamer] Crashes on surfaceless i915 platforms
https://bugs.webkit.org/show_bug.cgi?id=224416

Patch by Philippe Normand <pnormand@igalia.com> on 2021-04-17
Reviewed by Adrian Perez de Castro.

Vendor potential fix for https://gitlab.freedesktop.org/mesa/mesa/-/issues/778.

* elements/sdk/mesa.bst:
* patches/mesa/0001-i915-Prevent-invalid-framebuffer-usage.patch: Added.

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

14 months agoREGRESSION(r276164) [GTK] WKPreferencesDefaults API test is failing
lmoura@igalia.com [Sat, 17 Apr 2021 05:03:59 +0000 (05:03 +0000)]
REGRESSION(r276164) [GTK] WKPreferencesDefaults API test is failing
https://bugs.webkit.org/show_bug.cgi?id=224710

Reviewed by Alex Christensen.

As of r276164, Mac/iOS disabled application cache by default but other
ports are still enabling it.

* TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
(TestWebKitAPI::TEST): Add missing WPE guard and test against expected
port value instead of enforcing a single value for every port.
* TestWebKitAPI/glib/TestExpectations.json: Remove WPE expected
failure.

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

14 months ago[GLIB] Unreviewed test gardening. Update focus-visible tests baselines after r276127.
dpino@igalia.com [Sat, 17 Apr 2021 04:45:48 +0000 (04:45 +0000)]
[GLIB] Unreviewed test gardening. Update focus-visible tests baselines after r276127.

* platform/glib/imported/w3c/web-platform-tests/css/selectors/focus-visible-002-expected.txt: Added.
* platform/glib/imported/w3c/web-platform-tests/css/selectors/focus-visible-003-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/selectors/focus-visible-003-expected.txt.
* platform/glib/imported/w3c/web-platform-tests/css/selectors/focus-visible-004-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/selectors/focus-visible-004-expected.txt.

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

14 months agoPerform port blocking earlier in the load
bfulgham@apple.com [Sat, 17 Apr 2021 03:22:00 +0000 (03:22 +0000)]
Perform port blocking earlier in the load
https://bugs.webkit.org/show_bug.cgi?id=224525
<rdar://problem/75440591>

Reviewed by Darin Adler.

Source/WebCore:

WebKit blocks loads to URLs with any of the prohibited ports defined in
the engine. This blocking happens late in the load process, allowing
connections to be made (and observed). Instead, we should stop the load
early, at the same time we perform other checks.

Test: http/tests/security/form-blocked-port.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isSafeToLoadURL): Add a check for prohibited ports,
and block (with relevant logging) if a load to a denied port is attempted.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest): Ditto.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadFrameRequest): Ditto.
(WebCore::FrameLoader::reportBlockedLoadFailed): Ditto.
* loader/FrameLoader.h:
* loader/PingLoader.cpp:
(WebCore::PingLoader::loadImage): Ditto.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init): Ditto.
* loader/SubframeLoader.cpp:
(WebCore::FrameLoader::SubframeLoader::pluginIsLoadable): Ditto.
(WebCore::FrameLoader::SubframeLoader::loadSubframe): Ditto.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::canRequest): Ditto.
(WebCore::CachedResourceLoader::canRequestAfterRedirection const): Ditto.

Tools:

Update URLScheme test to use a non-prohibited port for the test. Tests of
failed fetches are already handled in WPT and other tests, so using a valid
port here should continue to be a valid test.

* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:
(-[FrameSchemeHandler webView:startURLSchemeTask:]): Use allowed port or the test
instead of 123.

LayoutTests:

WebKit blocks loads to URLs with any of the prohibited ports defined in
the engine. This blocking happens late in the load process, allowing
connections to be made (and observed). Instead, we should stop the load
early, at the same time we perform other checks.

Note: The fact that we now block loads earlier means that we do not fire
'willSendRequestForFrame' for blocked ports, so WebKitTestRunner no longer
outputs a message to stdout. Those errors are reported in the JS console,
but since some test paths are specified to always output JS console messages
to stderrr (for example the WPT tests), we have to revise out test expectations
for a few cases.

* fast/loader/cancel-load-during-port-block-timer.html: Revised expectation to reflect new console error message.
* http/tests/cache/cancel-during-failure-crash-expected.txt: Ditto.
* http/tests/preload/download_resources_from_invalid_headers-expected.txt: Update to reflect a preflight is not executed
  for a blocked port.
* http/tests/preload/resources/nph-invalid_resources_from_header.pl: Update to reflect that we do not preload
  from restricted ports.
* http/tests/security/blocked-on-redirect-expected.txt: Revised expectation to match revised error message.
* http/tests/security/form-blocked-port.html: Added.
* http/tests/security/form-blocked-port-expected.txt: Added.
* http/tests/xmlhttprequest/cross-origin-redirect-responseURL-expected.txt: Revised expectation for revised error message.
* http/tests/xmlhttprequest/redirect-cross-origin-2-expected.txt: Ditto.
* http/tests/xmlhttprequest/redirect-cross-origin-expected.txt: Ditto.
* http/tests/xmlhttprequest/simple-cross-origin-denied-events.html: Instead of using a port WebKit blocks (7), use one that
  is not blocked but is unlikely to be active (as originally intended). This retains the expected test behavior since we now
  block loads to restricted ports earlier in the load process.
* http/tests/xmlhttprequest/simple-cross-origin-denied-events-post.html: Ditto.
* http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Update test output to reflect that we
  are attempting to load from port 8 instead of port 7.
* http/wpt/beacon/beacon-async-error-logging-expected.txt: Ditto.
* http/wpt/beacon/beacon-async-error-logging.html: Update to reflect a preflight is not executed
  for a blocked port.
* imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt: Since we block before executing the load,
  TestRunner no longer outputs an error message to stdout. Instead, they appear in stderr (since all 'wpt' tests are marked
  to dump console.log output to stderr).
* imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt: Ditto.
* platform/mac-wk1/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt: Revise to reflect change in console
  logging (the functional test results are identical).
* platform/mac-wk1/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Ditto.
* platform/win/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt: Ditto.
* platform/win/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Ditto.
* platform/wk2/http/tests/security/blocked-on-redirect-expected.txt: Ditto.

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

14 months agoUse WebKit macro to detect 64bit in RenderLayerBacking.h
basuke.suzuki@sony.com [Sat, 17 Apr 2021 03:12:46 +0000 (03:12 +0000)]
Use WebKit macro to detect 64bit in RenderLayerBacking.h
https://bugs.webkit.org/show_bug.cgi?id=224707

Reviewed by Yusuke Suzuki.

There's no definition of __WORDSIZE in some environment. Also there's WebKit macro for that.

> warning: '__WORDSIZE' is not defined, evaluates to 0 [-Wundef]
> #if __WORDSIZE == 64 && PLATFORM(COCOA)
>     ^

No test because it's compiler behavior.

* rendering/RenderLayerBacking.h:

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

14 months agoDeploy Ref/RefPtr in Editor
rniwa@webkit.org [Sat, 17 Apr 2021 02:32:54 +0000 (02:32 +0000)]
Deploy Ref/RefPtr in Editor
https://bugs.webkit.org/show_bug.cgi?id=224708

Reviewed by Wenson Hsieh.

Source/WebCore:

Deployed smart pointers in WebCore::Editor.

Also deployed ScriptDisallowedScope around the code which accesses the render tree.

* dom/Position.cpp:
(WebCore::Position::containerOrParentElement const): Added.
* dom/Position.h:
* editing/Editor.cpp:
(WebCore::Editor::selectionForCommand):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::Editor::shouldInsertFragment):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::respondToChangedContents):
(WebCore::Editor::hasBidiSelection const):
(WebCore::Editor::selectionUnorderedListState const):
(WebCore::Editor::selectionOrderedListState const):
(WebCore::Editor::findEventTargetFrom const):
(WebCore::Editor::findEventTargetFromSelection const):
(WebCore::notifyTextFromControls):
(WebCore::Editor::willApplyEditing const):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::insertTextWithoutSendingTextEvent):
(WebCore::Editor::performCutOrCopy):
(WebCore::Editor::simplifyMarkup): Replaced the manual tree traversal by treeOrder(~).
(WebCore::Editor::copyImage):
(WebCore::Editor::setBaseWritingDirection):
(WebCore::Editor::baseWritingDirectionForSelectionStart const):
(WebCore::Editor::setComposition):
(WebCore::Editor::advanceToNextMisspelling):
(WebCore::Editor::markMisspellingsAfterTypingToWord): Use containerOrParentElement.
(WebCore::Editor::isSpellCheckingEnabledFor const):
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
(WebCore::Editor::markAndReplaceFor):
(WebCore::scanForTelephoneNumbers):
(WebCore::Editor::scanSelectionForTelephoneNumbers): Restrucuted the code with makeScopeExit
to exit early instead of nesting if's.
(WebCore::findFirstMarkable):
(WebCore::Editor::selectionStartHasMarkerFor const):
(WebCore::Editor::resolveTextCheckingTypeMask):
(WebCore::Editor::stringForCandidateRequest const):
(WebCore::Editor::fontAttributesAtSelectionStart):
(WebCore::Editor::promisedAttachmentInfo):
(WebCore::Editor::styleForSelectionStart):
(WebCore::Editor::fontForSelection):
* editing/Editor.h:
* page/DragController.cpp:
(WebCore::DragController::dispatchTextInputEventFor):

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestAutocorrectionData):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::fontAtSelection):

Source/WebKitLegacy/mac:

* WebView/WebFrame.mm:
(-[WebFrame fontForSelection:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateFontPanel]):
* WebView/WebView.mm:
(-[WebView updateTextTouchBar]):

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

14 months agoMetal-ANGLE: Shared memory texture tests failing in iOS Simulator
commit-queue@webkit.org [Sat, 17 Apr 2021 02:06:15 +0000 (02:06 +0000)]
Metal-ANGLE: Shared memory texture tests failing in iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=222685

Patch by Kyle Piddington <kpiddington@apple.com> on 2021-04-16
Reviewed by Dean Jackson.

Simulator-only path drives filling textures via Blit encoders instead of mapped memory.
This workaround fixes dropped texture writes when using replaceRegion

* src/libANGLE/renderer/metal/TextureMtl.mm:
* src/libANGLE/renderer/metal/mtl_utils.mm:
(rx::mtl::InitializeTextureContents):

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

14 months agoRemoteAudioDestinationProxy should not launch / relaunch the GPUProcess unless it...
cdumez@apple.com [Sat, 17 Apr 2021 01:30:19 +0000 (01:30 +0000)]
RemoteAudioDestinationProxy should not launch / relaunch the GPUProcess unless it is actually rendering
https://bugs.webkit.org/show_bug.cgi?id=224691

Reviewed by Geoffrey Garen.

Source/WebKit:

RemoteAudioDestinationProxy was initiating a connection to the GPUProcess in its constructor and
re-initiating the connection right away upon GPUProcess crash. This goes against our recent efforts
to run the GPUProcess only when it is actually needed. The RemoteAudioDestinationProxy really only
needs the GPUProcess when it is actually rendering / playing.

* GPUProcess/media/RemoteAudioDestinationManager.cpp:
(WebKit::RemoteAudioDestinationManager::allowsExitUnderMemoryPressure const):
Allow the GPUProcess to exit when under memory pressure even if it has AudioDestinations, as long
as they are not playing.

* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy):
(WebKit::RemoteAudioDestinationProxy::ensureGPUProcessConnection):
(WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy):
(WebKit::RemoteAudioDestinationProxy::startRendering):
(WebKit::RemoteAudioDestinationProxy::stopRendering):
(WebKit::RemoteAudioDestinationProxy::storageChanged):
(WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.h:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/audio-context-playing.html:

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

14 months ago[GPUProcess] Crash under RemoteAudioDestination::render()
cdumez@apple.com [Sat, 17 Apr 2021 01:24:04 +0000 (01:24 +0000)]
[GPUProcess] Crash under RemoteAudioDestination::render()
https://bugs.webkit.org/show_bug.cgi?id=224688
<rdar://76643365>

Reviewed by Eric Carlson.

Source/WebKit:

When the connection between the GPUProcess and the WebProcess was severed,
GPUConnectionToWebProcess::didClose() would get called and end up destroying
the RemoteAudioDestination object on the main thread. The issue is that the
RemoteAudioDestination may be playing at the time and we would end up
destroying the RemoteAudioDestination object without stopping rendering
first. As a result, we would crash on the background thread in the
RemoteAudioDestination::render() function, trying to use the m_ringBuffer
data member that got destroyed on the main thread.

To address this, I updated the RemoteAudioDestination destructor so that it
stops rendering if necessary. AudioOutputUnitStop() is synchronous so this
ensures render() is done running on the background thread (and won't be
called again) before proceeding with the destruction of the data members.

Test: webaudio/AudioContext/audiocontext-destruction-crash.html

* GPUProcess/media/RemoteAudioDestinationManager.cpp:
Updated the class to stop subclassing ThreadSafeRefCounted. This class does
not need RefCounting at all. I updated the call site to use UniqueRef<>.

(WebKit::RemoteAudioDestination::create): Deleted.
Drop this factory function and made the constructor public now that we no longer
subclass ThreadSafeRefCounted and use makeUniqueRef<>() at the call site.

(WebKit::RemoteAudioDestination::scheduleGracefulShutdownIfNeeded): Deleted.
Stop this function now that the destructor takes care of shutting down gracefully.

(WebKit::RemoteAudioDestination::RemoteAudioDestination):
Made the constructor public.

(WebKit::RemoteAudioDestination::render):
- Stop checking m_protectThisDuringGracefulShutdown on the background thread. This data
  member is not needed since stop() is synchronous. It was also not thread-safe since
  m_protectThisDuringGracefulShutdown was set on the main thread and we are on the
  audio thread here.
- Similarly, drop the check for m_isPlaying. m_isPlaying is not atomic so the check
  was not thread safe. Even if m_isPlaying was atomic, m_isPlaying get set to true
  *after* calling m_audioOutputUnitAdaptor.start() so render() may early return
  even though we were playing. Also, this check is not needed since we set
  m_isPlaying to false after calling m_audioOutputUnitAdaptor.stop() and the stop()
  call is synchronous and should not return until the audio thread stopped rendering.

* GPUProcess/media/RemoteAudioDestinationManager.h:

LayoutTests:

Add layout test that can flakily reproduce the issue.

* webaudio/AudioContext/audiocontext-destruction-crash-expected.txt: Added.
* webaudio/AudioContext/audiocontext-destruction-crash.html: Added.

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

14 months agofont-size with viewport units in calc() doesn't change when viewport resizes
darin@apple.com [Sat, 17 Apr 2021 01:08:45 +0000 (01:08 +0000)]
font-size with viewport units in calc() doesn't change when viewport resizes
https://bugs.webkit.org/show_bug.cgi?id=224614

Reviewed by Zalan Bujtas.

Source/WebCore:

* css/CSSToLengthConversionData.cpp:
(WebCore::CSSToLengthConversionData::zoom const): Updated since m_zoom is now optional.
We use effectiveZoom when m_zoom is not specified, which is the same semantic that was
implemented before with a separate boolean.
(WebCore::CSSToLengthConversionData::viewportWidthFactor const): When calling the
setHasViewportUnits function as a side effect, use m_viewportDependencyDetectionStyle,
rather than always using m_style. This lets us handle the font-size case correctly.
Also removed the explicit computingFontSize check for the same reason.
(WebCore::CSSToLengthConversionData::viewportHeightFactor const): Ditto.
(WebCore::CSSToLengthConversionData::viewportMinFactor const): Ditto.
(WebCore::CSSToLengthConversionData::viewportMaxFactor const): Ditto.

* css/CSSToLengthConversionData.h: Added a new member, m_viewportDependencyDetectionStyle,
which defaults to the same value as m_style. Also changed m_zoom to use Optional instead
of a separate boolean and an ignored "must be 1.0" value. Initialized data members in
the modern way, allowing us to use the default constructor.

* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueFontSize): Pass in the builder's style as the
viewportDependencyDetectionStyle. This does the same thing that the existing code to
call setHasViewportUnits did directly, but does it even for more complex cases involving
calc(). Also made the isLength and isCalculatedPercentageWithLength cases more similar
to each other and left a FIXME behind about taking that a bit further, but doing that
probably requires creating some more test cases.

LayoutTests:

* css3/viewport-percentage-lengths/viewport-percentage-lengths-resize-expected.txt:
* css3/viewport-percentage-lengths/viewport-percentage-lengths-resize.html:
Added tests that involve calc, and broke rules up into multiple elements so that side
effects from one style won't give us false negatives. This now has a subtest that was
failing without the fix in this patch.

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

14 months agoNullptr deref in CompositeEditCommand::isRemovableBlock in DeleteSelectionCommand...
commit-queue@webkit.org [Sat, 17 Apr 2021 00:57:21 +0000 (00:57 +0000)]
Nullptr deref in CompositeEditCommand::isRemovableBlock in DeleteSelectionCommand::removeRedundantBlocks
https://bugs.webkit.org/show_bug.cgi?id=224518

Patch by Ian Gilbert <iang@apple.com> on 2021-04-16
Reviewed by Ryosuke Niwa.

Source/WebCore:

Add null check in case node is removed while iterating over tree.

Test: editing/execCommand/remove-node-during-command-crash.html

* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeRedundantBlocks):

LayoutTests:

Add a regression test.

* editing/execCommand/remove-node-during-command-crash-expected.txt: Added.
* editing/execCommand/remove-node-during-command-crash.html: Added.

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

14 months agoThe RemoteRemoteCommandListener destructor should never (re-)launch the GPUProcess
cdumez@apple.com [Sat, 17 Apr 2021 00:38:02 +0000 (00:38 +0000)]
The RemoteRemoteCommandListener destructor should never (re-)launch the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=224701

Reviewed by Eric Carlson.

The RemoteRemoteCommandListener destructor should never (re-)launch the GPUProcess,
just to unregister itself. If the GPUProcess is not running, then the
RemoteRemoteCommandListener is not registered.

* WebProcess/GPU/media/RemoteRemoteCommandListener.cpp:
(WebKit::RemoteRemoteCommandListener::~RemoteRemoteCommandListener):
(WebKit::RemoteRemoteCommandListener::gpuProcessConnectionDidClose):

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

14 months agoPass credential name to the WebAuthn UI during registration
jiewen_tan@apple.com [Sat, 17 Apr 2021 00:14:03 +0000 (00:14 +0000)]
Pass credential name to the WebAuthn UI during registration
https://bugs.webkit.org/show_bug.cgi?id=224697
<rdar://75803352>

Reviewed by Brent Fulgham.

Source/WebKit:

Covered by new test contents within existing test files.

* Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
Paperwork for the new SPI.

* UIProcess/API/APIWebAuthenticationPanel.cpp:
(API::WebAuthenticationPanel::create):
(API::WebAuthenticationPanel::WebAuthenticationPanel):
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel userName]):
Adds a new userName property.

* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::getUserName):
(WebKit::AuthenticatorManager::runPanel):
(WebKit::AuthenticatorManager::runPresenter):
Passes the userName to the UI.

* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm:
Paperwork for the new SPI.

* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm:
(WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator):
Passes the userName to the new SPI.

Tools:

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

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

14 months agoPlace vertical scrollbars at (inline/block)-end edge in all writing modes.
heycam@apple.com [Fri, 16 Apr 2021 23:55:14 +0000 (23:55 +0000)]
Place vertical scrollbars at (inline/block)-end edge in all writing modes.
https://bugs.webkit.org/show_bug.cgi?id=224224

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-scroll-snap/snap-inline-block-expected.txt:
* web-platform-tests/css/cssom-view/scrollLeftTop-expected.txt:

Source/WebCore:

Tests: fast/scrolling/v-rl-scrollbars-initial-position-dynamic.html
       fast/scrolling/v-rl-scrollbars-initial-position.html
       fast/scrolling/vertical-scrollbar-position.html

We currently only consider moving a vertical scrollbar to the left for
`writing-mode: horizontal-{tb,bt}; direction: rtl` containers. But
ideally we should always place the vertical scrollbar at the end edge
of the container (whether that's the inline-end edge, when using a
horizontal writing mode, or the block-end edge, when using a vertical
writing mode).

Some functions calling the existing shouldPlaceBlockDirectionScrollbarOnLeft
instead really care about whether the vertical scrollbar is on the
left, not whether the block direction scrollbar is on the left (since
for vertical writing modes, the block direction scrollbar is the
horizontal one on the bottom). So we rename this to
shouldPlaceVerticalScrollbarOnLeft, make it return true for
`writing-mode: vertical-rl`, and adjust callers that really do care
only about block direction scrollbars to additionally check their
writing mode.

* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
* page/FrameView.cpp:
(WebCore::FrameView::shouldPlaceVerticalScrollbarOnLeft const):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin const):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::scrollCornerRect const):
(WebCore::ScrollView::locationOfContents const):
* platform/ScrollableArea.h:
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::paint):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::widgetTypeForScrollbar):
(WebCore::ScrollbarThemeGtk::paint):
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::didCreateScrollerImp):
* platform/win/PopupMenuWin.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::logicalLeftOffsetForContent const):
(WebCore::RenderBlock::logicalRightOffsetForContent const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paddingBoxRect const):
(WebCore::RenderBox::contentBoxLocation const):
(WebCore::RenderBox::overflowClipRect const):
(WebCore::RenderBox::computePositionedLogicalWidth const):
(WebCore::RenderBox::flippedClientBoxRect const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::constrainingRectForStickyPosition const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::resize):
(WebCore::RenderLayer::overflowControlsRects const):
(WebCore::RenderLayer::offsetFromResizeCorner const):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::positionForClipLayer const):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::shouldPlaceVerticalScrollbarOnLeft const):
* rendering/RenderLayerModelObject.h:
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::shouldPlaceVerticalScrollbarOnLeft const):
(WebCore::RenderLayerScrollableArea::overflowControlsRects const):
(WebCore::RenderLayerScrollableArea::computeScrollOrigin):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterLayout):
(WebCore::RenderLayerScrollableArea::drawPlatformResizerImage):
(WebCore::RenderLayerScrollableArea::hitTestResizerInFragments const):
(WebCore::RenderLayerScrollableArea::updateScrollbarsAfterStyleChange):
* rendering/RenderLayerScrollableArea.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::itemBoundingBoxRect):
(WebCore::RenderListBox::paintScrollbar):
(WebCore::RenderListBox::isPointInOverflowControl):
(WebCore::RenderListBox::listIndexAtOffset):
(WebCore::RenderListBox::invalidateScrollbarRect):
(WebCore::RenderListBox::convertFromScrollbarToContainingView const):
(WebCore::RenderListBox::convertFromContainingViewToScrollbar const):
* rendering/RenderListBox.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::repaintViewRectangle const):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::shouldPlaceVerticalScrollbarOnLeft const):
* rendering/style/RenderStyle.h:

Source/WebKit:

* UIProcess/win/WebPopupMenuProxyWin.h:
* WebProcess/Plugins/PDF/PDFPlugin.h:

LayoutTests:

iOS test failure expectations and skips are because we don't support
non-overlay scrollbars on the left on that platform.

* TestExpectations:
* css3/flexbox/child-overflow-expected.html:
* fast/repaint/vertical-overflow-parent-expected.txt:
* fast/repaint/vertical-overflow-same-expected.txt:
* fast/scrolling/v-rl-scrollbars-initial-position-dynamic-expected.html: Added.
* fast/scrolling/v-rl-scrollbars-initial-position-dynamic.html: Added.
* fast/scrolling/v-rl-scrollbars-initial-position-expected.html: Added.
* fast/scrolling/v-rl-scrollbars-initial-position.html: Added.
* fast/scrolling/vertical-scrollbar-position-expected.txt: Added.
* fast/scrolling/vertical-scrollbar-position.html: Added.
* platform/ios/TestExpectations:
* platform/ios/imported/w3c/web-platform-tests/css/css-scroll-snap/snap-inline-block-expected.txt: Added.
* platform/ios/imported/w3c/web-platform-tests/css/cssom-view/scrollLeftTop-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollLeftTop-expected.txt.

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

14 months ago[macOS] Refactor some webpage translation code
wenson_hsieh@apple.com [Fri, 16 Apr 2021 23:53:19 +0000 (23:53 +0000)]
[macOS] Refactor some webpage translation code
https://bugs.webkit.org/show_bug.cgi?id=224680
Work towards <rdar://75641882>

Reviewed by Tim Horton.

Source/WebCore:

In preparation for fixing https://webkit.org/b/224683, refactor some codepaths for handling webpage translation
via the context menu on macOS, in WebKit2.

Currently, the context menu action for `ContextMenuItemTagTranslate` is fully handled in the client layer in
WebKit2, using state in `m_activeContextMenuContextData`. However, to make this action work in WebKitLegacy as
well, we need the ability to call back into the `ContextMenuController` to handle the action, since context menu
actions in WebKitLegacy only target the shared `WebMenuTarget` instance, which only knows about the context menu
controller rather than the `WebHTMLView` that vended the menu item.

Instead of adding logic in `WebMenuTarget` to dig the `WebHTMLView` corresponding to the focused frame out of
the context menu controller, it makes more sense to plumb this call through the (already-established)
`ContextMenuClient`. While this has the disadvantage of requiring an extra IPC hop on the WebKit2 case, it also
has the advantage that we can lazily compute the selection bounds and menu location in root view coordinates
only if the user has selected this menu action, which makes context menu data (slightly) cheaper to compute.

No change in behavior.

* loader/EmptyClients.cpp:
* page/ContextMenuClient.h:
* page/ContextMenuContext.h:
(WebCore::ContextMenuContext::setSelectionBounds): Deleted.
(WebCore::ContextMenuContext::selectionBounds const): Deleted.

Remove code for computing and setting selection bounds. This was only added in support of webpage translation;
instead of computing this up front, we can instead send this information only when the action is invoked.

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):

Move logic for computing the selection bounds and menu location in root view coordinates out of `populate` and
into `contextMenuItemSelected`, only in the case where the action is `ContextMenuItemTagTranslate`.

(WebCore::ContextMenuController::populate):

Source/WebKit:

See WebCore ChangeLog for more details.

* Shared/ContextMenuContextData.cpp:
(WebKit::ContextMenuContextData::ContextMenuContextData):
(WebKit::ContextMenuContextData::encode const):
(WebKit::ContextMenuContextData::decode):
* Shared/ContextMenuContextData.h:

Remove `selectionBounds`. We don't need this anymore, because we'll instead compute the selection bounds only
when the Translate menu item is selected, instead of relying on `m_activeContextMenuContextData` being up to
date.

(WebKit::ContextMenuContextData::selectedText const):
(WebKit::ContextMenuContextData::selectionBounds const): Deleted.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::handleContextMenuTranslation):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebContextMenuClient.h:
* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::handleTranslation):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::handleContextMenuTranslation):
* WebProcess/WebPage/WebPage.h:

Source/WebKitLegacy/mac:

See WebCore ChangeLog for more details.

* WebCoreSupport/WebContextMenuClient.h:
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::handleTranslation):
* WebView/WebView.mm:
(-[WebView _handleContextMenuTranslation:selectionBounds:menuLocation:]):

Add an empty stub with a `FIXME` for the time being.

* WebView/WebViewInternal.h:

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

14 months agoAllow using the platform authenticator on non-Touch ID Macs according to Internal...
jiewen_tan@apple.com [Fri, 16 Apr 2021 23:52:30 +0000 (23:52 +0000)]
Allow using the platform authenticator on non-Touch ID Macs according to Internal requirements
https://bugs.webkit.org/show_bug.cgi?id=224639
<rdar://74698346>

Reviewed by Daniel Bates.

Source/WebCore:

Covered by new tests within existing test files.

* testing/MockWebAuthenticationConfiguration.h:
* testing/MockWebAuthenticationConfiguration.idl:
Mock testing support.

Source/WebKit:

* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
(WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
(WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
Don't set the UserVerification bit if UserVerification is not done.

* UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::verifyUser):
Only check UserPresence on non-Touch ID Macs.

* UIProcess/WebAuthentication/Cocoa/LocalService.mm:
(WebKit::LocalService::isAvailable):
Make the platform authenticator available according to Internal requirements.

* UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
(WebKit::MockLocalConnection::verifyUser):
Mock testing support.

* UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:
(WebKit::getUserVerificationRequirement):
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
Add a helper for extracting the UserVerification input.

LayoutTests:

* http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-success-local.https.html:
* http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt:
* http/wpt/webauthn/public-key-credential-get-success-local.https.html:

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

14 months ago[ macOS Wk2 ] media/media-fragments/TC0051.html is flakey crashing
jenner@apple.com [Fri, 16 Apr 2021 23:15:32 +0000 (23:15 +0000)]
[ macOS Wk2 ] media/media-fragments/TC0051.html is flakey crashing
https://bugs.webkit.org/show_bug.cgi?id=222277

Uneviewed test gardening.

* platform/mac-wk2/TestExpectations: Removing skip expectation to verify fix.

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

14 months ago[GPUP] WebContent process should not create AVOutputContext instances when media...
peng.liu6@apple.com [Fri, 16 Apr 2021 22:54:15 +0000 (22:54 +0000)]
[GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled
https://bugs.webkit.org/show_bug.cgi?id=224469

Reviewed by Eric Carlson.

Source/WebCore:

This patch modifies `MediaPlaybackTargetContext` to provide interfaces to serialize/deserialize
`AVOutputContext` and modifies `MediaPlaybackTargetCocoa` to use `MediaPlaybackTargetContext` to
manage its `AVOutputContext` instead of keeping a pointer to the `AVOutputContext` object.
With these changes, a WebContent process can forward a serialized `AVOutputContext` object
to other processes (e.g., the GPU process) without deserializing it. Therefore, the WebContent
process does not need access to the CoreMedia routing service. So we can remove the fix (r275669)
for bug 224328.

Covered by existing tests.

* Modules/airplay/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
* Modules/airplay/WebMediaSessionManager.h:

* Headers.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
Modify the project file because `MediaPlaybackTargetContext` is used in Cocoa ports only.

* page/ChromeClient.h:
(WebCore::ChromeClient::setMockMediaPlaybackTargetPickerState):
* page/Page.cpp:
(WebCore::Page::setMockMediaPlaybackTargetPickerState):
* page/Page.h:

* platform/graphics/MediaPlaybackTarget.h:
(WebCore::MediaPlaybackTarget::hasActiveRoute const):
(WebCore::MediaPlaybackTarget::deviceName const):
(WebCore::MediaPlaybackTarget::supportsRemoteVideoPlayback):
(): Deleted.
* platform/graphics/MediaPlaybackTargetContext.h: Removed.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h:
(WebCore::MediaPlaybackTargetCocoa::outputContext const): Deleted.
* platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm:
(WebCore::MediaPlaybackTargetCocoa::create):
(WebCore::MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa):
(WebCore::toMediaPlaybackTargetCocoa):
(WebCore::MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::targetContext const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::hasActiveRoute const): Deleted.
(WebCore::MediaPlaybackTargetCocoa::deviceName const): Deleted.
Don't directly use `AVOutputContext` in this class.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):

* platform/graphics/cocoa/MediaPlaybackTargetContext.h: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::type const):
(WebCore::MediaPlaybackTargetContext::mockState const):
(WebCore::MediaPlaybackTargetContext::outputContext const):
(WebCore::MediaPlaybackTargetContext::serializedOutputContext const):
(WebCore::MediaPlaybackTargetContext::encodingRequiresPlatformData const):
* platform/graphics/cocoa/MediaPlaybackTargetContext.mm: Added.
(WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext):
(WebCore::MediaPlaybackTargetContext::deviceName const):
(WebCore::MediaPlaybackTargetContext::hasActiveRoute const):
(WebCore::MediaPlaybackTargetContext::supportsRemoteVideoPlayback const):
(WebCore::MediaPlaybackTargetContext::serializeOutputContext):
(WebCore::MediaPlaybackTargetContext::deserializeOutputContext):

* platform/mock/MediaPlaybackTargetMock.cpp:
(WebCore::MediaPlaybackTargetMock::create):
(WebCore::MediaPlaybackTargetMock::MediaPlaybackTargetMock):
(WebCore::toMediaPlaybackTargetMock):
(WebCore::MediaPlaybackTargetMock::targetContext const): Deleted.
* platform/mock/MediaPlaybackTargetMock.h:
(WebCore::MediaPlaybackTargetMock::state const):
* platform/mock/MediaPlaybackTargetPickerMock.cpp:
(WebCore::MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable):
(WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::invalidatePlaybackTargets):
(WebCore::MediaPlaybackTargetPickerMock::setState):
* platform/mock/MediaPlaybackTargetPickerMock.h:

* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMockMediaPlaybackTargetPickerState):

Source/WebKit:

* Scripts/webkit/messages.py: Fix clean build failures on the WinCairo port.

* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget):
* GPUProcess/media/RemoteMediaPlayerProxy.h:

* GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
(WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange):

* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::encode):
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Deleted.

* UIProcess/WebPageProxy.cpp:
(WebKit::mediaRelatedIOKitClasses):
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
(WebKit::WebPageProxy::setPlaybackTarget):
(WebKit::temporaryMachServices): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange):

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setMockMediaPlaybackTargetPickerState):
* WebProcess/WebCoreSupport/WebChromeClient.h:

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::playbackTargetSelected const):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::setMockMediaPlaybackTargetPickerState):
* WebView/WebMediaPlaybackTargetPicker.h:
* WebView/WebMediaPlaybackTargetPicker.mm:
(WebMediaPlaybackTargetPicker::setMockMediaPlaybackTargetPickerState):
* WebView/WebView.mm:
(-[WebView _setMockMediaPlaybackTargetPickerName:state:]):
* WebView/WebViewInternal.h:

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

14 months agoDisable app-bound request API tests on specific OS versions
katherine_cheney@apple.com [Fri, 16 Apr 2021 22:50:31 +0000 (22:50 +0000)]
Disable app-bound request API tests on specific OS versions
https://bugs.webkit.org/show_bug.cgi?id=223692
<rdar://problem/75787288>

Reviewed by Brent Fulgham.

Source/WTF:

* wtf/PlatformEnableCocoa.h:

Tools:

These test rely on internal additions only available on certain OS
versions. We should disable them on other versions.

* TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:

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

14 months agoN[ BigSur Release wk2 ARM64 ] inspector/console/console-oom.html is a flakey crash
jenner@apple.com [Fri, 16 Apr 2021 22:16:21 +0000 (22:16 +0000)]
N[ BigSur Release wk2 ARM64 ] inspector/console/console-oom.html is a flakey crash
https://bugs.webkit.org/show_bug.cgi?id=224698

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations: Updating expectations to Pass Crash for BigSur Release arm64 only.

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

14 months ago[ BigSur wk2 ARM64 ] http/wpt/webrtc/change-encoded-transform.html is a flakey crash
jenner@apple.com [Fri, 16 Apr 2021 21:55:59 +0000 (21:55 +0000)]
[ BigSur wk2 ARM64 ] http/wpt/webrtc/change-encoded-transform.html is a flakey crash
https://bugs.webkit.org/show_bug.cgi?id=224696

Unreviewed test gardneing.

* platform/mac-wk2/TestExpectations: Updating test expectations to Pass Crash while test is reviewed.

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

14 months agoWeb Inspector: REGRESSION(?): Graphics: dropping a recording leaves behind a drop...
drousso@apple.com [Fri, 16 Apr 2021 21:22:00 +0000 (21:22 +0000)]
Web Inspector: REGRESSION(?): Graphics: dropping a recording leaves behind a drop zone view
https://bugs.webkit.org/show_bug.cgi?id=224648

Reviewed by BJ Burg.

* UserInterface/Views/GraphicsTabContentView.js:
(WI.GraphicsTabContentView.prototype.initialLayout):
It appears that it's possible for re-entrancy issues in the `WI.View` system since the
`_didInitialLayout` flag isn't set until _after_ `initialLayout` returns, meaning that if
the logic inside `initialLayout` triggers a synchronous `layout` then that second `layout`
won't know that it's already in the middle of an `initialLayout`. In this case, showing the
`WI.GraphicsOverviewContentView` causes the navigation sidebar to be shown, which forces a
synchronous `layout` from handling `WI.Sidebar.Event.WidthDidChange`. For now, there's no
"rush" to show the `WI.GraphicsOverviewContentView` so we delay it by one event loop turn.

* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView.prototype.initialLayout):
(WI.CanvasContentView.prototype.dropZoneShouldAppearForDragEvent): Deleted.
(WI.CanvasContentView.prototype.dropZoneHandleDrop): Deleted.
There's no reason to have another `WI.DropZoneView` here since there's already one that
covers the entire tab.

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

14 months agoRemove redundant renderObject in BreakingContext::handleText
zalan@apple.com [Fri, 16 Apr 2021 21:13:11 +0000 (21:13 +0000)]
Remove redundant renderObject in BreakingContext::handleText
https://bugs.webkit.org/show_bug.cgi?id=224682

Reviewed by Darin Adler.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleText):

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

14 months ago[ macOS wk2 ]compositing/video/video-border-radius-clipping.html is a flakey image...
jenner@apple.com [Fri, 16 Apr 2021 21:12:53 +0000 (21:12 +0000)]
[ macOS wk2 ]compositing/video/video-border-radius-clipping.html is a flakey image failure
https://bugs.webkit.org/show_bug.cgi?id=224690

Unreviewed test gardneing.

* platform/mac-wk2/TestExpectations: Updating test expectations to include Debug.

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

14 months ago[PlayStation][OpenSSL] Remove warnings.
basuke.suzuki@sony.com [Fri, 16 Apr 2021 21:07:29 +0000 (21:07 +0000)]
[PlayStation][OpenSSL] Remove warnings.
https://bugs.webkit.org/show_bug.cgi?id=224630

Reviewed by Don Olmstead.

There're two kinds of warnings in curl and openssl layer in our platform.

a) Unused param

b) '__WORDSIZE' is not defined.
warning: '__WORDSIZE' is not defined, evaluates to 0 [-Wundef]
#if __WORDSIZE >= 64
^

No new tests because it's only for compilation issue.

* crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
(WebCore::CryptoAlgorithmAES_GCM::encrypt):
(WebCore::CryptoAlgorithmAES_GCM::decrypt):
* crypto/openssl/CryptoKeyECOpenSSL.cpp:
(WebCore::CryptoKeyEC::platformGeneratePair):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformImportPkcs8):
* crypto/openssl/CryptoKeyRSAOpenSSL.cpp:
(WebCore::CryptoKeyRSA::create):
(WebCore::CryptoKeyRSA::generatePair):
(WebCore::CryptoKeyRSA::importSpki):
(WebCore::CryptoKeyRSA::importPkcs8):

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

14 months ago[BigSur wk1] svg/canvas/canvas-global-alpha-svg.html is flakey failing
said@apple.com [Fri, 16 Apr 2021 20:55:48 +0000 (20:55 +0000)]
[BigSur wk1] svg/canvas/canvas-global-alpha-svg.html is flakey failing
https://bugs.webkit.org/show_bug.cgi?id=221559
<rdar://problem/74104075>

Reviewed by Daniel Bates.

By default, aliasing is applied when drawing the SVGImage to the canvas
through CanvasRenderingContext2D::drawImage() and when drawing the canvas
itself to DOM container through ImageBuffer::draw(). Because the test
includes only rectangles, we need to make sure the edges of the SVG image
and the canvas in this test get pixelated. This will match the expected
page which uses DOM objects to mimic the SVG and canvas drawing

Make sure the test is ended only after the SVG image is fully loaded.

* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:
* svg/canvas/canvas-global-alpha-svg.html:

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

14 months agoN[ wk2 ] media/presentationmodechanged-fired-once.html is a flakey timeout
jenner@apple.com [Fri, 16 Apr 2021 20:54:58 +0000 (20:54 +0000)]
N[ wk2 ] media/presentationmodechanged-fired-once.html is a flakey timeout
https://bugs.webkit.org/show_bug.cgi?id=224633

Unreviewed test gardneing.

* platform/ios-simulator-wk2/TestExpectations: Forgot to update expectations for iOS as well.

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

14 months agoDisable ApplicationCache with linkedOnOrAfter check
commit-queue@webkit.org [Fri, 16 Apr 2021 20:41:08 +0000 (20:41 +0000)]
Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629

Patch by Alex Christensen <achristensen@webkit.org> on 2021-04-16
Reviewed by Brady Eidson.

Source/WebCore:

ApplicationCache has been deprecated for two years in WebKit with a message to developers since r227225.

Firefox removed support in https://bugzilla.mozilla.org/show_bug.cgi?id=1619673 which shipped with Firefox 84 on Dec 15, 2020.

Chrome removed support in https://bugs.chromium.org/p/chromium/issues/detail?id=582750 by default in Chrome 85 on August 25, 2020
but they have a reverse origin trial program running right now so that some origins have it working, but they are planning to remove
even that support October 2021.

We have kept it working for a reason related to rdar://38505756, specifically the 4th and 5th comment in that bug.
That reason is now passed.

This patch removes support for new apps but keeps it working for 3rd party apps linked with existing SDKs.  Once those apps update
to a new SDK, they will be unable to use ApplicationCache.  They will need to migrate to use fetch service workers instead.

* platform/cocoa/VersionChecks.h:

Source/WebKit:

* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultOfflineWebApplicationCacheEnabled):
* Shared/WebPreferencesDefaultValues.h:

Source/WTF:

* Scripts/Preferences/WebPreferences.yaml:

Tools:

* TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(TEST):
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):

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

14 months ago[ wk2 ] media/presentationmodechanged-fired-once.html is a flakey timeout
jenner@apple.com [Fri, 16 Apr 2021 20:35:15 +0000 (20:35 +0000)]
[ wk2 ] media/presentationmodechanged-fired-once.html is a flakey timeout
https://bugs.webkit.org/show_bug.cgi?id=224633

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations: Updating test expectations to Pass Timeout while test is reviewed.

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

14 months agoMore changes to support the TerminationException.
mark.lam@apple.com [Fri, 16 Apr 2021 19:59:33 +0000 (19:59 +0000)]
More changes to support the TerminationException.
https://bugs.webkit.org/show_bug.cgi?id=224681
rdar://76698113

Reviewed by Keith Miller.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeProgram):
- ProgramExecutable::initializeGlobalProperties() can throw the TerminationException.
  Add handling for that.

* runtime/JSObject.cpp:
(JSC::JSObject::defineOwnIndexedProperty):
- JSObject::defineOwnIndexedProperty() has a blob of assertion code that it verifying
  that getOwnPropertyDescriptor() should succeed without throwing any exceptions if
  the fast path is allowed.  However, this is assertion is only true if there isn't
  a termination being requested.  So, use the DeferTermination scope to allow this
  assertion to be tested without the complication of a TerminationException.

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

14 months agoAdd WKUIDelegate SPI for starting XR session
commit-queue@webkit.org [Fri, 16 Apr 2021 19:39:03 +0000 (19:39 +0000)]
Add WKUIDelegate SPI for starting XR session
https://bugs.webkit.org/show_bug.cgi?id=224634

Patch by Ada Chan <ada.chan@apple.com> on 2021-04-16
Reviewed by Tim Horton.

* UIProcess/API/APIUIClient.h:
(API::UIClient::startXRSession):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::startXRSession):

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

14 months agoUnreviewed, reverting r273733.
commit-queue@webkit.org [Fri, 16 Apr 2021 19:28:28 +0000 (19:28 +0000)]
Unreviewed, reverting r273733.
https://bugs.webkit.org/show_bug.cgi?id=224686

Broke mouse wheel scrolling speed

Reverted changeset:

"Eliminate ScrollAnimatorGeneric::m_smoothAnimation"
https://bugs.webkit.org/show_bug.cgi?id=222588
https://trac.webkit.org/changeset/273733

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

14 months agoBefore deleting a MarkedBlock we do not need to clear its m_directory pointer.
keith_miller@apple.com [Fri, 16 Apr 2021 19:24:22 +0000 (19:24 +0000)]
Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
https://bugs.webkit.org/show_bug.cgi?id=224677

Reviewed by Yusuke Suzuki.

Right now when we are about to free a MarkedBlock we clear the
m_directory pointer in the MarkedBlock's Handle. This has the
downside, however, of potentially paging in the footer from disk /
the compressor, which some data we have seen shows is happening.
This patch prevents this uncessary store to hopefully reduce the
number of pageins/decompressions caused by Safari web content.

* heap/BlockDirectory.cpp:
(JSC::BlockDirectory::removeBlock):
(JSC::BlockDirectory::removeBlockForDeletion):
* heap/BlockDirectory.h:
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::Handle::~Handle):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::freeBlock):

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

14 months agoReduce maximum HashTable entry size to 128 bytes
commit-queue@webkit.org [Fri, 16 Apr 2021 19:22:56 +0000 (19:22 +0000)]
Reduce maximum HashTable entry size to 128 bytes
https://bugs.webkit.org/show_bug.cgi?id=224381

Patch by Alex Christensen <achristensen@webkit.org> on 2021-04-16
Reviewed by Yusuke Suzuki.

Source/WebCore:

* inspector/agents/InspectorAnimationAgent.cpp:
(WebCore::InspectorAnimationAgent::willApplyKeyframeEffect):
(WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation):
* inspector/agents/InspectorAnimationAgent.h:

Source/WTF:

* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):

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

14 months agoUnreviewed, reverting r275839.
cdumez@apple.com [Fri, 16 Apr 2021 19:20:07 +0000 (19:20 +0000)]
Unreviewed, reverting r275839.

The new release assertion is hitting to easily in client apps

Reverted changeset:

"Make sure AuxiliaryProcessProxy::sendMessage() is called on
the main thread"
https://bugs.webkit.org/show_bug.cgi?id=224448
https://commits.webkit.org/r275839

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

14 months ago[css-counter-styles] Parse and add feature flag for @counter-style
commit-queue@webkit.org [Fri, 16 Apr 2021 19:19:04 +0000 (19:19 +0000)]
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150

Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-16
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

@counter-style and its descriptors are now exposed behind a feature
flag, so pass some tests and fail others for a different reason
because this patch doesn't actually implement descriptor parsing and
setting yet.

* web-platform-tests/css/css-counter-styles/counter-style-additive-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-fallback-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-name-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-range-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/counter-style-system-syntax-expected.txt:
* web-platform-tests/css/css-counter-styles/idlharness-expected.txt:
* web-platform-tests/css/cssom/CSSCounterStyleRule-expected.txt:

Source/WebCore:

Parse @counter-style (without implementing descriptor parsing) behind
a new feature flag, CSSCounterStyleAtRulesEnabled.  A separate feature
flag for @counter-style <image> symbol values has also been added, as
image symbols have extra complexities that we won't want to hold the
entire feature back on.
https://www.w3.org/TR/css-counter-styles-3

The CSSCounterStyleRule IDL interface is also added and implemented,
and similarly feature flagged.
https://www.w3.org/TR/css-counter-styles-3/#apis

Test: webexposed/counter-style-is-not-exposed.html and existing WPTs.

* CMakeLists.txt:
Add CSSCounterStyleRule.idl.

* DerivedSources-input.xcfilelist:
Add CSSCounterStyleRule.idl.

* DerivedSources-output.xcfilelist:
Add JSCSSCounterStyleRule.h and JSCSSCounterStyleRule.cpp.

* DerivedSources.make:
Add CSSCounterStyleRule.idl.

* Sources.txt:
Add CSSCounterStyleRule.cpp and JSCSSCounterStyleRule.cpp.

* WebCore.xcodeproj/project.pbxproj:
Add CounterStyle.h, CounterStyle.cpp, and CounterStyle.idl.

* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
Support CSSCounterStyleRule.

* bindings/js/WebCoreBuiltinNames.h:
Add macro(CSSCounterStyleRule) to generate counter-style built-in
names.

* css/CSSCounterStyleRule.cpp: Added.
(WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle):
(WebCore::StyleRuleCounterStyle::create):
(WebCore::StyleRuleCounterStyle::mutableProperties):
(WebCore::CSSCounterStyleRule::CSSCounterStyleRule):
(WebCore::CSSCounterStyleRule::reattach):
(WebCore::CSSCounterStyleRule::cssText const):

* css/CSSCounterStyleRule.h: Added.
(isType): Add specialized rule.isCounterStyleRule() implementation.

* css/CSSCounterStyleRule.idl: Added.
* css/CSSRule.cpp: Add new StyleRuleType::CounterStyle COMPILE_ASSERT.
* css/CSSRule.h:
Add COUNTER_STYLE_RULE constant.  Also add comment `// WebIDL enum` to
disable enum_casing lint, since these values are named to match IDL
attributes.
* css/CSSRule.idl: Add COUNTER_STYLE_RULE constant behind flag.

* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
Handle newly added StyleRuleType::CounterStyle.

* css/StyleRule.h:
(WebCore::StyleRuleBase::isCounterStyleRule const): Added.

* css/StyleRuleType.h: Add StyleRuleType::CounterStyle

* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
If @counter-style image symbols flag is enabled, do traverse
subresources.

* css/parser/CSSAtRuleID.cpp:
If the @counter-style feature flag is enabled, return newly added
CSSAtRuleCounterStyle ID.

(WebCore::cssAtRuleID):
* css/parser/CSSAtRuleID.h:
Add CSSAtRuleCounterStyle ID.

* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
Add cssCounterStyleAtRulesEnabled and
cssCounterStyleAtRuleImageSymbolsEnabled flags.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.

* css/parser/CSSParserImpl.cpp:
(WebCore::computeNewAllowedRules):
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeCounterStyleRule): Added.
(WebCore::CSSParserImpl::consumeDeclarationList):
(WebCore::CSSParserImpl::consumeDeclaration):
* css/parser/CSSParserImpl.h:
Handle new @counter-style rule.

* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValue): Handle
StyleRuleType::CounterStyle.
(WebCore::consumeCounterContent):
Refactor to use new CSSPropertyParserHelpers::isPredefinedCounterStyle
method.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor):
Add placeholder for future @counter-style descriptor parsing work.

* css/parser/CSSPropertyParser.h:
Add parseCounterStyleDescriptor method

* css/parser/CSSPropertyParserHelpers.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
Add new flag that allows consumed custom ident values to be lowercased
on-parse.  This is necessary for some <counter-style-name> values.
(WebCore::CSSPropertyParserHelpers::isPredefinedCounterStyle): Added.
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleName):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
Parse @counter-style names, both in-prelude names and non-prelude
names (e.g. as part of the `extends` descriptor).

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:
 Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.

Tools:

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
Add `false` defaults for CSSCounterStyleAtRulesEnabled and
CSSCounterStyleAtRuleImageSymbolsEnabled flags.

LayoutTests:

Add tests ensuring @counter-style is not exposed when feature flag is
disabled.

* webexposed/counter-style-is-not-exposed-expected.txt: Added.
* webexposed/counter-style-is-not-exposed.html: Added.

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