WebKit-https.git
5 months agoclang-format: Change SpaceAfterTemplateKeyword to false
Hironori.Fujii@sony.com [Tue, 4 Jan 2022 20:59:30 +0000 (20:59 +0000)]
clang-format: Change SpaceAfterTemplateKeyword to false
https://bugs.webkit.org/show_bug.cgi?id=234655

Reviewed by Don Olmstead.

Bug 183302 added the initial .clang-format file which were
including SpaceAfterTemplateKeyword:true. However, even though it
is undocumented, typical WebKit code is using a style having no
space ater the `template` keyword.

* .clang-format:

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

5 months agoRe-disable WKInspectorExtensionDelegate.ExtensionTabNavigatedCallbacks API test in...
achristensen@apple.com [Tue, 4 Jan 2022 19:21:46 +0000 (19:21 +0000)]
Re-disable WKInspectorExtensionDelegate.ExtensionTabNavigatedCallbacks API test in debug builds
https://bugs.webkit.org/show_bug.cgi?id=232857

I enabled it with an unrelated change and it is timing out, so re-disable it.

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

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

5 months agoPartial revert of https://trac.webkit.org/changeset/287371/webkit
katherine_cheney@apple.com [Tue, 4 Jan 2022 19:14:17 +0000 (19:14 +0000)]
Partial revert of https://trac.webkit.org/changeset/287371/webkit

RS by John Wilander.

Keep logging in for test debugging purposes.

* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::setPrivateClickMeasurementAppBundleIDForTesting):

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

5 months agoMomentum Event Dispatcher: Disable noisy logging
timothy_horton@apple.com [Tue, 4 Jan 2022 19:09:16 +0000 (19:09 +0000)]
Momentum Event Dispatcher: Disable noisy logging
https://bugs.webkit.org/show_bug.cgi?id=234178
<rdar://problem/86228553>

Reviewed by Wenson Hsieh.

* WebProcess/WebPage/MomentumEventDispatcher.h:

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

5 months agoWebAssembly i32.atomic.wait timeout value incorrectly interpreted by factor 1000
ysuzuki@apple.com [Tue, 4 Jan 2022 18:10:42 +0000 (18:10 +0000)]
WebAssembly i32.atomic.wait timeout value incorrectly interpreted by factor 1000
https://bugs.webkit.org/show_bug.cgi?id=234833

Reviewed by Michael Saboff.

Wasm atomics' timeout should be interpreted as nanoseconds.

* wasm/WasmOperations.cpp:
(JSC::Wasm::wait):

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

5 months ago[Cocoa] Hang in AVTrackPrivateAVFObjCImpl::bitrate()
jer.noble@apple.com [Tue, 4 Jan 2022 18:08:51 +0000 (18:08 +0000)]
[Cocoa] Hang in AVTrackPrivateAVFObjCImpl::bitrate()
https://bugs.webkit.org/show_bug.cgi?id=234753

Reviewed by Eric Carlson.

Source/WebCore:

In r286908, WebCore added new queries onto existing AVAssetTrack objects; however, querying
those properties will block if data for those properties is not yet available. The media element
could block moving to the HAVE_METADATA state until those properties are fully loaded, however
this might regress PLT, so instead, we will check the load state of those properties before returning
values.

However, to make the properties exposed through VideoTrackConfiguration.idl/AudioTrackConfiguration.idl
dynamic, changes need to be signaled and propagated upward through the layers between AVAssetTrack and
the DOM. Rather than make individual notifications for each property in a Configuration struct, make one
notification that handles any change to the Configuration struct at all and push that upward to clients.

Since these properties are being grouped together at a lower-level, they do not need to be tracked
individually, and Video/AudioTrackConfigurationInit can just be aliased to a platform-defined struct.

* html/track/AudioTrack.cpp:
(WebCore::AudioTrack::configurationChanged):
(WebCore::AudioTrack::updateConfigurationFromPrivate):
* html/track/AudioTrack.h:
* html/track/AudioTrackConfiguration.h:
(WebCore::AudioTrackConfiguration::setState):
(): Deleted.
* html/track/VideoTrack.cpp:
(WebCore::VideoTrack::configurationChanged):
(WebCore::VideoTrack::updateConfigurationFromPrivate):
* html/track/VideoTrack.h:
* html/track/VideoTrackConfiguration.h:
(WebCore::VideoTrackConfiguration::setState):
(WebCore::VideoTrackConfiguration::colorSpace const):
(WebCore::VideoTrackConfiguration::setColorSpace):
(WebCore::VideoTrackConfiguration::VideoTrackConfiguration):
(): Deleted.
* platform/graphics/AudioTrackPrivate.h:
(WebCore::AudioTrackPrivate::configuration const):
(WebCore::AudioTrackPrivate::setConfiguration):
(WebCore::AudioTrackPrivate::codec const): Deleted.
(WebCore::AudioTrackPrivate::setCodec): Deleted.
(WebCore::AudioTrackPrivate::sampleRate const): Deleted.
(WebCore::AudioTrackPrivate::setSampleRate): Deleted.
(WebCore::AudioTrackPrivate::numberOfChannels const): Deleted.
(WebCore::AudioTrackPrivate::setNumberOfChannels): Deleted.
(WebCore::AudioTrackPrivate::bitrate const): Deleted.
(WebCore::AudioTrackPrivate::setBitrate): Deleted.
* platform/graphics/AudioTrackPrivateClient.h:
* platform/graphics/PlatformVideoColorSpace.h:
(WebCore::operator==):
(WebCore::operator!=):
* platform/graphics/VideoTrackPrivate.h:
(WebCore::VideoTrackPrivate::configuration const):
(WebCore::VideoTrackPrivate::setConfiguration):
(WebCore::VideoTrackPrivate::codec const): Deleted.
(WebCore::VideoTrackPrivate::setCodec): Deleted.
(WebCore::VideoTrackPrivate::width const): Deleted.
(WebCore::VideoTrackPrivate::setWidth): Deleted.
(WebCore::VideoTrackPrivate::height const): Deleted.
(WebCore::VideoTrackPrivate::setHeight): Deleted.
(WebCore::VideoTrackPrivate::colorSpace const): Deleted.
(WebCore::VideoTrackPrivate::setColorSpace): Deleted.
(WebCore::VideoTrackPrivate::framerate const): Deleted.
(WebCore::VideoTrackPrivate::setFramerate): Deleted.
(WebCore::VideoTrackPrivate::bitrate const): Deleted.
(WebCore::VideoTrackPrivate::setBitrate): Deleted.
* platform/graphics/VideoTrackPrivateClient.h:
* platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.h:
(WebCore::AVTrackPrivateAVFObjCImpl::setVideoTrackConfigurationObserver):
(WebCore::AVTrackPrivateAVFObjCImpl::setAudioTrackConfigurationObserver):
* platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
(WebCore::assetTrackConfigurationKeyNames):
(WebCore::AVTrackPrivateAVFObjCImpl::AVTrackPrivateAVFObjCImpl):
(WebCore::AVTrackPrivateAVFObjCImpl::initializeAssetTrack):
(WebCore::AVTrackPrivateAVFObjCImpl::videoTrackConfiguration const):
(WebCore::AVTrackPrivateAVFObjCImpl::audioTrackConfiguration const):
* platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm:
(WebCore::AudioTrackPrivateAVFObjC::AudioTrackPrivateAVFObjC):
(WebCore::AudioTrackPrivateAVFObjC::resetPropertiesFromTrack):
(WebCore::AudioTrackPrivateAVFObjC::audioTrackConfigurationChanged):
* platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp:
(WebCore::VideoTrackPrivateAVFObjC::VideoTrackPrivateAVFObjC):
(WebCore::VideoTrackPrivateAVFObjC::resetPropertiesFromTrack):
(WebCore::VideoTrackPrivateAVFObjC::videoTrackConfigurationChanged):
* platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm:
(WebCore::VideoTrackPrivateMediaSourceAVFObjC::resetPropertiesFromTrack):
* platform/graphics/cocoa/VideoTrackPrivateWebM.cpp:
(WebCore::VideoTrackPrivateWebM::VideoTrackPrivateWebM):
(WebCore::VideoTrackPrivateWebM::updateConfiguration):
* platform/graphics/cocoa/VideoTrackPrivateWebM.h:

Source/WebKit:

Propagate changes to TrackConfigurations upwards from the GPU process -> WebContent process.

* GPUProcess/media/AudioTrackPrivateRemoteConfiguration.h:
(WebKit::AudioTrackPrivateRemoteConfiguration::encode const):
(WebKit::AudioTrackPrivateRemoteConfiguration::decode):
* GPUProcess/media/RemoteAudioTrackProxy.cpp:
(WebKit::RemoteAudioTrackProxy::configuration):
(WebKit::RemoteAudioTrackProxy::configurationChanged):
* GPUProcess/media/RemoteAudioTrackProxy.h:
* GPUProcess/media/RemoteVideoTrackProxy.cpp:
(WebKit::RemoteVideoTrackProxy::configuration):
* GPUProcess/media/RemoteVideoTrackProxy.h:
* GPUProcess/media/TrackPrivateRemoteConfiguration.h:
(WebKit::TrackPrivateRemoteConfiguration::encode const):
(WebKit::TrackPrivateRemoteConfiguration::decode):
* GPUProcess/media/VideoTrackPrivateRemoteConfiguration.h:
(WebKit::VideoTrackPrivateRemoteConfiguration::encode const):
(WebKit::VideoTrackPrivateRemoteConfiguration::decode):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/media/AudioTrackPrivateRemote.cpp:
(WebKit::AudioTrackPrivateRemote::AudioTrackPrivateRemote):
(WebKit::AudioTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/AudioTrackPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack):
(WebKit::MediaPlayerPrivateRemote::remoteAudioTrackConfigurationChanged):
(WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack):
(WebKit::MediaPlayerPrivateRemote::remoteVideoTrackConfigurationChanged):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
* WebProcess/GPU/media/VideoTrackPrivateRemote.cpp:
(WebKit::VideoTrackPrivateRemote::VideoTrackPrivateRemote):
(WebKit::VideoTrackPrivateRemote::updateConfiguration):
* WebProcess/GPU/media/VideoTrackPrivateRemote.h:
(WebKit::VideoTrackPrivateRemote::create):

LayoutTests:

Now that these properties are dynamic, test them with `testExpectedEventually`.

* media/track/audio-track-configuration.html:
* media/track/video-track-alternate-groups-expected.txt:
* media/track/video-track-configuration.html:

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

5 months agoRe-enable URLSchemeHandler.Leaks1 API test
achristensen@apple.com [Tue, 4 Jan 2022 18:05:13 +0000 (18:05 +0000)]
Re-enable URLSchemeHandler.Leaks1 API test
https://bugs.webkit.org/show_bug.cgi?id=234625

Reviewed by Darin Adler.

The test seems to not time out any more.  I think it has been fixed without re-enabling the test.

* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-leaks.mm:
(TEST):

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

5 months ago[Web Animations] changing the timing of a transition such that it's finished should...
graouts@webkit.org [Tue, 4 Jan 2022 16:11:22 +0000 (16:11 +0000)]
[Web Animations] changing the timing of a transition such that it's finished should no longer have it marked as running
https://bugs.webkit.org/show_bug.cgi?id=234823

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progression.

* web-platform-tests/css/css-transitions/CSSTransition-effect.tentative-expected.txt:

Source/WebCore:

Many factors could contribute to an animation entering its finished state. In case it's a transition,
we must remove it from the list of running transitions immediately, so we add a new virtual method when
the finished state is entered such that CSSTransition can implement this method and do the necessary
cleanup.

* animation/CSSTransition.cpp:
(WebCore::CSSTransition::animationDidFinish):
* animation/CSSTransition.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::updateFinishedState):
* animation/WebAnimation.h:
(WebCore::WebAnimation::animationDidFinish):

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

5 months agoUnreviewed, reverting r283546.
commit-queue@webkit.org [Tue, 4 Jan 2022 15:52:54 +0000 (15:52 +0000)]
Unreviewed, reverting r283546.
https://bugs.webkit.org/show_bug.cgi?id=234844

Causes bad scrolling behavior on Discourse pages

Reverted changeset:

"[css-position-sticky] scrollIntoView should not take into
account sticky positioning offsets"
https://bugs.webkit.org/show_bug.cgi?id=230689
https://commits.webkit.org/r283546

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

5 months ago[GTK][a11y] Take into account the active descendant when setting focus related states...
carlosgc@webkit.org [Tue, 4 Jan 2022 15:27:18 +0000 (15:27 +0000)]
[GTK][a11y] Take into account the active descendant when setting focus related states with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=234751

Reviewed by Joanmarie Diggs.

* accessibility/atspi/AccessibilityObjectAtspi.cpp:
(WebCore::AccessibilityObjectAtspi::state const):

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

5 months ago[GTK][a11y] Ensure ATSPI wrappers are destroyed in the main thread
carlosgc@webkit.org [Tue, 4 Jan 2022 15:10:48 +0000 (15:10 +0000)]
[GTK][a11y] Ensure ATSPI wrappers are destroyed in the main thread
https://bugs.webkit.org/show_bug.cgi?id=234808

Reviewed by Joanmarie Diggs.

Sometimes they can be destroyed in the a11y thread, since we keep a reference when unregistering the objects.

* accessibility/atspi/AccessibilityObjectAtspi.h:
* accessibility/atspi/AccessibilityRootAtspi.h:

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

5 months ago[GTK][a11y] Use invalid as role for detached objects in ATSPI
carlosgc@webkit.org [Tue, 4 Jan 2022 15:09:39 +0000 (15:09 +0000)]
[GTK][a11y] Use invalid as role for detached objects in ATSPI
https://bugs.webkit.org/show_bug.cgi?id=234835

Reviewed by Joanmarie Diggs.

We are using unknown by mistake.

* accessibility/atspi/AccessibilityObjectAtspi.cpp:
(WebCore::AccessibilityObjectAtspi::role const):

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

5 months ago[selectors] :focus-visible not matching on accessKey focus after focusing something...
rego@igalia.com [Tue, 4 Jan 2022 13:29:08 +0000 (13:29 +0000)]
[selectors] :focus-visible not matching on accessKey focus after focusing something via mouse
https://bugs.webkit.org/show_bug.cgi?id=234077
<rdar://problem/86572561>

Reviewed by Antti Koivisto.

Source/WebCore:

This patch adds Element::focusForBindings() to differentitate when this is called from JavaScript.
If that's the case it pass a new FocusTrigger::Bindings value to Element::focus(),
so we can differentiate when this was called from some internal code or from JavaScript.

When Element::focus() has been called internally, we always want to show the focus ring
(thus pass FocusVisibility::Visible). However when it's called from a script
we'll set it to Visible or Invisible depending on if the previously focused element
was focused via mouse click or not (this is needed to pass
the css/selectors/focus-visible-script-focus-* tests from WPT repository).

Test: fast/selectors/focus-visible-accesskey.html

* dom/Element.cpp:
(WebCore::Element::focus):
(WebCore::Element::focusForBindings):
* dom/Element.h:
(WebCore::Element::focusForBindings):
* dom/FocusOptions.h:
* html/HTMLOrForeignElement.idl:

LayoutTests:

Writing an internal test as WPT tests for this don't work due to webkit.org/b/234139.

* fast/selectors/focus-visible-accesskey-expected.txt: Added.
* fast/selectors/focus-visible-accesskey.html: Added.

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

5 months ago[PAS] constant-logical-operand clang warnings
commit-queue@webkit.org [Tue, 4 Jan 2022 13:05:31 +0000 (13:05 +0000)]
[PAS] constant-logical-operand clang warnings
https://bugs.webkit.org/show_bug.cgi?id=234814

Patch by Philippe Normand <pnormand@igalia.com> on 2022-01-04
Reviewed by Martin Robinson.

* libpas/src/libpas/pas_config_prefix.h: Use double exclamation marks in declarations to
force the compiler to interpret them as booleans and avoid constant-logical-operand
warnings.

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

5 months agoUnreviewed, fix build failure
ysuzuki@apple.com [Tue, 4 Jan 2022 05:58:26 +0000 (05:58 +0000)]
Unreviewed, fix build failure
https://bugs.webkit.org/show_bug.cgi?id=232723

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

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

5 months agoArray.prototype.toLocaleString does not respect deletion of Object.prototype.toLocale...
ysuzuki@apple.com [Tue, 4 Jan 2022 05:12:15 +0000 (05:12 +0000)]
Array.prototype.toLocaleString does not respect deletion of Object.prototype.toLocaleString
https://bugs.webkit.org/show_bug.cgi?id=232723

Reviewed by Alexey Shvayka.

JSTests:

* ChakraCore/test/Array/toLocaleString.baseline-jsc:
* stress/array-tolocalestring-delete-tolocalestring.js: Added.
(shouldThrow):
* stress/array-tolocalestring-empty-separator.js: Added.
(shouldBe):
* stress/array-tolocalestring-options.js: Added.
(shouldBe):
* stress/array-tolocalestring-undefined-null.js: Added.
(shouldBe):
(shouldBe.toLocaleString):

Source/JavaScriptCore:

This patch implements ECMA402 Array.prototype.toLocaleString[1]. The new implementation invokes "toLocaleString"
method for each elements.

[1]: https://tc39.es/ecma402/#sup-array.prototype.tolocalestring

* runtime/ArrayPrototype.cpp:
(JSC::toLocaleString):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::slowJoin):

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

5 months ago[GTK] Unreviewed test gardening, remove pending test failures filed under webkit...
dpino@igalia.com [Tue, 4 Jan 2022 02:55:48 +0000 (02:55 +0000)]
[GTK] Unreviewed test gardening, remove pending test failures filed under webkit.org/b/208292
https://bugs.webkit.org/show_bug.cgi?id=208292

Removed from GTK test expectations:
imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html
imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html

Removed from WPE test expectations:
imported/w3c/web-platform-tests/IndexedDB/interleaved-cursors-small.html

* platform/glib/TestExpectations:
* platform/gtk/TestExpectations:
* platform/wpe/TestExpectations:

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

5 months ago[LFC][IFC] Incorrect word-spacing gaps when logical order != visual order (bidi)
zalan@apple.com [Tue, 4 Jan 2022 01:36:07 +0000 (01:36 +0000)]
[LFC][IFC] Incorrect word-spacing gaps when logical order != visual order (bidi)
https://bugs.webkit.org/show_bug.cgi?id=234826

Reviewed by Antti Koivisto.

Source/WebCore:

Add missing condition from the (rtl) word-spacing patch, where we don't merge
adjacent text runs when word-spacing is not 0 and the run is a word-separator.
(we can't merge a whitespace run with a non-whitepace run and expect that the word-spacing
margin is always on the left side (visual reordering)).

Test: fast/text/simple-bidi-word-spacing.html

* layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::appendTextContent):

LayoutTests:

* fast/text/simple-bidi-word-spacing-expected.html: Added.
* fast/text/simple-bidi-word-spacing.html: Added.

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

5 months ago[GLIB] Update test expectations and baselines. Unreviewed test gardening.
commit-queue@webkit.org [Tue, 4 Jan 2022 01:06:09 +0000 (01:06 +0000)]
[GLIB] Update test expectations and baselines. Unreviewed test gardening.
https://bugs.webkit.org/show_bug.cgi?id=234832

Patch by Arcady Goldmints-Orlov <agoldmints@igalia.com> on 2022-01-03

* platform/glib/http/wpt/push-api/pushManager.any-expected.txt:
* platform/glib/http/wpt/push-api/pushManager.any.serviceworker-expected.txt:
* platform/glib/imported/w3c/web-platform-tests/css/css-cascade/idlharness-expected.txt: Added.
* platform/glib/imported/w3c/web-platform-tests/css/css-cascade/layer-rules-cssom-expected.txt: Added.
* platform/gtk/TestExpectations:
* platform/gtk/fast/repaint/focus-ring-repaint-expected.txt:
* platform/gtk/fast/text/bidi-reverse-runs-crash-expected.txt: Added. Platform-specific baseline for GTK due to lack of LFC integration support.

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

5 months ago[macOS] Initialize sandbox before initializing WebKit process
pvollan@apple.com [Tue, 4 Jan 2022 00:04:40 +0000 (00:04 +0000)]
[macOS] Initialize sandbox before initializing WebKit process
https://bugs.webkit.org/show_bug.cgi?id=234827

Reviewed by Brent Fulgham.

The sandbox should be initialized as early as possible in WebKit processes.

* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):

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

5 months ago[PlayStation] Build fix after r287552
stephan.szabo@sony.com [Mon, 3 Jan 2022 23:46:51 +0000 (23:46 +0000)]
[PlayStation] Build fix after r287552
https://bugs.webkit.org/show_bug.cgi?id=234828

Unreviewed build fix.

Needed WebCore prefixing on SRGBA.

* UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp:

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

5 months agoUnreviewed, reverting r287550.
commit-queue@webkit.org [Mon, 3 Jan 2022 21:49:37 +0000 (21:49 +0000)]
Unreviewed, reverting r287550.
https://bugs.webkit.org/show_bug.cgi?id=234829

Reverted changeset:

"[Web Animations] changing the effect of a transition should
no longer have it marked as running"
https://bugs.webkit.org/show_bug.cgi?id=234823
https://commits.webkit.org/r287550

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

5 months agoUnreviewed test gardening, this test progressed in the way it fails but the test...
graouts@webkit.org [Mon, 3 Jan 2022 21:47:42 +0000 (21:47 +0000)]
Unreviewed test gardening, this test progressed in the way it fails but the test expectation
wasn't updated.

* web-platform-tests/css/css-transitions/KeyframeEffect-setKeyframes.tentative-expected.txt:

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

5 months agoAdd resolved/unresolved color type accessors to require users to be explicit about...
weinig@apple.com [Mon, 3 Jan 2022 18:56:20 +0000 (18:56 +0000)]
Add resolved/unresolved color type accessors to require users to be explicit about whether they will handle missing/none color components
https://bugs.webkit.org/show_bug.cgi?id=234798

Reviewed by Antti Koivisto.

Source/WebCore:

In preparation for adding support for missing / powerless color components, this change changes the API
of color types (e.g. SRGBA<float>, OKLab<float>, etc) to require an extra step before users can access
the component values, forcing the user to choose whether they want to handle the missing / powerless color
components (the unresolved state) or have them converted to the value they should use for rendering (the
resolved state).

To do this, color types no longer expose their components publicly, but rather, only allow access to them
via new subclasses, ResolvedColorType<ColorType> and UnresolvedColorType<ColorType>. Theses subclasses
expose the components publicly via using directives.

To keep the API consistent (and keep generic contexts simpler), color types using both float and uint8_t
require the use of resolved() / unresolved() to access components, but for uint8_t, there is no actual
resolution that happens, as there is no way to encode the missing / powerless concept in them.

One tricky thing having a more complex hierarchy of color types is that generic functions parameterized
on the input color type can no longer assume the input and output types will be the same (for instance,
if you call colorWithOverriddenAlpha() with a ResolvedColorType<Lab<float>> it will not necessarily
return a ResolvedColorType<Lab<float>>) so a few generic functions have had their explicit return types
replaced with deduced (auto) return types to avoid this (additionally, a CanonicalColorType<> type trait
was added if one needs to be specific for something like template specialization purposes).

Since there is no way to add missing / powerless components yet, there is no actual behavior change, but
this lays the foundation for adding that in a follow up.

As this change was already touching most uses of the toSRGBALossy<> function on Color, I also took the
opportunity to replace all its uses with the generic toColorTypeLossy<SRGBA<>>.

* platform/graphics/ColorModels.h:
(WebCore::resolvedColor):
(WebCore::unresolvedColor):
(WebCore::resolveColorComponents):
(WebCore::ResolvedColorType::resolved const):
(WebCore::ResolvedColorType::unresolved const):
(WebCore::ResolvedColorType::ResolvedColorType):
(WebCore::ResolvedColorType::resolve):
(WebCore::UnresolvedColorType::unresolved const):
(WebCore::UnresolvedColorType::UnresolvedColorType):
(WebCore::asColorComponents):
(WebCore::get):
Adds ResolvedColorType and UnresolvedColorType generic types. They both inherit from
the helper type ExposedColorType which is specialized for each color model and does
the work of exposing the components via public 'using ColorType::componentName'. These
types also have overrides of the new resolved()/unresolved() member functions on color
types (well, only unresolved() for UnresolvedColorType) to allow generic code to not
care about whether it already has resolved or unresolved color type, and just use the
accessor it wants without worrying about duplicated resolution.

Since asColorComponents() can only be called with exposed color types, those functions
have been moved here from ColorTypes.h to make their relationship more clear. We also
reduced the number of these overloads as we now just have one per color model (we previously
had one per color type).

Also took the opportunity to merge ExtendedRGBModel and RGBModel into a single type
parameterized by an RGBBoundedness enum. This allowed fewer ExposedColorType specializations
and asColorComponents() overloads (and to remove some uses of UsesExtendedRGBModel<>).

One unfortunate side effect of the more complex type hierarchy is that we no longer get
destructuring for free, so to add that back, a generic get<> overload is added as well
as the required std::tuple_size/std::tuple_element specializations of ResolvedColorType
and UnresolvedColorType (the most derived class must be used for specializations, so
a single ExposedColorType specialization was not possible).

* platform/graphics/ColorTypes.h:
(WebCore::makeFromComponents):
(WebCore::makeFromComponentsClamping):
(WebCore::makeFromComponentsClampingExceptAlpha):
(WebCore::assertInRange):
(WebCore::ColorWithAlphaHelper::colorWithAlphaByte const):
(WebCore::operator==):
(WebCore::RGBAType::resolved const):
(WebCore::RGBAType::unresolved const):
(WebCore::Lab::resolved const):
(WebCore::Lab::unresolved const):
(WebCore::LCHA::resolved const):
(WebCore::LCHA::unresolved const):
(WebCore::OKLab::resolved const):
(WebCore::OKLab::unresolved const):
(WebCore::OKLCHA::resolved const):
(WebCore::OKLCHA::unresolved const):
(WebCore::HSLA::resolved const):
(WebCore::HSLA::unresolved const):
(WebCore::HWBA::resolved const):
(WebCore::HWBA::unresolved const):
(WebCore::XYZA::resolved const):
(WebCore::XYZA::unresolved const):
(WebCore::PackedColor::RGBA::RGBA):
(WebCore::PackedColor::ARGB::ARGB):
(WebCore::asColorComponents): Deleted.
Makes the component memebers of each color type protected, so that only
the ResolvedColorType and UnresolvedColorType derived types can access
and re-expose them. To access those, resolved() and unresolved() member
functions were added to make it easy, but explicit.

Also added a new type trait helper, CanonicalColorType<> which will return
the base/canonical name for a color type. For example:

     CanonicalColorType<SRGBA<float>> == SRGBA<float>
     CanonicalColorType<ResolvedColorType<SRGBA<float>>> == SRGBA<float>
     CanonicalColorType<UnresolvedColorType<SRGBA<float>>> == SRGBA<float>

This makes it easier for generic code to not care whether it is paramterized used
the base/canonical type or one of the derived ones.

* platform/graphics/ColorSpace.h:

* platform/graphics/Color.cpp:
(WebCore::Color::lightened const):
(WebCore::Color::darkened const):
(WebCore::Color::lightness const):
(WebCore::Color::toResolvedColorComponentsInColorSpace const):
(WebCore::Color::colorSpaceAndResolvedColorComponents const):
(WebCore::Color::toColorComponentsInColorSpace const): Deleted.
(WebCore::Color::colorSpaceAndComponents const): Deleted.
* platform/graphics/Color.h:
(WebCore::Color::isOpaque const):
(WebCore::Color::isVisible const):
(WebCore::Color::alphaByte const):
(WebCore::Color::alphaAsFloat const):
(WebCore::Color::asInline const):
(WebCore::Color::toSRGBALossy const): Deleted.
Add resolution where needed, but keep the components unresolved for storage in
the OutOfLineComponents object. Also updates some names of functions that return
ColorComponents that they explicitly return resolved color components. If need
variants that return unresolved components, we can add them as necessary since
the storage remains unresolved.

* platform/graphics/ColorComponents.h:
Add operator/=(T) to make some code in PageColorSampler.cpp much simpler.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::colorValue const):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::colorValue const):
Switch to toColorTypeLossy.

* accessibility/AccessibilityObjectInterface.h:
(WebCore::AXCoreObject::value):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getAttributeSetForAccessibilityObject):
* accessibility/atspi/AccessibilityObjectTextAtspi.cpp:
(WebCore::AccessibilityObjectAtspi::textAttributes const):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityColorStringValue]):
* css/DeprecatedCSSOMRGBColor.h:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseRelativeRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLabParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeLCHParameters):
(WebCore::CSSPropertyParserHelpers::parseRelativeColorFunctionForRGBTypes):
(WebCore::CSSPropertyParserHelpers::parseRelativeColorFunctionForXYZTypes):
(WebCore::CSSPropertyParserHelpers::mixColorComponentsUsingColorInterpolationMethod):
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::detectContentInRange):
* platform/graphics/ColorBlending.cpp:
(WebCore::blendSourceOver):
(WebCore::blendWithWhite):
(WebCore::blend):
(WebCore::blendWithoutPremultiply):
* platform/graphics/ColorConversion.cpp:
(WebCore::convertToPolarForm):
(WebCore::convertToRectangularForm):
(WebCore::calculateHSLHue):
(WebCore::SRGBA<float>>::convert):
(WebCore::HSLA<float>>::convert):
(WebCore::HWBA<float>>::convert):
(WebCore::Lab<float>>::convert):
(WebCore::WhitePoint::D50>>::convert):
(WebCore::OKLab<float>>::convert):
(WebCore::WhitePoint::D65>>::convert):
(WebCore::convertAndResolveColorComponents):
(WebCore::convertColorComponents): Deleted.
* platform/graphics/ColorConversion.h:
(WebCore::ColorConversion::handleToFloatConversion):
(WebCore::ColorConversion::handleToByteConversion):
(WebCore::ColorConversion::toLinearEncoded):
(WebCore::ColorConversion::toGammaEncoded):
(WebCore::ColorConversion::toExtended):
(WebCore::ColorConversion::toBounded):
(WebCore::ColorConversion::handleMatrixConversion):
* platform/graphics/ColorInterpolation.h:
(WebCore::interpolateColorComponents):
* platform/graphics/ColorLuminance.h:
(WebCore::relativeLuminance):
* platform/graphics/ColorUtilities.cpp:
(WebCore::premultiplied):
(WebCore::unpremultiplied):
(WebCore::premultipliedFlooring):
(WebCore::premultipliedCeiling):
* platform/graphics/ColorSerialization.cpp:
(WebCore::serializationUsingColorFunction):
(WebCore::serializationForCSS):
(WebCore::serializationForHTML):
(WebCore::serializationForRenderTreeAsText):
* platform/graphics/ColorUtilities.h:
(WebCore::colorByModifingEachNonAlphaComponent):
(WebCore::colorWithOverriddenAlpha):
(WebCore::invertedColorWithOverriddenAlpha):
(WebCore::isBlack):
(WebCore::isWhite):
* platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
(WebCore::PlatformCAAnimationCocoa::setFromValue):
(WebCore::PlatformCAAnimationCocoa::setToValue):
(WebCore::PlatformCAAnimationCocoa::setValues):
* platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
(PlatformCAAnimationWin::setFromValue):
(PlatformCAAnimationWin::setToValue):
(PlatformCAAnimationWin::setValues):
* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::setSourceRGBAFromColor):
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::addColorStopRGBA):
(WebCore::setCornerColorRGBA):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::convertToCGCompatibleComponents):
(WebCore::createCGColor):
* platform/graphics/cg/GradientRendererCG.cpp:
(WebCore::GradientRendererCG::makeGradient const):
(WebCore::GradientRendererCG::Shading::shadingFunction):
(WebCore::GradientRendererCG::makeShading const):
* platform/graphics/cpu/arm/filters/FELightingNEON.h:
(WebCore::FELighting::platformApplyNeon):
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::BasicColorMatrixFilterOperation::transformColor const):
(WebCore::BasicComponentTransferFilterOperation::transformColor const):
(WebCore::InvertLightnessFilterOperation::transformColor const):
(WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
* platform/graphics/filters/FilterOperations.cpp:
(WebCore::FilterOperations::transformColor const):
(WebCore::FilterOperations::inverseTransformColor const):
* platform/graphics/filters/software/FELightingSoftwareApplier.cpp:
(WebCore::FELightingSoftwareApplier::applyPlatform):
* platform/graphics/filters/software/FEMorphologySoftwareApplier.h:
(WebCore::FEMorphologySoftwareApplier::makeColorComponentsfromPixelValue):
* platform/graphics/gtk/ColorGtk.cpp:
(WebCore::Color::operator GdkRGBA const):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawBorder):
(WebCore::TextureMapperGL::drawNumber):
(WebCore::prepareFilterProgram):
(WebCore::TextureMapperGL::drawSolidColor):
(WebCore::TextureMapperGL::clearColor):
* platform/graphics/win/ColorDirect2D.cpp:
(WebCore::Color::operator D2D1_COLOR_F const):
(WebCore::Color::operator D2D1_VECTOR_4F const):
* platform/graphics/win/GradientDirect2D.cpp:
(WebCore::Gradient::createBrush):
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContextDirect2D::colorWithGlobalAlpha const):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::datePlaceholderTextColor const):
* rendering/RenderThemeIOS.mm:
(WebCore::shouldUseConvexGradient):
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
(WebCore::SVGAnimationColorFunction::animate):
Add calls to resolved() to access components. Some of these (particularlly in serialization, conversion and
interpolation related calls) will need to be converted to use unresolved() eventually, but first they will
need to handle the NaN case properly.

* page/PageColorSampler.cpp:
(WebCore::colorDifference):
(WebCore::averageColor):
(WebCore::PageColorSampler::sampleTop):
Rework code a bit to use modern WebKit idioms (std::array, Span, ColorComponents).

Source/WebKit:

Replace uses of Color::toSRGBALossy<>() with Color::toColorTypeLossy<SRGBA<>>() and add
calls to resolved() to access color components.

* UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp:
(drawPageBackground):
* UIProcess/API/wpe/WebKitColor.cpp:
(webkitColorFillFromWebCoreColor):
* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::beginSwipeGesture):
* WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
(WebKit::animationValueFromKeyframeValue):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::getDocumentBackgroundColor):

Tools:

* TestWebKitAPI/Tests/WebCore/ColorTests.cpp:
(TestWebKitAPI::TEST):
Replace uses of Color::toSRGBALossy<>() with Color::toColorTypeLossy<SRGBA<>>() and add
calls to resolved() to access color components. Also update to new name of colorSpaceAndComponents(),
colorSpaceAndResolvedColorComponents().

* TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm:
(TestWebKitAPI::changeContextContents):
Replace unnecessary use of colorSpaceAndComponents() with the more common toColorTypeLossy<WebCore::SRGBA<float>>().resolved().

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

5 months ago[:has() pseudo-class] Style invalidation for :valid and :invalid
antti@apple.com [Mon, 3 Jan 2022 18:49:55 +0000 (18:49 +0000)]
[:has() pseudo-class] Style invalidation for :valid and :invalid
https://bugs.webkit.org/show_bug.cgi?id=234815

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/css/selectors/invalidation/has-with-pseudo-class-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-pseudo-class-expected.txt.
* web-platform-tests/css/selectors/invalidation/has-with-pseudo-class.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/has-pseudo-class.html.

Source/WebCore:

Use PseudoClassChangeInvalidation for accurate and :has() supporting style invalidation.

Test: imported/w3c/web-platform-tests/css/selectors/invalidation/has-with-pseudo-class.html

* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::computeValidity const):
(WebCore::FormAssociatedElement::isValid const): Deleted.
* html/FormAssociatedElement.h:
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::addInvalidDescendant):
(WebCore::HTMLFieldSetElement::removeInvalidDescendant):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::updateWillValidateAndValidity):
(WebCore::HTMLFormControlElement::isValidFormControlElement const):
(WebCore::HTMLFormControlElement::updateValidity):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::registerInvalidAssociatedFormControl):
(WebCore::HTMLFormElement::removeInvalidAssociatedFormControlIfNeeded):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::computeValidity const):
(WebCore::HTMLInputElement::isValid const): Deleted.
* html/HTMLInputElement.h:
* html/ValidityState.idl:

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

5 months ago[Web Animations] changing the effect of a transition should no longer have it marked...
graouts@webkit.org [Mon, 3 Jan 2022 18:49:23 +0000 (18:49 +0000)]
[Web Animations] changing the effect of a transition should no longer have it marked as running
https://bugs.webkit.org/show_bug.cgi?id=234823

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progression.

* web-platform-tests/css/css-transitions/CSSTransition-effect.tentative-expected.txt:

Source/WebCore:

* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::setEffect):
* animation/DeclarativeAnimation.h:
* animation/WebAnimation.h:

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

5 months ago[Web Animations] calling setKeyframes() on a running CSS Transition has no immediate...
graouts@webkit.org [Mon, 3 Jan 2022 18:45:11 +0000 (18:45 +0000)]
[Web Animations] calling setKeyframes() on a running CSS Transition has no immediate effect
https://bugs.webkit.org/show_bug.cgi?id=234818

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progressions.

* web-platform-tests/css/css-animations/animation-base-response-004-expected.txt:
* web-platform-tests/css/css-cascade/revert-val-010-expected.txt:
* web-platform-tests/css/css-transitions/KeyframeEffect-setKeyframes.tentative-expected.txt:
* web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-context-filling-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/setKeyframes-expected.txt:

Source/WebCore:

We must mark the target as dirty if setKeyframes() is called.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::processKeyframes):

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

5 months ago[Web Animations] reversing factor should be computed before canceling the previous...
graouts@webkit.org [Mon, 3 Jan 2022 18:40:00 +0000 (18:40 +0000)]
[Web Animations] reversing factor should be computed before canceling the previous transition
https://bugs.webkit.org/show_bug.cgi?id=234821

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progressions.

* web-platform-tests/css/css-transitions/CSSTransition-currentTime.tentative-expected.txt:
* web-platform-tests/css/css-transitions/CSSTransition-effect.tentative-expected.txt:
* web-platform-tests/css/css-transitions/KeyframeEffect-setKeyframes.tentative-expected.txt:

Source/WebCore:

We would always compute the transition reversing factor to 1.0 since we would cancel the
previously-running transition prior to getting its computed progress.

* style/Styleable.cpp:
(WebCore::updateCSSTransitionsForStyleableAndProperty):

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

5 months agoUndownloaded iCloud Photos are inserted as broken images when attachment element...
wenson_hsieh@apple.com [Mon, 3 Jan 2022 18:27:07 +0000 (18:27 +0000)]
Undownloaded iCloud Photos are inserted as broken images when attachment element is enabled
https://bugs.webkit.org/show_bug.cgi?id=234803
rdar://82318259

Reviewed by Darin Adler.

Source/WebCore:

Currently, when inserting file paths via paste or drop that correspond to undownloaded files in iCloud Drive,
we show a generic empty file as the file preview, with "Zero Bytes" as the attachment subtitle when the
attachment element is enabled (i.e., Mail compose when using WebKit2). Even worse, for undownloaded image files,
we'll attempt to insert them as broken images.

Mail handles this scenario by detecting that we've dropped an undownloaded attachment, downloads the attachment,
and eventually updates the attachment element with the downloaded data. In the meantime, however, it's not ideal
for WebKit to represent the attachment that is still being downloaded as a broken image or empty file.

To address this, make a slight adjustment to detect that the file we're inserting is not locally available and
render it as an attachment element with progress="0". The client is then expected to update this progress as the
download is taking place, and update the attachment data once it's complete.

Test: WKAttachmentTestsMac.InsertNonExistentImageFileAsAttachment

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::attachmentForFilePath):

Tools:

Add a new API test to exercise the change. See WebCore/ChangeLog for more information.

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

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

5 months ago[JSC] Fix Intl.PluralRules.selectRange input validation
ysuzuki@apple.com [Mon, 3 Jan 2022 17:46:10 +0000 (17:46 +0000)]
[JSC] Fix Intl.PluralRules.selectRange input validation
https://bugs.webkit.org/show_bug.cgi?id=234817

Reviewed by Alexey Shvayka.

JSTests:

* stress/intl-pluralrules-select-range-validate-inputs.js: Added.
(shouldThrow):
(Intl.PluralRules.prototype.selectRange.shouldThrow):

Source/JavaScriptCore:

Add specified argument validation[1] to Intl.PluralRules.selectRange.

[1]: https://tc39.es/proposal-intl-numberformat-v3/out/pluralrules/proposed.html#sec-intl.pluralrules.prototype.selectrange

* runtime/IntlPluralRules.cpp:
(JSC::IntlPluralRules::selectRange const):
* runtime/IntlPluralRulesPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

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

5 months ago[JSC] Update UCD to Unicode 14.0.0
ysuzuki@apple.com [Mon, 3 Jan 2022 17:00:53 +0000 (17:00 +0000)]
[JSC] Update UCD to Unicode 14.0.0
https://bugs.webkit.org/show_bug.cgi?id=234811

Reviewed by Sam Weinig.

JSTests:

* test262/expectations.yaml:

Source/JavaScriptCore:

This is yearly update of UCD data.

* ucd/CaseFolding.txt:
* ucd/DerivedBinaryProperties.txt:
* ucd/DerivedCoreProperties.txt:
* ucd/DerivedNormalizationProps.txt:
* ucd/PropList.txt:
* ucd/PropertyAliases.txt:
* ucd/PropertyValueAliases.txt:
* ucd/ScriptExtensions.txt:
* ucd/Scripts.txt:
* ucd/UnicodeData.txt:
* ucd/emoji-data.txt:
* yarr/generateYarrUnicodePropertyTables.py:

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

5 months ago[JSC] Read-modify-write operation's second put-to-scope should not throw error if...
ysuzuki@apple.com [Mon, 3 Jan 2022 16:50:30 +0000 (16:50 +0000)]
[JSC] Read-modify-write operation's second put-to-scope should not throw error if binding does not exist
https://bugs.webkit.org/show_bug.cgi?id=234813

Reviewed by Alexey Shvayka.

JSTests:

* stress/global-object-read-modify-write-remove-at-get-strict.js: Added.
(shouldThrow):
* stress/global-object-read-modify-write-remove-at-get.js: Added.
(shouldBe):
* test262/expectations.yaml:

Source/JavaScriptCore:

This patch fixes a bug throwing RefereceError when read-modify-write's read operation removes binding from object.
Throwing error should happen only when evaluating it under strict mode.

* bytecompiler/NodesCodegen.cpp:
(JSC::PostfixNode::emitResolve):
(JSC::PrefixNode::emitResolve):
(JSC::ReadModifyResolveNode::emitBytecode):
(JSC::ShortCircuitReadModifyResolveNode::emitBytecode):

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

5 months ago[JSC] Fix length of Intl.NumberFormat.formatRange and Intl.PluralRules.selectRange
ysuzuki@apple.com [Mon, 3 Jan 2022 16:31:18 +0000 (16:31 +0000)]
[JSC] Fix length of Intl.NumberFormat.formatRange and Intl.PluralRules.selectRange
https://bugs.webkit.org/show_bug.cgi?id=234806

Reviewed by Alexey Shvayka.

JSTests:

* stress/intl-numberformat-format-range-v3.js:
(nf.formatRange.nf.formatRangeToParts.methods.forEach):
* stress/intl-pluralrules-selectrange.js:

Source/JavaScriptCore:

These length's numbers are wrong. This patch fixes them.

* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatPrototype::finishCreation):
* runtime/IntlPluralRulesPrototype.cpp:
(JSC::IntlPluralRulesPrototype::finishCreation):

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

5 months agoClean up TestExpectations for imported WPT CSS transforms tests
mrobinson@webkit.org [Mon, 3 Jan 2022 16:26:00 +0000 (16:26 +0000)]
Clean up TestExpectations for imported WPT CSS transforms tests
https://bugs.webkit.org/show_bug.cgi?id=234820

Unreviewed.

* TestExpectations:
* platform/glib/TestExpectations:

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

5 months ago[JSC] Update test262
ysuzuki@apple.com [Mon, 3 Jan 2022 15:46:44 +0000 (15:46 +0000)]
[JSC] Update test262
https://bugs.webkit.org/show_bug.cgi?id=234807

Reviewed by Alexey Shvayka.

* test262/config.yaml:
* test262/expectations.yaml:
* test262/test262-Revision.txt:

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

5 months agoPseudoClassChangeInvalidation should allow multiple pseudo classes as argument
antti@apple.com [Mon, 3 Jan 2022 15:43:51 +0000 (15:43 +0000)]
PseudoClassChangeInvalidation should allow multiple pseudo classes as argument
https://bugs.webkit.org/show_bug.cgi?id=234810

Reviewed by Alan Bujtas.

It is common to invalidate multiple pseudo-classes together (say :disabled and :enabled).

* dom/Element.cpp:
(WebCore::Element::setFocus):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::setAncestorDisabled):
(WebCore::HTMLFormControlElement::parseAttribute):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::parseAttribute):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::parseAttribute):
* style/PseudoClassChangeInvalidation.h:
(WebCore::Style::PseudoClassChangeInvalidation::PseudoClassChangeInvalidation):

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

5 months ago[LFC][IFC] Take grapheme clusters into account at TextUtil::breakWord
zalan@apple.com [Mon, 3 Jan 2022 14:54:54 +0000 (14:54 +0000)]
[LFC][IFC] Take grapheme clusters into account at TextUtil::breakWord
https://bugs.webkit.org/show_bug.cgi?id=234805

Reviewed by Antti Koivisto.

userPerceivedCharacterBoundaryAlignedIndex -> ubrk_preceding
nextUserPerceivedCharacterIndex -> ubrk_following

* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::breakWord): This average character estimation does not work well with character clusters.

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

5 months ago[LBSE] Begin layer-aware RenderSVGModelObject implementation
zimmermann@webkit.org [Mon, 3 Jan 2022 14:01:22 +0000 (14:01 +0000)]
[LBSE] Begin layer-aware RenderSVGModelObject implementation
https://bugs.webkit.org/show_bug.cgi?id=234524

Reviewed by Rob Buis.

Begin implementing RenderSVGModelObject - the base class for most graphics
primitives in SVG (path / rect / circle / image / ...) for the LBSE.

In the legacy engine, RenderSVGImage / RenderSVGShape / RenderSVGContainer inherit
from LegacyRenderSVGModelObject, which in turn inherits from RenderElement. The SVG
<text> / <foreignObject> renderers inherit from their existing "HTML counterparts"
e.g. RenderSVGBlock from RenderBlockFlow, or RenderSVGInline from RenderInline.

This has historical reasons: When SVG text rendering was prototyped in WebCore, a goal was to
re-use the existing HTML/CSS text rendering code whenever possible. Therefore the SVG text
renderers were modelled in the terminology of HTML/CSS: A natural choice is to treat a SVG
<text> element as a CSS "block-level element" and <tspan> / <textPath> / <tref> / ...
elements as CSS "inline elements". These design choices from almost two decades ago, are
the reason for the unnecessary confusing SVG inheritance structure. Furthermore we explicitly
disable layer support in all SVG classes that indirectly inherit from RenderLayerModelObject.

However for LBSE we do want SVG to participate in the layer tree.
Therefore let RenderSVGModelObject inherit from RenderLayerModelObject. This turns
RenderLayerModelObject into the common base-class for all SVG renderers in LBSE.

The price for the layer support is that all SVG renderers need to be able to answer questions
in HTML/CSS language (what's your 'border box rect'? do you have visual overflow? etc.).
Finding consistent definitions/mappings was a tedious job, that is fully solved in LBSE and
will be upstreamed in pieces. This patch is one main piece of the work.

If we forget about the legacy engine, the inheritance structure now looks like the following:

+ RenderObject
    + RenderElement
    |    + RenderLayerModelObject
    |        + RenderBoxModelObject
    |        |    + RenderBox
    |        |    |    + RenderReplaced (CSS "replaced" elements)
    |        |    |    |    + RenderSVGRoot (outermost <svg> element)
    |        |    |    |
    |        |    |    + RenderBlock (CSS "block-level" elements)
    |        |    |        + RenderBlockFlow
    |        |    |            + RenderSVGBlock (HTML/SVG glue code)
    |        |    |                + RenderSVGForeignObject (<foreignObject> element)
    |        |    |                + RenderSVGText (<text> element)
    |        |    |
    |        |    + RenderInline (CSS "inline" elements)
    |        |        + RenderSVGInline (HTML/SVG glue code)
    |        |            + RenderSVGTSpan (<tspan> element)
    |        |            + RenderSVGTextPath (<textPath> element)
    |        |
    |        + RenderSVGModelObject
    |            + RenderSVGContainer
    |            |    + RenderSVGHiddenContainer (<defs> / <g> with 'display: none' / <symbol> elements)
    |            |    |    + RenderSVGResourceContainer
    |            |    |        + RenderSVGResourceClipper (<clipPath> element)
    |            |    |        + RenderSVGResourceFilter (<filter> element)
    |            |    |        + RenderSVGResourceFilterPrimitive
    |            |    |        + RenderSVGResourceGradient
    |            |    |        |    + RenderSVGResourceLinearGradient (<linearGradient> element)
    |            |    |        |    + RenderSVGResourceRadialGradient (<radialGradient> element)
    |            |    |        |
    |            |    |        + RenderSVGResourceMarker (<marker> element)
    |            |    |        + RenderSVGResourceMasker (<masker> element)
    |            |    |        + RenderSVGResourcePattern (<pattern> element)
    |            |    |        + RenderSVGResourceSolidColor
    |            |    |
    |            |    + RenderSVGTransformableContainer (<a> / <g> / <switch> / <use> elements)
    |            |
    |            + RenderSVGImage (<image> element)
    |            + RenderSVGShape (<rect> / <circle> / <path> ... elements)
    |                + RenderSVGEllipse
    |                + RenderSVGPath
    |                + RenderSVGRect
    |
    + RenderText (#text nodes in HTML)
        + RenderSVGInlineText (#text nodes in SVG)

This is way less confusing then the previous version of the SVG render tree.
Covered by existing tests, no change in behaviour.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::computeVisibleRectInSVGContainer const):
(WebCore::RenderLayerModelObject::mapLocalToSVGContainer const):
* rendering/RenderLayerModelObject.h:
* rendering/svg/RenderSVGModelObject.cpp: Added.
(WebCore::RenderSVGModelObject::RenderSVGModelObject):
(WebCore::RenderSVGModelObject::updateFromStyle):
(WebCore::RenderSVGModelObject::borderBoxRectInFragmentEquivalent const):
(WebCore::RenderSVGModelObject::overflowClipRect const):
(WebCore::RenderSVGModelObject::clippedOverflowRect const):
(WebCore::RenderSVGModelObject::computeVisibleRectInContainer const):
(WebCore::RenderSVGModelObject::pushMappingToContainer const):
(WebCore::RenderSVGModelObject::outlineBoundsForRepaint const):
(WebCore::RenderSVGModelObject::absoluteRects const):
(WebCore::RenderSVGModelObject::absoluteQuads const):
(WebCore::RenderSVGModelObject::willBeDestroyed):
(WebCore::RenderSVGModelObject::styleDidChange):
(WebCore::RenderSVGModelObject::mapAbsoluteToLocalPoint const):
(WebCore::RenderSVGModelObject::mapLocalToContainer const):
(WebCore::RenderSVGModelObject::offsetFromContainer const):
(WebCore::RenderSVGModelObject::addFocusRingRects):
(WebCore::RenderSVGModelObject::shouldPaintSVGRenderer const):
(WebCore::intersectsAllowingEmpty):
(WebCore::isGraphicsElement):
(WebCore::RenderSVGModelObject::checkIntersection):
(WebCore::RenderSVGModelObject::checkEnclosure):
(WebCore::RenderSVGModelObject::applyTransform const):
* rendering/svg/RenderSVGModelObject.h: Added.
(WebCore::RenderSVGModelObject::element const):
(WebCore::RenderSVGModelObject::borderBoxRectEquivalent const):
(WebCore::RenderSVGModelObject::contentBoxRectEquivalent const):
(WebCore::RenderSVGModelObject::frameRectEquivalent const):
(WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const):
(WebCore::RenderSVGModelObject::applyTopLeftLocationOffsetEquivalent const):
(WebCore::RenderSVGModelObject::layoutRect const):
(WebCore::RenderSVGModelObject::setLayoutRect):
(WebCore::RenderSVGModelObject::setLayoutLocation):
(WebCore::RenderSVGModelObject::paintingLocation const):
(WebCore::RenderSVGModelObject::layoutLocation const):
(WebCore::RenderSVGModelObject::layoutLocationOffset const):
(WebCore::RenderSVGModelObject::layoutSize const):
(WebCore::RenderSVGModelObject::overflowClipRectForChildLayers):

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

5 months agoRefactor code creating css values and lists for animation and transition properties
graouts@webkit.org [Mon, 3 Jan 2022 13:51:08 +0000 (13:51 +0000)]
Refactor code creating css values and lists for animation and transition properties
https://bugs.webkit.org/show_bug.cgi?id=234812

Reviewed by Antti Koivisto.

For bug 234792 we exposed a series of static functions on ComputedStyleExtractor to share
code between CSSPropertyParser.cpp and CSSComputedStyleDeclaration.cpp for the creation of
CSS values for CSS Animations properties. Darin suggested some refactoring as part of the
review of that bug which was even more appropriate following the fix for bug 234785.

We now expose a single ComputedStyleExtractor::addCSSValueForAnimationPropertyToList()
static method to add the CSSValue for a given animation or transition CSS property to
a CSS list, providing an optional Animation to read the value from that, otherwise
using the default value.

This allowed initially for shorter code in CSSPropertyParser::consumeAnimationShorthand()
and animationShorthandValue(). Looking at ComputedStyleExtractor::valueForPropertyInStyle(),
there were more opportunities to share code and so valueListForAnimationOrTransitionProperty()
was added as well.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForAnimationDuration):
(WebCore::valueForAnimationDelay):
(WebCore::valueForAnimationIterationCount):
(WebCore::valueForAnimationDirection):
(WebCore::valueForAnimationFillMode):
(WebCore::valueForAnimationPlayState):
(WebCore::valueForAnimationName):
(WebCore::valueForAnimationTimingFunction):
(WebCore::ComputedStyleExtractor::addCSSValueForAnimationPropertyToList):
(WebCore::valueListForAnimationOrTransitionProperty):
(WebCore::animationShorthandValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
(WebCore::ComputedStyleExtractor::valueForAnimationDuration): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationDelay): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationIterationCount): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationDirection): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationFillMode): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationPlayState): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationName): Deleted.
(WebCore::delayValue): Deleted.
(WebCore::durationValue): Deleted.
(WebCore::ComputedStyleExtractor::valueForAnimationTimingFunction): Deleted.
(WebCore::timingFunctionValue): Deleted.
* css/CSSComputedStyleDeclaration.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeAnimationShorthand):

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

5 months agoA manual test was imported with the WPT css-transforms test suite
mrobinson@webkit.org [Mon, 3 Jan 2022 12:49:34 +0000 (12:49 +0000)]
A manual test was imported with the WPT css-transforms test suite
https://bugs.webkit.org/show_bug.cgi?id=234245

Reviewed by Youenn Fablet.

* Scripts/webkitpy/w3c/test_parser.py:
(TestParser.analyze_test): Manual tests may also be reference tests and these
should not be imported.
* Scripts/webkitpy/w3c/test_parser_unittest.py:
(test_analyze_manual_reference_wpt_test): Add a test for this situation.

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

5 months agoSupport the "animation" shorthand property in the computed style
graouts@webkit.org [Mon, 3 Jan 2022 11:55:54 +0000 (11:55 +0000)]
Support the "animation" shorthand property in the computed style
https://bugs.webkit.org/show_bug.cgi?id=234785

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Mark WPT progressions.

* web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt:
* web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt:
* web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:

Source/WebCore:

There is an existing WPT for the "animation" shorthand in the computed style which we
used to fail because we would simply not do any work to return the longhands compiled
into a list. It seems that the CSS WG, per https://github.com/w3c/csswg-drafts/issues/2529,
is moving in the direction of specifying what happens with shorthands in computed style,
so we're adding support for the "animation" shorthand.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::animationShorthandValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

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

5 months ago"animation" shorthand should list all longhand values when serializing
graouts@webkit.org [Mon, 3 Jan 2022 10:00:53 +0000 (10:00 +0000)]
"animation" shorthand should list all longhand values when serializing
https://bugs.webkit.org/show_bug.cgi?id=234792

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Mark 20 new WPT progressions.

* web-platform-tests/css/css-animations/parsing/animation-shorthand-expected.txt:
* web-platform-tests/css/css-animations/parsing/animation-valid-expected.txt:
* web-platform-tests/css/css-animations/style-animation-parsing-expected.txt:

Source/WebCore:

Currently we omit any initial value when serializing the "animation" shorthand. However,
the CSS Animations spec says:

    Note that order is also important within each animation definition for distinguishing
    <keyframes-name> values from other keywords. When parsing, keywords that are valid for
    properties other than animation-name whose values were not found earlier in the shorthand
    must be accepted for those properties rather than for animation-name. Furthermore, when
    serializing, default values of other properties must be output in at least the cases
    necessary to distinguish an animation-name that could be a value of another property,
    and may be output in additional cases.

Both Firefox and Chrome always include all longhand values when querying the inline style,
such that <div style="animation: none"> yields "0s ease 0s 1 normal none running none" for
element.style.animation. Currently, Safari only outputs "none".

When parsing the "animation" shorthand in consumeAnimationShorthand(), we now fill in initial
values as if they were explicitly set to their initial value, for instance duration is set to
"0s".

To do this, we refactored code in CSSComputedStyleDeclaration.cpp that dealt with the creation
of CSSValue from various values exposed on Animation such that it may be called from within
CSSPropertyParser.cpp.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForAnimationDuration):
(WebCore::ComputedStyleExtractor::valueForAnimationDelay):
(WebCore::ComputedStyleExtractor::valueForAnimationIterationCount):
(WebCore::ComputedStyleExtractor::valueForAnimationDirection):
(WebCore::ComputedStyleExtractor::valueForAnimationFillMode):
(WebCore::ComputedStyleExtractor::valueForAnimationPlayState):
(WebCore::ComputedStyleExtractor::valueForAnimationName):
(WebCore::delayValue):
(WebCore::durationValue):
(WebCore::ComputedStyleExtractor::valueForAnimationTimingFunction):
(WebCore::timingFunctionValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
(WebCore::createTimingFunctionValue): Deleted.
* css/CSSComputedStyleDeclaration.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeAnimationShorthand):

LayoutTests:

Add the initial longhand values for some non-WPT tests that expected them to be
absent in the shorthand serialization.

* fast/css/longhand-overrides-shorthand-prefixing.html:
* fast/css/transform-inline-style-remove-expected.txt:

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

5 months agoAX: web process crash with isolated tree mode enabled
carlosgc@webkit.org [Mon, 3 Jan 2022 09:21:23 +0000 (09:21 +0000)]
AX: web process crash with isolated tree mode enabled
https://bugs.webkit.org/show_bug.cgi?id=234739
<rdar://problem/86983058>

Reviewed by Chris Fleizach.

It can happen that a new node being added is removed by AXIsolatedObject constructor when initializing
ComputedLabel property, because AccessibilityObject::computedLabel() calls updateBackingStore() that can trigger
a layout. We don't really need ComputedLabel property for isolated objects because AccessibilityObject::computedLabel()
is only used by the inspector that uses AccessibilityObject directly.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData): Remove ComputedLabel property initialization.
(WebCore::AXIsolatedObject::computedLabel): Assert if called.
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::createSubtree): Add an assert to ensure the wrapper is still valid after AXIsolatedObject::create().
* accessibility/isolatedtree/AXIsolatedTree.h:

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

5 months agoFetchRequest.clone does not need to be called with the current context
youenn@apple.com [Mon, 3 Jan 2022 08:17:59 +0000 (08:17 +0000)]
FetchRequest.clone does not need to be called with the current context
https://bugs.webkit.org/show_bug.cgi?id=234515

Reviewed by Darin Adler.

Source/WebCore:

Make FetchRequest, FetchResponse and FetchBodyOwner take a ScriptExecutionContext* instead of a ScriptExecutionContext&.
This allows cloning FetchRequest and FetchResponse with the context of the original request or response.

Update call site, as well as for AbortSignal.

For FetchResponse, we did a change to throw in case of cloning FetchResponse on a stopped context.
It appeared that Firefox is not doing that, and Chrome is only doing that in some specific cases.
For that reason, it is better to go back to our previous behavior of not throwing.

To ease testing, we add an internals API to check whether a request/response is linked to a closed context.

Covered by updated tests.

* Modules/cache/DOMCache.cpp:
* Modules/fetch/FetchBodyOwner.cpp:
* Modules/fetch/FetchBodyOwner.h:
* Modules/fetch/FetchRequest.cpp:
* Modules/fetch/FetchRequest.h:
* Modules/fetch/FetchRequest.idl:
* Modules/fetch/FetchResponse.cpp:
* Modules/fetch/FetchResponse.h:
* dom/AbortController.cpp:
* dom/AbortSignal.cpp:
* dom/AbortSignal.h:
* testing/Internals.cpp:
* testing/Internals.h:
* testing/Internals.idl:
* testing/ServiceWorkerInternals.cpp:

LayoutTests:

* http/wpt/fetch/clone-realm-expected.txt:
* http/wpt/fetch/clone-realm.html:
* http/wpt/fetch/resources/clone-realm-iframe.html: Added.

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

5 months ago[JSC] Use emitPutProperty / emitGetPropertyValue consistently to handle private names...
ysuzuki@apple.com [Mon, 3 Jan 2022 07:39:38 +0000 (07:39 +0000)]
[JSC] Use emitPutProperty / emitGetPropertyValue consistently to handle private names in edge cases
https://bugs.webkit.org/show_bug.cgi?id=234794

Reviewed by Alexey Shvayka.

JSTests:

* test262/expectations.yaml:

Source/JavaScriptCore:

This patch consistently uses emitPutProperty / emitGetPropertyValue so that we handle private names
in edge cases.

* bytecompiler/NodesCodegen.cpp:
(JSC::TaggedTemplateNode::emitBytecode):
(JSC::ForInNode::emitLoopHeader):
(JSC::ForOfNode::emitBytecode):
(JSC::AssignmentElementNode::bindValue const):

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

5 months ago[GTK] Unreviewed test gardening, update baseline for imported/w3c/web-platform-tests...
dpino@igalia.com [Mon, 3 Jan 2022 06:30:23 +0000 (06:30 +0000)]
[GTK] Unreviewed test gardening, update baseline for imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/transfer-errors.window.html
https://bugs.webkit.org/show_bug.cgi?id=207258

* platform/glib/TestExpectations:
* platform/glib/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/transfer-errors.window-expected.txt:

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

5 months agoAccess key should work on focusable element.
rego@igalia.com [Mon, 3 Jan 2022 05:52:39 +0000 (05:52 +0000)]
Access key should work on focusable element.
https://bugs.webkit.org/show_bug.cgi?id=72359

Reviewed by Darin Adler.

Source/WebCore:

Elements that have "accesskey" attribute and are focusable should be focused when you use the access key,
this is happening for some elements but not all.
To fix the issue this patch moves accessKeyAction() implementation from some subclasses to HTMLElement,
which makes us match other browsers.

This patch changes the behavior for HTMLAnchorElement, as it was not focused before, but that matches other browsers too.

Test: fast/dom/accesskey-focus-element.html

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::accessKeyAction): Deleted.
* html/HTMLAnchorElement.h:
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::accessKeyAction): Deleted.
* html/HTMLButtonElement.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::accessKeyAction):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::accessKeyAction): Deleted.
* html/HTMLSelectElement.h:

LayoutTests:

Add new test to check the behavior of accesskey on focusable and not focusable DIV, together with other elements
like INPUT, SELECT and A.
Update expectations for fast/forms/access-key.html test, as now more elements are focused than before.
Apart from that we had to modify accessibility/mac/search-predicate-visited-links.html as that was pressing a link
and the link is now focused.

This will make us also pass css/selectors/focus-visible-024.html from WPT, but that test cannot run properly on WebKit
due to webkit.org/b/234139.

* accessibility/mac/search-predicate-visited-links.html: Update test due to change of behavior.
* fast/dom/accesskey-focus-element-expected.txt: Added.
* fast/dom/accesskey-focus-element.html: Added.
* fast/forms/access-key-expected.txt: Update expectations.
* platform/ios/TestExpectations: Skip new accesskey test.

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

5 months ago[GTK] Unreviewed test gardening, emit baseline for imported/w3c/web-platform-tests...
dpino@igalia.com [Mon, 3 Jan 2022 05:40:18 +0000 (05:40 +0000)]
[GTK] Unreviewed test gardening, emit baseline for imported/w3c/web-platform-tests/css/selectors/focus-visible-002.html
https://bugs.webkit.org/show_bug.cgi?id=224967

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/css/selectors/focus-visible-002-expected.txt: Added.

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

5 months ago[GTK] Unreviewed build fix after r287519
dpino@igalia.com [Mon, 3 Jan 2022 03:43:51 +0000 (03:43 +0000)]
[GTK] Unreviewed build fix after r287519
https://bugs.webkit.org/show_bug.cgi?id=234802

* layout/integration/InlineIteratorInlineBox.cpp:
(WebCore::InlineIterator::firstInlineBoxFor):
(WebCore::InlineIterator::firstRootInlineBoxFor):

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

5 months ago[WPE] [Debug] Unreviewed test gardening, remove WebXR tests failures no longer crashing
dpino@igalia.com [Mon, 3 Jan 2022 02:22:42 +0000 (02:22 +0000)]
[WPE] [Debug] Unreviewed test gardening, remove WebXR tests failures no longer crashing
https://bugs.webkit.org/show_bug.cgi?id=225379

* platform/wpe/TestExpectations:

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

5 months ago[LFC][IFC] Add ASSERT(middle >= left && middle < right) to TextUtil::breakWord
zalan@apple.com [Mon, 3 Jan 2022 00:49:30 +0000 (00:49 +0000)]
[LFC][IFC] Add ASSERT(middle >= left && middle < right) to TextUtil::breakWord
https://bugs.webkit.org/show_bug.cgi?id=234801

Reviewed by Antti Koivisto.

Before adding support for surrogate pairs, the implicit integral flooring guaranteed that
(left + right) / 2 always produced a middle point where left >= middle and middle < right.
With introducing surrogate pair support, the middle point may end up being equal to the right position.
(when the (left + right) / 2 falls right in the middle of a surrogate pair, we advance the index
to the _end_ of the pair (and later we adjust it by calling U16_SET_CP_START)).

In this patch, we revert this behavior back so that the middle point is always < right.
We also make sure that left/right/middle are all fall on cluster boundary by calling nextUserPerceivedCharacterIndex.
This patch is also in preparation for introducing grapheme cluster support.

* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::breakWord):

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

5 months agoLayoutTests/imported/w3c:
graouts@webkit.org [Sun, 2 Jan 2022 23:42:27 +0000 (23:42 +0000)]
LayoutTests/imported/w3c:
[Web Animations] getKeyframes() should handle multiple 0% and 100% keyframes
https://bugs.webkit.org/show_bug.cgi?id=234799

Reviewed by Dean Jackson.

Mark a WPT progression.

* web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt:

Source/WebCore:
[Web Animations] getKeyframes() should handle multiple keyframes for the same offset
https://bugs.webkit.org/show_bug.cgi?id=234799

Reviewed by Dean Jackson.

A @keyframes rule may specify multiple keyframes for the same offset. We currently have support
for merging such keyframes into consolidated keyframes in Style::Resolver::keyframeStylesForAnimation()
but WPT shows that it's lacking since it doesn't account for animation-timing-function. Indeed, we
need to be careful not to merge keyframes with the same offset but a different timing function.

So we now use a std::pair<> using an offset and a timing function to compute de-duplicated keyframes.
But this showed an issue with StepsTimingFunction::operator== where we would not return true for
steps(1) and steps(1, end) since we only checked for equality for the optional keyword and did not
account for the default "end" value should the keyword not be explicit.

This ensured we correctly de-duplicated keyframes accounting for not only the offset but also
the timing function. But this then highlighted a different issue which was that our getKeyframes()
only ever expected one keyframe respectively for the 0% or 100% offsets when filling in implicit
values, which we'd just added support for in bug 234795.

So in KeyframeEffect::getKeyframes() we now compile a list of properties not explicitly specified
on any of the 0% or 100% keyframes and, as we process the first of a 0% or 100% keyframe, we set
the implicit properties.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getKeyframes):
* platform/animation/TimingFunction.h:
* style/StyleResolver.cpp:
(WebCore::Style::Resolver::keyframeStylesForAnimation):

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

5 months ago[iOS] Rebaselining after r287519.
zalan@apple.com [Sun, 2 Jan 2022 21:37:07 +0000 (21:37 +0000)]
[iOS] Rebaselining after r287519.

Unreviewed.

* platform/ios/fast/table/table-continuation-outline-paint-crash-expected.txt:

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

5 months ago[WebKit2] Camera continuity is disabled in richly editable content
wenson_hsieh@apple.com [Sun, 2 Jan 2022 20:19:40 +0000 (20:19 +0000)]
[WebKit2] Camera continuity is disabled in richly editable content
https://bugs.webkit.org/show_bug.cgi?id=234773
rdar://46323417

Reviewed by Darin Adler.

Source/WebKit:

`-[WKWebView validRequestorForSendType:returnType:]` currently never returns a nonnull result when the given
send type is nil, because `WebViewImpl::validRequestorForSendAndReturnTypes` only sets `isValidSendType` to
anything other than false if `sendType` is nonnull. Instead of doing this, we should match legacy WebKit
behavior by treating the send type as "valid" if it's nil.

Test: NSResponderTests.ValidRequestorForReturnTypes

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

Source/WebKitLegacy/mac:

Drive-by fix: add a missing `ALLOW_DEPRECATED_DECLARATIONS_END` for the unbalanced BEGIN declaration.

* WebView/WebHTMLView.mm:
(+[WebHTMLView _insertablePasteboardTypes]):

Tools:

Add an API test to verify that the result of `-validRequestorForSendType:returnType:` isn't always `nil` in the
case where there is no send type.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/NSResponderTests.mm: Added.
(TestWebKitAPI::TEST):

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

5 months agoFollowup to r287494
wenson_hsieh@apple.com [Sun, 2 Jan 2022 19:05:11 +0000 (19:05 +0000)]
Followup to r287494
https://bugs.webkit.org/show_bug.cgi?id=234747
rdar://85899879

Reviewed by Darin Adler.

Use `auto` instread of `RefPtr` when storing the result of `enclosingImageElement()` in a few places; this
method already returns a `RefPtr`.

* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::updateAttributes):
(WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):

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

5 months ago[LFC][Integration] RenderBlockFlow::containsNonZeroBidiLevel should use iterator
antti@apple.com [Sun, 2 Jan 2022 18:48:04 +0000 (18:48 +0000)]
[LFC][Integration] RenderBlockFlow::containsNonZeroBidiLevel should use iterator
https://bugs.webkit.org/show_bug.cgi?id=234796

Reviewed by Alan Bujtas.

Also rename Line::first/lastRun -> Line::first/lastLeafBox for consistency and accuracy.

* editing/VisibleUnits.cpp:
(WebCore::startPositionForLine):
(WebCore::endPositionForLine):
(WebCore::previousLinePosition):
(WebCore::nextLinePosition):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
* layout/integration/InlineIteratorLine.cpp:
(WebCore::InlineIterator::Line::firstLeafBox const):
(WebCore::InlineIterator::Line::lastLeafBox const):
(WebCore::InlineIterator::Line::closestRunForLogicalLeftPosition const):
(WebCore::InlineIterator::Line::selectionState const):
(WebCore::InlineIterator::Line::firstSelectedBox const):
(WebCore::InlineIterator::Line::lastSelectedBox const):
(WebCore::InlineIterator::Line::firstRun const): Deleted.
(WebCore::InlineIterator::Line::lastRun const): Deleted.
* layout/integration/InlineIteratorLine.h:
* layout/integration/InlineIteratorLineLegacyPath.h:
(WebCore::InlineIterator::LineIteratorLegacyPath::firstLeafBox const):
(WebCore::InlineIterator::LineIteratorLegacyPath::lastLeafBox const):
(WebCore::InlineIterator::LineIteratorLegacyPath::firstRun const): Deleted.
(WebCore::InlineIterator::LineIteratorLegacyPath::lastRun const): Deleted.
* layout/integration/InlineIteratorLineModernPath.h:
(WebCore::InlineIterator::LineIteratorModernPath::firstLeafBox const):
(WebCore::InlineIterator::LineIteratorModernPath::lastLeafBox const):
(WebCore::InlineIterator::LineIteratorModernPath::firstRun const): Deleted.
(WebCore::InlineIterator::LineIteratorModernPath::lastRun const): Deleted.
* layout/integration/InlineIteratorLogicalOrderTraversal.h:
(WebCore::InlineIterator::leafBoxesInLogicalOrder):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::containsNonZeroBidiLevel const):
(WebCore::RenderBlockFlow::positionForPointWithInlineChildren):
* style/InlineTextBoxStyle.cpp:
(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):

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

5 months ago[LFC][Integration] Support outlines
antti@apple.com [Sun, 2 Jan 2022 18:30:52 +0000 (18:30 +0000)]
[LFC][Integration] Support outlines
https://bugs.webkit.org/show_bug.cgi?id=234766

Reviewed by Alan Bujtas.

Source/WebCore:

Outlines should not require legacy line layout.

* layout/integration/InlineIteratorInlineBox.cpp:
(WebCore::InlineIterator::firstInlineBoxFor):
(WebCore::InlineIterator::firstRootInlineBoxFor):

Add iterator support for getting inline boxes from renderer.

* layout/integration/InlineIteratorInlineBox.h:
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForRenderInlineChild):
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
* layout/integration/LayoutIntegrationCoverage.h:
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::firstInlineBoxFor const):
(WebCore::LayoutIntegration::LineLayout::firstRootInlineBox const):
(WebCore::LayoutIntegration::LineLayout::paint):

Support outline painting.

* layout/integration/LayoutIntegrationLineLayout.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::addFocusRingRectsForInlineChildren):

Port to use iterator.

* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutline):

Port to use iterator.

LayoutTests:

* fast/repaint/focus-ring-repaint-expected.txt:
* platform/ios/fast/table/table-continuation-outline-paint-crash-expected.txt:
* platform/mac/fast/table/table-continuation-outline-paint-crash-expected.txt:

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

5 months ago[Web Animations] getKeyframes() should ensure that all properties are present on...
graouts@webkit.org [Sun, 2 Jan 2022 17:59:08 +0000 (17:59 +0000)]
[Web Animations] getKeyframes() should ensure that all properties are present on 0% and 100% keyframes
https://bugs.webkit.org/show_bug.cgi?id=234795

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark a WPT progressions.

* web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt:

Source/WebCore:

Keyframes at 0% and 100% may not explicitly specify properties animated on intermediate keyframes, so
in the case of such keyframes, we must ensure we output the non-animated value for properties not
explicitly specified on the keyframe style.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getKeyframes):

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

5 months ago[Web Animations] getKeyframes() should return an empty object when there are no anima...
graouts@webkit.org [Sun, 2 Jan 2022 16:12:37 +0000 (16:12 +0000)]
[Web Animations] getKeyframes() should return an empty object when there are no animatable properties in @keyframes rule
https://bugs.webkit.org/show_bug.cgi?id=234793

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark a new WPT progression.

* web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt:

Source/WebCore:

If the keyframes for an animation result from a declarative source, let's not output any data if none of the properties
are animatable.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getKeyframes):
* rendering/style/KeyframeList.cpp:
(WebCore::KeyframeList::containsAnimatableProperty const):
* rendering/style/KeyframeList.h:

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

5 months agoRemove unused AbstractMacroAssembler::repatchJumpToNop() function
commit-queue@webkit.org [Sun, 2 Jan 2022 15:38:03 +0000 (15:38 +0000)]
Remove unused AbstractMacroAssembler::repatchJumpToNop() function
https://bugs.webkit.org/show_bug.cgi?id=234777

Patch by Zan Dobersek <zdobersek@igalia.com> on 2022-01-02
Reviewed by Yusuke Suzuki.

Remove the unused AbstractMacroAssembler::repatchJumpToNop() function,
along with the underlying relinkJumpToNop() functions on ISA-specific
assembler classes.

* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::relinkJumpToNop): Deleted.
* assembler/ARMv7Assembler.h:
(JSC::ARMv7Assembler::relinkJumpToNop): Deleted.
* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::repatchJumpToNop): Deleted.
* assembler/MIPSAssembler.h:
(JSC::MIPSAssembler::relinkJumpToNop): Deleted.
* assembler/RISCV64Assembler.h:
(JSC::RISCV64Assembler::relinkJumpToNop): Deleted.
* assembler/X86Assembler.h:
(JSC::X86Assembler::relinkJumpToNop): Deleted.

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

5 months agoInlineTextItems should never split inside surrogate pairs
zalan@apple.com [Sun, 2 Jan 2022 15:07:58 +0000 (15:07 +0000)]
InlineTextItems should never split inside surrogate pairs
https://bugs.webkit.org/show_bug.cgi?id=234791

Reviewed by Antti Koivisto.

This check was added (r285016) to handle the case if the start position in TextUtil::breakWord is
inside a surrogate pair. However we should never have surrogate pairs split across InlineTextItems.
This incorrect state was caused by the bogus "let's keep the first character on the current line" logic
-which could also lead to a visually broken rendering.
(Note that fast/text/word-break-letter-spacing-utf16-surrogates.html passes without the early return)

* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::breakWord):
(WebCore::Layout::TextUtil::firstUserPerceivedCharacterLength):

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

5 months ago[LFC][IFC] Nested inline box continuation fails to omit margin/border/padding start...
zalan@apple.com [Sun, 2 Jan 2022 15:05:28 +0000 (15:05 +0000)]
[LFC][IFC] Nested inline box continuation fails to omit margin/border/padding start/end values
https://bugs.webkit.org/show_bug.cgi?id=234789

Reviewed by Antti Koivisto.

Source/WebCore:

Nested inline boxes inside continuation do not have block parents. It's sufficient to check
for the continuation bits.

Test: fast/inline/unexpected-start-end-decoration-with-nested-continuation.html

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):

LayoutTests:

* fast/inline/unexpected-start-end-decoration-with-nested-continuation-expected.html: Added.
* fast/inline/unexpected-start-end-decoration-with-nested-continuation.html: Added.

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

5 months ago[RISCV64] Make DFG, FTL, B3, WASM buildable on CPU(RISCV64)
commit-queue@webkit.org [Sun, 2 Jan 2022 10:32:22 +0000 (10:32 +0000)]
[RISCV64] Make DFG, FTL, B3, WASM buildable on CPU(RISCV64)
https://bugs.webkit.org/show_bug.cgi?id=234775

Patch by Zan Dobersek <zdobersek@igalia.com> on 2022-01-02
Reviewed by Yusuke Suzuki.

Enable building DFG, FTL, B3 and WASM subsystems on 64-bit RISC-V.
Necessary guards and missing bits are added to make things buildable,
but actual enabling of these features at build-time is left for later.
Even when enabled at build-time in the future, there'll likey be open
issues that will require disabling different features at run-time.

MacroAssemblerRISCV64::setCarry() no-op method is added for now. Carry
flag retrieval isn't exactly possible on RISC-V, so the uses of it will
have to be addressed some other way.

The patchpointScratchRegister value is defined for CPU(RISCV64). As
on ARM64, the value matches MacroAssemblerRISCV64::dataTempRegister.

In B3, we follow ARM64 in the pinned extended-offset-address use and
stack argument lowering.

in WASM, we can again mirror ARM64 around LLInt callee registers and
slots as well as executing the epilogue of a OSR-entry callee.

* assembler/MacroAssembler.h: Provide lea64() for CPU(RISCV64) as well.
* assembler/MacroAssemblerRISCV64.h:
* b3/B3Common.cpp:
(JSC::B3::pinnedExtendedOffsetAddrRegister):
* b3/air/AirLowerStackArgs.cpp:
(JSC::B3::Air::lowerStackArgs):
* jit/GPRInfo.h:
* wasm/WasmCallee.cpp:
(JSC::Wasm::LLIntCallee::calleeSaveRegisters):
* wasm/WasmLLIntPlan.cpp:
(JSC::Wasm::LLIntPlan::didCompleteCompilation):
* wasm/WasmOperations.cpp:
(JSC::Wasm::doOSREntry):

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

5 months ago[RISCV64] Enable building LLInt WebAssembly via the riscv64 offlineasm backend
commit-queue@webkit.org [Sun, 2 Jan 2022 09:12:42 +0000 (09:12 +0000)]
[RISCV64] Enable building LLInt WebAssembly via the riscv64 offlineasm backend
https://bugs.webkit.org/show_bug.cgi?id=234776

Patch by Zan Dobersek <zdobersek@igalia.com> on 2022-01-02
Reviewed by Yusuke Suzuki.

Sprinkle RISCV64 conditions around WebAssembly.asm as appropriate.
For division, we can reuse the divi(s)/divq(s) instructions already
available in offlineasm. RISC-V additionally provides remainder
instructions, so the necessary offlineasm instructions are added
and used for RISCV64.

In the offlineasm riscv64 backend, the division and remainder
instruction handling is improved to properly cover signed and unsigned
variants. For other instructions used in LLint WebAssembly
implementation like left or right rotation, trailing- or leading-zero
counting, order-based floating-point comparison, load-reserved and
store-conditional operations, the riscv64WASMPlaceholder helper is used
to generate an ebreak instruction that will halt the program at runtime
but will not throw a build-time error. Proper implementations will be
provided once WebAssembly support on RISCV64 is taken up.

* llint/WebAssembly.asm:
* offlineasm/instructions.rb:
* offlineasm/riscv64.rb:

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

5 months ago[RISCV64] Get testmasm building for CPU(RISCV64)
commit-queue@webkit.org [Sun, 2 Jan 2022 09:07:58 +0000 (09:07 +0000)]
[RISCV64] Get testmasm building for CPU(RISCV64)
https://bugs.webkit.org/show_bug.cgi?id=234774

Patch by Zan Dobersek <zdobersek@igalia.com> on 2022-01-02
Reviewed by Yusuke Suzuki.

Add missing MacroAssemblerRISCV64 methods used in testmasm. Placeholders
are used for now, proper implementations will be introduced later.

In testmasm itself, we avoid testing the condition-flags register values
since, like on MIPS, that register isn't available on RISC-V.

* assembler/MacroAssemblerRISCV64.h:
* assembler/testmasm.cpp:
(JSC::testProbeModifiesStackPointer):
(JSC::testProbeModifiesStackValues):

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

5 months ago[JSC] Replace UDIS86 with Zydis
ysuzuki@apple.com [Sun, 2 Jan 2022 08:20:28 +0000 (08:20 +0000)]
[JSC] Replace UDIS86 with Zydis
https://bugs.webkit.org/show_bug.cgi?id=234765

Reviewed by Michael Saboff.

Source/JavaScriptCore:

UDIS86 is not updated from 2014. Since it is missing relatively new SIMD opcodes,
we cannot disassemble these opcodes when implementing Wasm SIMD.
This patch replaces UDIS86 with Zydis, which is actively developed and used in
SpiderMonkey too. It is under MIT license.

This patch imports Zydis v3.2.1.

    1. Import header and C files of Zydis and Zycore in a flattened manner.
    2. Add directory names to the files (e.g. `Zydis/Decoder.c` => `ZydisDecoder.c`) to make it easy to build in JSC build.
    3. Replace header includes from `#include <Zydis/XXX.h>` to `#include "ZydisXXX.h"`.
    4. Fix compile errors with our stricter compiler flags.
    5. Remove Zycore API files and ZycoreArgParse.[hc] since they are not used.

We didn't add files to Sources.txt since unified builds do not support C files currently.

Source/WTF:

* wtf/PlatformEnable.h:

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

5 months ago"animation" shorthand does not parse values in the right order
graouts@webkit.org [Sun, 2 Jan 2022 07:22:11 +0000 (07:22 +0000)]
"animation" shorthand does not parse values in the right order
https://bugs.webkit.org/show_bug.cgi?id=234788

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark a new WPT progression.

* web-platform-tests/css/css-animations/parsing/animation-valid-expected.txt:

Source/WebCore:

The animation-name should be parsed last, not first.

* css/CSSProperties.json:

LayoutTests:

Update the order in which animation-name is serialized in the "animation" shorthand
for some non-WPT tests.

* fast/css/longhand-overrides-shorthand-prefixing-expected.txt:
* fast/css/longhand-overrides-shorthand-prefixing.html:
* fast/css/transform-inline-style-remove-expected.txt:

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

5 months ago[GTK] Unreviewed test gardening, update flakey tests expectations
dpino@igalia.com [Sun, 2 Jan 2022 01:06:42 +0000 (01:06 +0000)]
[GTK] Unreviewed test gardening, update flakey tests expectations
https://bugs.webkit.org/show_bug.cgi?id=234760

Remove tests that have been constantly passing for the last 4000 revisions, as well as update state of tests
that have been constantly failing with a single state.

* platform/gtk/TestExpectations:
* platform/gtk/fast/events/wheel/wheelevent-in-horizontal-scrollbar-in-rtl-expected.txt:
* platform/gtk/fast/events/wheel/wheelevent-in-vertical-scrollbar-in-rtl-expected.txt:
* platform/wpe/TestExpectations:

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

5 months agoScalableImageDecoder should be using SharedBuffer instead of DataSegment
jya@apple.com [Sun, 2 Jan 2022 00:19:00 +0000 (00:19 +0000)]
ScalableImageDecoder should be using SharedBuffer instead of DataSegment
https://bugs.webkit.org/show_bug.cgi?id=233441
rdar://problem/85854204

Reviewed by Darin Adler.

DataSegment should be a SharedBuffer's implementation details and not
be used outside SharedBuffer's code.
Historically, using the inner DataSegment was required as it was thread
safe while SharedBuffer wasn't: This is no longer the case.
SharedBuffer and DataSegment are semantically very similar, so this is
mostly a find/replace change.
Flattening the FragmentedSharedBuffer is still required as most decoders
require reading the raw bytes.

No change in observable behaviour.

* platform/graphics/ImageBackingStore.h:
(WebCore::ImageBackingStore::setSize):
(WebCore::ImageBackingStore::ImageBackingStore):
* platform/image-decoders/ScalableImageDecoder.h:
* platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::parseHeader):
(WebCore::AVIFImageReader::decodeFrame):
* platform/image-decoders/avif/AVIFImageReader.h:
* platform/image-decoders/bmp/BMPImageReader.h:
(WebCore::BMPImageReader::readUint16):
(WebCore::BMPImageReader::readUint32):
(WebCore::BMPImageReader::setData):
* platform/image-decoders/gif/GIFImageReader.h:
(GIFImageReader::setData):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageReader::decode):
* platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:
(WebCore::JPEG2000ImageDecoder::decode):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageReader::decode):
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decode):

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

5 months agomake SharedBuffer::copy() return a contiguous SharedBuffer
jya@apple.com [Sun, 2 Jan 2022 00:09:19 +0000 (00:09 +0000)]
make SharedBuffer::copy() return a contiguous SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=234622
rdar://problem/86829527

Reviewed by Darin Adler.

Source/WebCore:

make SharedBuffer::copy() return a contiguous SharedBuffer

API tests added.

* platform/SharedBuffer.cpp:
(WebCore::FragmentedSharedBuffer::copy const):

Tools:

* TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F):

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

5 months agoModal containers are incorrectly detected in navigation elements and fixed document...
wenson_hsieh@apple.com [Sat, 1 Jan 2022 23:06:26 +0000 (23:06 +0000)]
Modal containers are incorrectly detected in navigation elements and fixed document elements
https://bugs.webkit.org/show_bug.cgi?id=234669
rdar://87030613

Reviewed by Darin Adler.

Source/WebCore:

Avoid false positives when detecting modal containers in the following scenarios:
- Fixed-position document elements that contain the search term.
- Text that contains the search term inside fixed-position navigation elements.

Additionally, ensure that we unhide the current modal container in the event of a false positive where we find
no element that fulfills the criteria for being a classifiable control.

Tests:  ModalContainerObservation.IgnoreFixedDocumentElement
        ModalContainerObservation.IgnoreNavigationElements
        ModalContainerObservation.ShowModalContainerAfterFalsePositive

* page/ModalContainerObserver.cpp:
(WebCore::accessibilityRole):

Move this static helper function farther up this source file, so that we can use it inside
`updateModalContainerIfNeeded()`.

(WebCore::isInsideNavigationElement):
(WebCore::ModalContainerObserver::updateModalContainerIfNeeded):
(WebCore::ModalContainerPolicyDecisionScope::ModalContainerPolicyDecisionScope):
(WebCore::ModalContainerPolicyDecisionScope::~ModalContainerPolicyDecisionScope):
(WebCore::ModalContainerPolicyDecisionScope::continueHidingModalContainerAfterScope):
(WebCore::ModalContainerPolicyDecisionScope::document const):

Add a RAII helper object to ensure that the modal container is revealed at the end of the modal container policy
decision scope, unless `continueHidingModalContainerAfterScope()` is invoked. Since this class contains a
`WeakPtr<Document>` already, we can replace the `WeakPtr<Document>` we're currently plumbing through each of the
async callbacks with only the `ModalContainerPolicyDecisionScope`, and just grab the document (or null if it was
destroyed) from the scope object.

This helper object allows us to avoid sprinkling ad-hoc calls to `revealModalContainer()` when exiting modal
container classification codepaths.

(WebCore::ModalContainerObserver::collectClickableElementsTimerFired):
* page/ModalContainerObserver.h:

Tools:

Add several new API tests to exercise the changes.

* TestWebKitAPI/Tests/WebKitCocoa/ModalContainerObservation.mm:
(-[ModalContainerWebView initWithFrame:configuration:]):
(-[ModalContainerWebView loadHTML:]):
(-[ModalContainerWebView _webView:decidePolicyForModalContainer:decisionHandler:]):
(TestWebKitAPI::TEST):

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

5 months ago[LFC][IFC] Unexpected line break with leading collapsed whitespace
zalan@apple.com [Sat, 1 Jan 2022 22:54:52 +0000 (22:54 +0000)]
[LFC][IFC] Unexpected line break with leading collapsed whitespace
https://bugs.webkit.org/show_bug.cgi?id=234786

Reviewed by Antti Koivisto.

Source/WebCore:

We use Line::hasContent to decide whether an overflowing content should be wrapped to the next line.
Line is considered empty unless it has at least one content-type run.

Test: fast/inline/unexpected-line-break-on-empty-content.html

* layout/formattingContexts/inline/InlineLine.h:
(WebCore::Layout::Line::hasContent const):

LayoutTests:

* fast/inline/unexpected-line-break-on-empty-content-expected.html: Added.
* fast/inline/unexpected-line-break-on-empty-content.html: Added.

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

5 months ago[Cocoa] Simplify some FontAttributes API tests
wenson_hsieh@apple.com [Sat, 1 Jan 2022 21:03:23 +0000 (21:03 +0000)]
[Cocoa] Simplify some FontAttributes API tests
https://bugs.webkit.org/show_bug.cgi?id=234770

Reviewed by Darin Adler.

Simplify some of the logic around FontAttributes.FontAttributesAfterChangingSelection:
1.  Instead of defining PlatformColor/PlatformFont, use CocoaColor/CocoaFont from WebCore.
2.  Remove the `Nullity` flag in ShadowExpectation and ColorExpectation (and use `std::optional` instead to
    indicate that the shadow or font attribute should be null).
3.  Change a several rvalue references to be plain values instead (when passinng expectation structs that only
    contain a handful of scalar values).

* TestWebKitAPI/Tests/WebKitCocoa/FontAttributes.mm:
(TestWebKitAPI::checkColor):
(TestWebKitAPI::checkShadow):
(TestWebKitAPI::checkFont):
(TestWebKitAPI::TEST):
(TestWebKitAPI::ColorExpectation::ColorExpectation): Deleted.
(TestWebKitAPI::ShadowExpectation::ShadowExpectation): Deleted.

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

5 months agoUpdate user-visible copyright strings to include 2022
jeffm@apple.com [Sat, 1 Jan 2022 16:25:38 +0000 (16:25 +0000)]
Update user-visible copyright strings to include 2022
https://bugs.webkit.org/show_bug.cgi?id=234263

Reviewed by Anders Carlsson.

.:

* Source/cmake/tools/scripts/COPYRIGHT-END-YEAR:

Source/JavaScriptCore:

* Info.plist:

Source/WebCore:

* Info.plist:

Source/WebGPU:

* Info.plist:

Source/WebKit:

* GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist:
* GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist:
* Info.plist:
* NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist:
* NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist:
* WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-OSX.plist:
* WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist:
* WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist:
* WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist:

Source/WebKitLegacy/mac:

* Info.plist:

WebKitLibraries:

* win/tools/scripts/COPYRIGHT-END-YEAR:

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

5 months ago[LFC][IFC] Simple RTL content triggers redundant horizontal positioning
zalan@apple.com [Sat, 1 Jan 2022 15:34:20 +0000 (15:34 +0000)]
[LFC][IFC] Simple RTL content triggers redundant horizontal positioning
https://bugs.webkit.org/show_bug.cgi?id=234772

Reviewed by Antti Koivisto.

RTL content with inline boxes require a second pass horizontal positioning.
Currently we trigger this second pass even when the content does not have any inline box.
(e.g <div>content<span>with inline box</span></div> <div>content with no inline box</div>)

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent): !0 parentDisplayBoxNodeIndex means non-root inline box.
(WebCore::Layout::DisplayBoxTree::hasInlineBox const): Deleted.

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

5 months ago[LFC][IFC] Incorrect word-spacing gaps between RTL runs
zalan@apple.com [Sat, 1 Jan 2022 14:55:43 +0000 (14:55 +0000)]
[LFC][IFC] Incorrect word-spacing gaps between RTL runs
https://bugs.webkit.org/show_bug.cgi?id=234771

Reviewed by Antti Koivisto.

Source/WebCore:

"word-spacing" acts as a margin for word separator type of runs.
In this patch we take this margin into account the same way we do for atomic inline level boxes with margins.

Test: fast/text/word-spacing-rtl.html

* layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::Run::Run):
* layout/formattingContexts/inline/InlineLine.h:
(WebCore::Layout::Line::Run::isText const):
(WebCore::Layout::Line::Run::isWordSeparator const):
* layout/formattingContexts/inline/display/InlineDisplayBox.h:
(WebCore::InlineDisplay::Box::isText const):
(WebCore::InlineDisplay::Box::isWordSeparator const):
(WebCore::InlineDisplay::Box::isNonRootInlineLevelBox const):
(WebCore::InlineDisplay::Box::type const): Deleted.
* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
(WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):

LayoutTests:

* fast/text/word-spacing-rtl-expected.html: Added.
* fast/text/word-spacing-rtl.html: Added.

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

5 months agoRe-import css/css-writing-modes WPT
ntim@apple.com [Sat, 1 Jan 2022 14:15:48 +0000 (14:15 +0000)]
Re-import css/css-writing-modes WPT
https://bugs.webkit.org/show_bug.cgi?id=234764

Reviewed by Dean Jackson.

Upstream commit: https://github.com/web-platform-tests/wpt/commit/e433ff38f5230f3fec9c6fd434b942c7bffbfc67

LayoutTests/imported/w3c:

* resources/resource-files.json:
* web-platform-tests/css/css-writing-modes/astral-bidi/adlam-anti-ref-expected-mismatch.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/astral-bidi/adlam-anti-ref-expected.html.
* web-platform-tests/css/css-writing-modes/astral-bidi/cypriot-anti-ref-expected-mismatch.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/astral-bidi/cypriot-anti-ref-expected.html.
* web-platform-tests/css/css-writing-modes/astral-bidi/w3c-import.log:
* web-platform-tests/css/css-writing-modes/bidi-dynamic-iframe-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/bidi-dynamic-iframe-001.html: Added.
* web-platform-tests/css/css-writing-modes/bidi-plaintext-br-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/bidi-plaintext-br-001.html: Added.
* web-platform-tests/css/css-writing-modes/block-flow-direction-slr-062.xht:
* web-platform-tests/css/css-writing-modes/block-flow-direction-srl-061.xht:
* web-platform-tests/css/css-writing-modes/block-flow-direction-vlr-022.xht:
* web-platform-tests/css/css-writing-modes/block-flow-direction-vrl-021.xht:
* web-platform-tests/css/css-writing-modes/crashtests/orthogonal-percent-height-multicol-crash.html: Added.
* web-platform-tests/css/css-writing-modes/crashtests/orthogonal-scroll-percent-height-crash.html: Added.
* web-platform-tests/css/css-writing-modes/crashtests/orthogonal-table-in-flex-crash.html: Added.
* web-platform-tests/css/css-writing-modes/crashtests/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/astral-bidi/w3c-import.log.
* web-platform-tests/css/css-writing-modes/crashtests/wm-body-propagation-crash.html: Added.
* web-platform-tests/css/css-writing-modes/direction-propagation-body-contain-root-expected.html: Added.
* web-platform-tests/css/css-writing-modes/direction-propagation-body-contain-root.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-rtl-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-rtl-001.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-rtl-002-expected.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-rtl-002.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-001.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-002-expected.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-002.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-rtl-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-rtl-001.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-rtl-002-expected.html: Added.
* web-platform-tests/css/css-writing-modes/dynamic-offset-vrl-rtl-002.html: Added.
* web-platform-tests/css/css-writing-modes/full-width-001-expected-mismatch.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/full-width-001-expected.html.
* web-platform-tests/css/css-writing-modes/full-width-002-expected-mismatch.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/full-width-002-expected.html.
* web-platform-tests/css/css-writing-modes/full-width-003-expected-mismatch.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/full-width-003-expected.html.
* web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins-expected.html:
* web-platform-tests/css/css-writing-modes/inline-box-orthogonal-child-with-margins.html:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-003.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-005.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-007.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-009.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-011.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-013.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-021.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vlr-023.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vrl-002.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vrl-004.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vrl-006.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vrl-008.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vrl-010.xht:
* web-platform-tests/css/css-writing-modes/line-box-height-vrl-012.xht:
* web-platform-tests/css/css-writing-modes/logical-physical-mapping-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/logical-physical-mapping-001.html: Added.
* web-platform-tests/css/css-writing-modes/padding-percent-orthogonal-dynamic-expected.txt: Added.
* web-platform-tests/css/css-writing-modes/padding-percent-orthogonal-dynamic.html: Added.
* web-platform-tests/css/css-writing-modes/replaced-content-image-004-expected.html: Added.
* web-platform-tests/css/css-writing-modes/replaced-content-image-004.html: Added.
* web-platform-tests/css/css-writing-modes/sizing-orthog-vrl-in-htb-013-expected.xht:
* web-platform-tests/css/css-writing-modes/sizing-orthog-vrl-in-htb-013.xht:
* web-platform-tests/css/css-writing-modes/slr-alongside-vlr-floats-expected.html:
* web-platform-tests/css/css-writing-modes/slr-alongside-vlr-floats.html:
* web-platform-tests/css/css-writing-modes/srl-alongside-vrl-floats-expected.html:
* web-platform-tests/css/css-writing-modes/srl-alongside-vrl-floats.html:
* web-platform-tests/css/css-writing-modes/support/WidthTest-Regular.otf: Added.
* web-platform-tests/css/css-writing-modes/support/tcy.css: Added.
(.tcy):
(.fake-tcy):
* web-platform-tests/css/css-writing-modes/support/w3c-import.log:
* web-platform-tests/css/css-writing-modes/support/width-test.css: Added.
(@font-face):
(.test):
* web-platform-tests/css/css-writing-modes/text-combine-upright-break-inside-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-break-inside-001.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-break-inside-001a-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-break-inside-001a.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-001.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-002-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-002.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-003-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-003.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-004-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-004.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-005-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-005.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-005a-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-005a.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-006-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-006.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-006a-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-006a.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-007-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-combine-upright-compression-007.html: Added.
* web-platform-tests/css/css-writing-modes/text-orientation-upright-directionality-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-orientation-upright-directionality-001.html: Added.
* web-platform-tests/css/css-writing-modes/text-shadow-orientation-upright-001-expected.html: Added.
* web-platform-tests/css/css-writing-modes/text-shadow-orientation-upright-001.html: Added.
* web-platform-tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-expected.html:
* web-platform-tests/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html:
* web-platform-tests/css/css-writing-modes/vrl-inline-paint-invalidation-expected.html: Added.
* web-platform-tests/css/css-writing-modes/vrl-inline-paint-invalidation.html: Added.
* web-platform-tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-expected.html:
* web-platform-tests/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html:
* web-platform-tests/css/css-writing-modes/w3c-import.log:
* web-platform-tests/css/css-writing-modes/wm-propagation-body-computed-direction-001-expected.txt: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-computed-direction-001.html: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-computed-direction-002-expected.txt: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-computed-direction-002.html: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-contain-root-expected.html: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-contain-root.html: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-dynamic-change-001.html:
* web-platform-tests/css/css-writing-modes/wm-propagation-body-dynamic-change-002-expected.html:
* web-platform-tests/css/css-writing-modes/wm-propagation-body-dynamic-change-002.html:
* web-platform-tests/css/css-writing-modes/wm-propagation-body-dynamic-change-003-expected.html: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-body-dynamic-change-003.html: Added.
* web-platform-tests/css/css-writing-modes/wm-propagation-svg-root-scrollbar.svg:

LayoutTests:

* TestExpectations:
* platform/gtk/TestExpectations:

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

5 months agoReduce repetition in Internals "set page activity state" methods
tyler_w@apple.com [Sat, 1 Jan 2022 06:03:35 +0000 (06:03 +0000)]
Reduce repetition in Internals "set page activity state" methods
https://bugs.webkit.org/show_bug.cgi?id=234768

Reviewed by Darin Adler.

`setPageVisibility`, `setPageIsFocusedAndActive`, and
`setPageIsInWindow` all modify page activity state, and repeat a lot
of the same logic to do so. This patch refactors this into a common
`updatePageActivityState` method.

* testing/Internals.cpp:
(WebCore::Internals::setPageVisibility):
(WebCore::Internals::setPageIsFocusedAndActive):
(WebCore::Internals::setPageIsInWindow):
Refactor to use the new updatePageActivityState method.
(WebCore::Internals::updatePageActivityState):
Added.
* testing/Internals.h:

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

5 months agoInclude a few more tag names to search when running modal container detection
wenson_hsieh@apple.com [Sat, 1 Jan 2022 00:22:38 +0000 (00:22 +0000)]
Include a few more tag names to search when running modal container detection
https://bugs.webkit.org/show_bug.cgi?id=234652

Reviewed by Darin Adler.

Source/WebCore:

Broaden the list of tag names that we heuristically scan for the search term. This particular modal container
detection failure was due to the search term appearing inside a `b` element, though I'm adding a few additional
types just to be safe. Since we're checking more than just few tag names, we also take this opportunity to
convert this into a compact AtomString hashtable of tag names that we should scan in the process of detecting
modal containers.

Test: ModalContainerObservation.DetectSearchTermInBoldTag

* page/ModalContainerObserver.cpp:
(WebCore::matchesSearchTerm):

Tools:

Add an API test that's representative of the website where modal container observation failed (due to the search
term being inside a `b` element).

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

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

5 months agoRefactor some Cocoa-specific code in WebCore::FontAttributes to be platform-agnostic
wenson_hsieh@apple.com [Fri, 31 Dec 2021 23:33:52 +0000 (23:33 +0000)]
Refactor some Cocoa-specific code in WebCore::FontAttributes to be platform-agnostic
https://bugs.webkit.org/show_bug.cgi?id=234757

Source/WebCore:

Reviewed by Darin Adler.

Replace the UIFont/NSFont currently in WebCore::FontAttributes with a WebCore::Font instead. This removes a bit
of platform-specific logic in an otherwise platform-agnostic class (with the exception of a couple Cocoa-
specific helper methods). This additionally lets us remove some platform-specific logic for computing font
attributes (i.e. `platformFontAttributesAtSelectionStart`) below.

* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::fontAttributesAtSelectionStart):
(WebCore::Editor::platformFontAttributesAtSelectionStart const): Deleted.
* editing/Editor.h:
* editing/FontAttributes.h:
(WebCore::TextList::encode const):
(WebCore::TextList::decode):

Drive-by fix: instead of `static_cast`-ing to a uint8_t and encoding/decoding the raw value, encode and decode
the ListStyleType as a normal enum instead. This also ensures that we validate the enum value upon decoding.

(WebCore::FontAttributes::encodingRequiresPlatformData const): Deleted.
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::platformFontAttributesAtSelectionStart const): Deleted.
* editing/cocoa/FontAttributesCocoa.mm:
(WebCore::FontAttributes::createDictionary const):

Only grab the NSFont or UIFont from the WebCore::Font object once we're in this Cocoa-specific helper.

* platform/graphics/cocoa/FontCocoa.h: Added.

Moved here from CocoaFont.h in WebKit. See WebKit/ChangeLog for more details.

* rendering/style/RenderStyleConstants.h:

Add EnumTraits for ListStyleType, so that it can be encoded/decoded.

Source/WebKit:

See comments below (as well as WebCore/ChangeLog) for more details.

Reviewed by Darin Adler.

* Platform/cocoa/CocoaFont.h: Removed.

Move this file into WebCore, as `FontCocoa.h`.

* Shared/Cocoa/ArgumentCodersCocoa.mm:
* Shared/Cocoa/CoreTextHelpers.h:
* Shared/Cocoa/CoreTextHelpers.mm:

Adjust a few places that currently import CocoaFont.h to import WebCore/FontCocoa.h instead. Additonally, change
CocoaFont to WebCore::CocoaFont where necessary.

* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::FontAttributes>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<WebCore::FontAttributes>::decodePlatformData): Deleted.

Remove platform-specific FontAttributes encoding/decoding logic. This is no longer needed, since we just
propagate a Font instead of an NSFont or UIFont.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<RefPtr<Font>>::encode):
(IPC::ArgumentCoder<RefPtr<Font>>::decode):

Add argument coders for `RefPtr<Font>` that encode the font only if it's non-null.

(IPC::ArgumentCoder<FontAttributes>::encode):
(IPC::ArgumentCoder<FontAttributes>::decode):

Remove the calls to `encodePlatformData/decodePlatformData`, and instead encode the `RefPtr<WebCore::Font>`.

* Shared/WebCoreArgumentCoders.h:
* Shared/playstation/WebCoreArgumentCodersPlayStation.cpp:
(IPC::ArgumentCoder<FontAttributes>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<FontAttributes>::decodePlatformData): Deleted.
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<FontAttributes>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<FontAttributes>::decodePlatformData): Deleted.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(IPC::ArgumentCoder<FontAttributes>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<FontAttributes>::decodePlatformData): Deleted.

Remove some method stubs that are now unnecessary.

* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(fontOfSize):
* WebKit.xcodeproj/project.pbxproj:

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

5 months agoREGRESSION (r287028): Incorrect root inline box horizontal position when text-align...
zalan@apple.com [Fri, 31 Dec 2021 20:08:22 +0000 (20:08 +0000)]
REGRESSION (r287028): Incorrect root inline box horizontal position when text-align offset is present
https://bugs.webkit.org/show_bug.cgi?id=234767

Reviewed by Antti Koivisto.

Source/WebCore:

Display line has the content's visual left (rtl vs ltr) which should be used to position the root inline box.
We use the same offset when construcing the non-root display boxes.

Test: fast/text/root-inline-box-offset-with-text-align.html

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):

LayoutTests:

* fast/text/root-inline-box-offset-with-text-align-expected.html: Added.
* fast/text/root-inline-box-offset-with-text-align.html: Added.

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

5 months agoUpdating the file name of attachment-backed images should automatically set the ...
wenson_hsieh@apple.com [Fri, 31 Dec 2021 19:46:47 +0000 (19:46 +0000)]
Updating the file name of attachment-backed images should automatically set the `alt` attribute
https://bugs.webkit.org/show_bug.cgi?id=234747
rdar://85899879

Reviewed by Darin Adler.

Source/WebCore:

Make a small adjustment when updating attachment attributes for attachment-backed images (i.e. when using
`-[_WKAttachmentInfo setFileWrapper:contentType:completion:]`), such that the `alt` attribute of the image is
set to the attachment element's `title`. While convenient for all internal clients of the `_WKAttachment` SPI
(i.e. Mail, Notes), this has the added benefit of preserving the attachment's file name when copying and pasting
across different web views (where a new `API::Attachment` is generated on paste), instead of defaulting to the
last path component of the blob URL corresponding to the image data in the web archive.

Test: WKAttachmentTests.CopyAndPasteImageBetweenWebViews

* editing/Editor.cpp:
(WebCore::Editor::notifyClientOfAttachmentUpdates):
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::enclosingImageElement const):
(WebCore::HTMLAttachmentElement::updateAttributes):
(WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
(WebCore::HTMLAttachmentElement::hasEnclosingImage const): Deleted.

Replace `hasEnclosingImage()` with `enclosingImageElement()`, a helper that returns the enclosing image element
(or null if there is none). We use the latter in a couple of places above, where we modify some attributes on
the enclosing image in response to attribute and data updates.

* html/HTMLAttachmentElement.h:

Tools:

Add a new API test to exercise this scenario -- i.e. copying an attachment-backed image in one web view, pasting
it into another web view, and confirming that the pasted attachment preserves the _WKAttachment file name.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(-[TestWKWebView ensureAttachmentForImageElement]):
(TestWebKitAPI::TEST):

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

5 months ago[LFC][IFC] Take grapheme clusters into account when keeping the first "character...
zalan@apple.com [Fri, 31 Dec 2021 14:21:02 +0000 (14:21 +0000)]
[LFC][IFC] Take grapheme clusters into account when keeping the first "character" on the line
https://bugs.webkit.org/show_bug.cgi?id=234758

Reviewed by Antti Koivisto.

When dealing with complex fonts, we have to start looking beyond code points and taking
larger cluster of code units into account.

This patch is in preparation for enabling complex font codepath.

* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::firstUserPerceivedCharacterLength): user-perceived character is a unicode term.
see https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries
* layout/formattingContexts/inline/text/TextUtil.h:
* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/layouttree/LayoutInlineTextBox.cpp:
(WebCore::Layout::InlineTextBox::InlineTextBox):
(WebCore::Layout::m_canUseSimpleFontCodePath):
(WebCore::Layout::m_canUseSimplifiedContentMeasuring): Deleted.
* layout/layouttree/LayoutInlineTextBox.h:
(WebCore::Layout::InlineTextBox::canUseSimpleFontCodePath const):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createTextBox):
(WebCore::Layout::TreeBuilder::createLayoutBox):
* layout/layouttree/LayoutTreeBuilder.h:

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

5 months ago[GTK][WPE] Unreviewed test gardening, move several fast/scrolling tests failures...
dpino@igalia.com [Fri, 31 Dec 2021 10:11:40 +0000 (10:11 +0000)]
[GTK][WPE] Unreviewed test gardening, move several fast/scrolling tests failures to GLIB
https://bugs.webkit.org/show_bug.cgi?id=234759

* platform/glib/TestExpectations:
* platform/gtk/TestExpectations:
* platform/wpe/TestExpectations:

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

5 months agoWeb Inspector: fix assert text in Gradient.js
ntim@apple.com [Fri, 31 Dec 2021 09:13:08 +0000 (09:13 +0000)]
Web Inspector: fix assert text in Gradient.js

Unreviewed.

Wrong assert text was added in r287409, it should be radial instead of conic gradients.

* UserInterface/Models/Gradient.js:
(WI.RadialGradient.prototype.set angleValue):
(WI.RadialGradient.prototype.set angleUnits):

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

5 months ago[GLIB] Unreviewed test gardening, update state of flakey tests
dpino@igalia.com [Fri, 31 Dec 2021 04:46:27 +0000 (04:46 +0000)]
[GLIB] Unreviewed test gardening, update state of flakey tests
https://bugs.webkit.org/show_bug.cgi?id=234749

Remove tests that have been constantly passing for the last 4000 revisions, as well as update state of tests
that have been constantly failing with a single state.

* platform/glib/TestExpectations:
* platform/glib/imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.https.any.worker-expected.txt: Removed.
* platform/glib/imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.https.any-expected.txt: Removed.
* platform/glib/imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.https.worker-expected.txt: Removed.
* platform/glib/media/context-menu-actions-expected.txt: Removed.
* platform/gtk/TestExpectations:

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

5 months agoSharedBuffer::takeData() is still dangerous
jya@apple.com [Fri, 31 Dec 2021 03:20:12 +0000 (03:20 +0000)]
SharedBuffer::takeData() is still dangerous
https://bugs.webkit.org/show_bug.cgi?id=234724
rdar://problem/86957233

Reviewed by Darin Adler.

Source/WebCore:

Similar to bug 228161; however we only take the content of the DataSegment
if its refcount is 1.
DataSegments can be shared across multiple SharedBuffer and so we can't
assume that when the SharedBuffer refcount is 1 that it is safe to use
the DataSegment.
This use of SharedBuffer::extractData will need to be revisited when
SharedBuffer are used across different threads as the operation isn't
thread-safe.

API tests added.

* platform/SharedBuffer.cpp:
(WebCore::FragmentedSharedBuffer::takeData):

Tools:

* TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F):

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

5 months agoREGRESSION(r286955): Fix painting text-decorations with combined text
ntim@apple.com [Fri, 31 Dec 2021 01:32:32 +0000 (01:32 +0000)]
REGRESSION(r286955): Fix painting text-decorations with combined text
https://bugs.webkit.org/show_bug.cgi?id=234707

Reviewed by Dean Jackson.

Source/WebCore:

Test: imported/w3c/web-platform-tests/css/css-writing-modes/text-combine-upright-decorations-001.html

* rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::createDecorationPainter):
(WebCore::TextBoxPainter::paintBackgroundDecorations):
(WebCore::TextBoxPainter::paintForegroundDecorations):

LayoutTests:

* TestExpectations:

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

5 months agoImplement text-combine-upright property
ntim@apple.com [Fri, 31 Dec 2021 00:26:34 +0000 (00:26 +0000)]
Implement text-combine-upright property
https://bugs.webkit.org/show_bug.cgi?id=150821

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:
* web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-in-animation-expected.txt:
* web-platform-tests/css/css-writing-modes/inheritance-expected.txt:
* web-platform-tests/css/css-writing-modes/parsing/text-combine-upright-computed-expected.txt:
* web-platform-tests/css/css-writing-modes/parsing/text-combine-upright-valid-expected.txt:
* web-platform-tests/css/css-writing-modes/text-combine-upright-parsing-digits-001-expected.txt:
* web-platform-tests/css/css-writing-modes/text-combine-upright-parsing-digits-002-expected.txt:
* web-platform-tests/css/css-writing-modes/text-combine-upright-parsing-invalid-001-expected.txt:
* web-platform-tests/css/css-writing-modes/text-combine-upright-parsing-invalid-002-expected.txt:
* web-platform-tests/css/css-writing-modes/text-combine-upright-parsing-valid-001-expected.txt:
* web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:

Source/WebCore:

webkit.org/b/234694 and webkit.org/b/234707 are landed for this initial version of text-combine-upright.

To reach Chrome parity, layout needs to be tweaked (webkit.org/b/234704), and pseudo elements need to be properly supported (webkit.org/b/234705).

To reach standards parity, it also needs the digits syntax to be implemented (webkit.org/b/234706), which no browser implements yet.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TextCombine const):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* rendering/LegacyLineLayout.cpp:
(WebCore::expansionBehaviorForInlineTextBox):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* style/PropertyAllowlist.cpp:
(WebCore::Style::isValidMarkerStyleProperty):
Allow setting text-combine-upright on ::marker.

LayoutTests:

* TestExpectations:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/getComputedStyle/resources/property-names.js:
* platform/glib/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/glib/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/glib/svg/css/getComputedStyle-basic-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/svg/css/getComputedStyle-basic-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

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

5 months agoNon-unified build fixes, end-of-year 2021 edition
aperez@igalia.com [Thu, 30 Dec 2021 22:33:31 +0000 (22:33 +0000)]
Non-unified build fixes, end-of-year 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=234755

Unreviewed non-unified build fixes.

Source/JavaScriptCore:

* runtime/DeferredWorkTimer.h: Add missing JSCast.h header.

Source/WebCore:

No new tests needed.

* bindings/js/JSExecState.cpp:
(WebCore::executionContext): Add missing namespace prefix in usage of JSC::jsCast() function.
* bindings/js/SerializedScriptValue.cpp: Add missing JSExecState.h header.
* inspector/InspectorFrontendHost.cpp: Add missing ScriptController.h header.
* inspector/WebInjectedScriptManager.cpp: Add missing DOMWindow.h and JSExecState.h headers.
* inspector/agents/InspectorTimelineAgent.cpp: Add missing JSExecState.h header.
* inspector/agents/WebConsoleAgent.cpp: Add missing InspectorWebAgentBase.h and
JSExecState.h headers.
* inspector/agents/WebConsoleAgent.h: Add missing forward declaration of struct
WebAgentContext.
* layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp: Add missing
LayoutBoxGeometry.h header.
* loader/CrossOriginAccessControl.cpp: Add missing DocumentLoader.h header.

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

5 months ago[IFC][Integration] Enable RTL inline base direction
zalan@apple.com [Thu, 30 Dec 2021 20:32:03 +0000 (20:32 +0000)]
[IFC][Integration] Enable RTL inline base direction
https://bugs.webkit.org/show_bug.cgi?id=234736

Reviewed by Antti Koivisto.

Source/WebCore:

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForStyle):

LayoutTests:

* platform/ios-wk2/fast/text/international/rtl-white-space-pre-wrap-expected.txt:
* platform/ios/fast/block/basic/016-expected.txt:
* platform/ios/fast/borders/rtl-border-04-expected.txt:
* platform/ios/fast/css/text-overflow-ellipsis-bidi-expected.txt:
* platform/ios/fast/css/text-overflow-input-expected.txt:
* platform/ios/fast/dom/34176-expected.txt:
* platform/ios/fast/dom/52776-expected.txt:
* platform/ios/fast/dom/HTMLElement/bdo-expected.txt:
* platform/ios/fast/forms/input-text-scroll-left-on-blur-expected.txt:
* platform/ios/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt:
* platform/ios/fast/text/international/bidi-neutral-run-expected.txt:
* platform/ios/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt:
* platform/ios/fast/text/international/rtl-white-space-pre-wrap-expected.txt:
* platform/mac-bigsur/fast/dom/52776-expected.txt:
* platform/mac-bigsur/fast/text/international/bidi-neutral-run-expected.txt:
* platform/mac-catalina/fast/css/text-overflow-input-expected.txt:
* platform/mac/fast/block/basic/016-expected.txt:
* platform/mac/fast/borders/rtl-border-05-expected.txt:
* platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt:
* platform/mac/fast/css/text-overflow-input-expected.txt:
* platform/mac/fast/dom/34176-expected.txt:
* platform/mac/fast/dom/52776-expected.txt:
* platform/mac/fast/dom/HTMLElement/bdo-expected.txt:
* platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt:
* platform/mac/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt:
* platform/mac/fast/text/international/bidi-layout-across-linebreak-expected.txt:
* platform/mac/fast/text/international/bidi-neutral-run-expected.txt:
* platform/mac/fast/text/international/bidi-override-expected.txt:
* platform/mac/fast/text/international/rtl-white-space-pre-wrap-expected.txt:
* platform/mac/fast/text/text-letter-spacing-expected.txt:

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

5 months ago[LFC][IFC] Non-empty inline boxes construction should be driven by their content
zalan@apple.com [Thu, 30 Dec 2021 14:32:45 +0000 (14:32 +0000)]
[LFC][IFC] Non-empty inline boxes construction should be driven by their content
https://bugs.webkit.org/show_bug.cgi?id=234744

Reviewed by Antti Koivisto.

At bidi paragraph processing, we assign bidi levels to inline items. Normally only content type
of inline items need bidi levels as inline box start(end) visual order is driven by their content.
However there are 2 cases when inline box start require bidi level
  - empty inline boxes (1<span></span>2) -so that we can find out their position.
  - inline boxes with unicode-bidi style -they change their content's bidi behavior.
In this patch we ignore the second type of inline boxes at display box construction
as they may trigger redundant inline boxes on the line (as we create them for their content).

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):

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

5 months ago[LFC][IFC] Add support for -webkit-rtl-ordering
zalan@apple.com [Thu, 30 Dec 2021 01:29:37 +0000 (01:29 +0000)]
[LFC][IFC] Add support for -webkit-rtl-ordering
https://bugs.webkit.org/show_bug.cgi?id=234715

Reviewed by Antti Koivisto.

"-webkit-rtl-ordering: visual" introduces EUnicodeBidi::Override on the block level
(apparently it has no effect on inline boxes).

* layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::handleEnterExitBidiContext):
(WebCore::Layout::buildBidiParagraph):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForStyle):
* layout/integration/LayoutIntegrationCoverage.h:

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

5 months ago[LFC][IFC] Collapsed trailing whitespace may introduce stray inline box
zalan@apple.com [Wed, 29 Dec 2021 21:07:10 +0000 (21:07 +0000)]
[LFC][IFC] Collapsed trailing whitespace may introduce stray inline box
https://bugs.webkit.org/show_bug.cgi?id=234735

Reviewed by Antti Koivisto.

Source/WebCore:

See the comment in LineBuilder::handleInlineContent.

Test: fast/inline/inline-box-with-collapsed-whitespace.html

* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::handleInlineContent):

LayoutTests:

* fast/inline/inline-box-with-collapsed-whitespace-expected.html: Added.
* fast/inline/inline-box-with-collapsed-whitespace.html: Added.

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

5 months agoAdd additional named color spaces for extended rgb color types and HSL/HWB in prepara...
weinig@apple.com [Wed, 29 Dec 2021 20:20:09 +0000 (20:20 +0000)]
Add additional named color spaces for extended rgb color types and HSL/HWB in preparation for out of gamut and missing component support
https://bugs.webkit.org/show_bug.cgi?id=234741

Reviewed by Dean Jackson.

Source/WebCore:

Adds named color space support, which provides the ability for a color type to live
in a Color, for the following color spaces:

    ExtendedA98RGB
    ExtendedDisplayP3
    ExtendedLinearSRGB
    ExtendedProPhotoRGB
    ExtendedRec2020
    ExtendedSRGB
    HSL
    HWB

This is going to be needed to add support for out of gamut color() function support
and support for the new missing component syntax.

The extended variants serialize identically to their bounded counterparts, HSL/HWB
serialize as they do today, by converting to 8-bit sRGB and serializing as it.

* platform/graphics/ColorConversion.cpp:
(WebCore::convertColorComponents):
* platform/graphics/ColorSerialization.cpp:
(WebCore::serialization):
(WebCore::serializationForRenderTreeAsText):
(WebCore::serializationForCSS):
(WebCore::serializationForHTML):
* platform/graphics/ColorSpace.cpp:
(WebCore::operator<<):
* platform/graphics/ColorSpace.h:
(WebCore::callWithColorType):
* platform/graphics/ColorTypes.h:
* platform/graphics/ColorUtilities.h:
* platform/graphics/cg/ColorSpaceCG.cpp:
(WebCore::extendedNamedColorSpace):
(WebCore::extendedAdobeRGB1998ColorSpaceRef):
(WebCore::extendedDisplayP3ColorSpaceRef):
(WebCore::extendedITUR_2020ColorSpaceRef):
(WebCore::extendedLinearSRGBColorSpaceRef):
(WebCore::extendedROMMRGBColorSpaceRef):
(WebCore::colorSpaceForCGColorSpace):
(WebCore::labColorSpaceRef): Deleted.
* platform/graphics/cg/ColorSpaceCG.h:
(WebCore::cachedNullableCGColorSpace):

Source/WTF:

* wtf/PlatformHave.h:
Add new HAVE macros for additional CoreGraphics named color spaces and the CGColorSpaceCreateExtended function.

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

5 months agoUnreviewed, reverting r287478.
commit-queue@webkit.org [Wed, 29 Dec 2021 17:47:05 +0000 (17:47 +0000)]
Unreviewed, reverting r287478.
https://bugs.webkit.org/show_bug.cgi?id=234742

causes debug failures

Reverted changeset:

"[LFC][IFC] Collapsed trailing whitespace may introduce stray
inline box"
https://bugs.webkit.org/show_bug.cgi?id=234735
https://commits.webkit.org/r287478

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

5 months agoMake MatchElement in RuleFeature non-optional
antti@apple.com [Wed, 29 Dec 2021 16:35:22 +0000 (16:35 +0000)]
Make MatchElement in RuleFeature non-optional
https://bugs.webkit.org/show_bug.cgi?id=234738

Reviewed by Sam Weinig.

Split no-MatchElement case into a separate RuleAndSelector struct.

Also make MediaQueryCollector collect whole StyleRules instead of using RuleFeature/RuleAndSelector for simplicity
and better logic. Media queries always affect all of a StyleRule, not some invidiual selectors.

* style/RuleFeature.cpp:
(WebCore::Style::RuleAndSelector::RuleAndSelector):
(WebCore::Style::RuleFeature::RuleFeature):
* style/RuleFeature.h:
(WebCore::Style::RuleFeatureWithInvalidationSelector::RuleFeatureWithInvalidationSelector):
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules):

Use RuleSetBuilder to build the media query invalidation ruleset. It also does shrink-to-fit for us.

* style/RuleSet.h:
(WebCore::Style::RuleSet::DynamicMediaQueryRules::shrinkToFit):
* style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::MediaQueryCollector::pop):
(WebCore::Style::RuleSetBuilder::MediaQueryCollector::addRuleIfNeeded):
* style/RuleSetBuilder.h:
* style/StyleScopeRuleSets.cpp:
(WebCore::Style::makeRuleSet):
(WebCore::Style::ensureInvalidationRuleSets):

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

5 months ago[LFC][IFC] Collapsed trailing whitespace may introduce stray inline box
zalan@apple.com [Wed, 29 Dec 2021 16:33:42 +0000 (16:33 +0000)]
[LFC][IFC] Collapsed trailing whitespace may introduce stray inline box
https://bugs.webkit.org/show_bug.cgi?id=234735

Reviewed by Antti Koivisto.

Source/WebCore:

See the comment in LineBuilder::handleInlineContent.

Test: fast/inline/inline-box-with-collapsed-whitespace.html

* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::handleInlineContent):

LayoutTests:

* fast/inline/inline-box-with-collapsed-whitespace-expected.html: Added.
* fast/inline/inline-box-with-collapsed-whitespace.html: Added.

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

5 months ago[GTK] fast/mediastream/media-element-current-time.html is failing since added in...
dpino@igalia.com [Wed, 29 Dec 2021 01:16:06 +0000 (01:16 +0000)]
[GTK] fast/mediastream/media-element-current-time.html is failing since added in r256346
https://bugs.webkit.org/show_bug.cgi?id=208120

Reviewed by Philippe Normand.

Wait 10ms after play() to give time to the engine to have the pipeline position going forward.

* fast/mediastream/media-element-current-time.html:
* platform/glib/TestExpectations:

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

5 months ago[LFC][IFC] Do not let Layout geometry types leak into InlineDisplay::Line
zalan@apple.com [Tue, 28 Dec 2021 21:43:43 +0000 (21:43 +0000)]
[LFC][IFC] Do not let Layout geometry types leak into InlineDisplay::Line
https://bugs.webkit.org/show_bug.cgi?id=234729

Reviewed by Antti Koivisto.

InlineLayoutUnit -> float
InlineRect -> FloatRect
(This is also where we will eventually do some pixel snapping)

* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin const):
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::usedContentHeight const):
(WebCore::Layout::InlineFormattingContext::computeStaticPositionForOutOfFlowContent):
* layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):
(WebCore::Layout::InlineDisplayContentBuilder::processNonBidiContent):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
* layout/formattingContexts/inline/display/InlineDisplayLine.h:
(WebCore::InlineDisplay::Line::left const):
(WebCore::InlineDisplay::Line::right const):
(WebCore::InlineDisplay::Line::top const):
(WebCore::InlineDisplay::Line::bottom const):
(WebCore::InlineDisplay::Line::topLeft const):
(WebCore::InlineDisplay::Line::lineBoxRect const):
(WebCore::InlineDisplay::Line::scrollableOverflow const):
(WebCore::InlineDisplay::Line::baseline const):
(WebCore::InlineDisplay::Line::contentLeft const):
(WebCore::InlineDisplay::Line::contentWidth const):
(WebCore::InlineDisplay::Line::moveVertically):
(WebCore::InlineDisplay::Line::Line):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::showInlineTreeAndRuns):

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