Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream 2023 12 18 #20

Merged
merged 6,200 commits into from
Jan 12, 2024
Merged

Merge upstream 2023 12 18 #20

merged 6,200 commits into from
Jan 12, 2024

Conversation

mnutt
Copy link
Member

@mnutt mnutt commented Jan 12, 2024

This brings qtwebkit up to date with upstream webkit as of 2023-12-18.

martadarbinyan and others added 30 commits December 18, 2023 16:56
…dio-session-mode.html is a flaky crash

https://bugs.webkit.org/show_bug.cgi?id=265954
rdar://119265443

Unreviewed test gardening.

Updating test expectation

* LayoutTests/platform/mac-wk2/TestExpectations:

Canonical link: https://commits.webkit.org/272003@main
https://bugs.webkit.org/show_bug.cgi?id=266311
rdar://119582604

Reviewed by Justin Michaud.

Let's not fallback to slow C++ JSBoundFunction code, which invokes function through interpreter again.
We can just materialize JIT code from JSBoundFunction thunk and continue running from JS world instead of jumping to C++ and jumping back to JS.

* Source/JavaScriptCore/jit/JITOperations.cpp:
(JSC::materializeTargetCode):
(JSC::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/jit/JITOperations.h:
* Source/JavaScriptCore/jit/ThunkGenerators.cpp:
(JSC::boundFunctionCallGenerator):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::thunkGeneratorForIntrinsic):

Canonical link: https://commits.webkit.org/272004@main
https://bugs.webkit.org/show_bug.cgi?id=266355
rdar://119621360

Reviewed by Chris Dumez.

Store the String to be parsed in a member variable instead of only storing pointers to the
start and end of the String to avoid crashes like the one caused by caused by 270868@main.

* Source/WebCore/html/track/VTTScanner.cpp:
(WebCore::VTTScanner::VTTScanner):
* Source/WebCore/html/track/VTTScanner.h:

Canonical link: https://commits.webkit.org/272005@main
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:

Canonical link: https://commits.webkit.org/272006@main
https://bugs.webkit.org/show_bug.cgi?id=266374
rdar://119632464

Broke the TestWebKitAPI build

Unreviewed build fix.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:

Canonical link: https://commits.webkit.org/272007@main
https://bugs.webkit.org/show_bug.cgi?id=265990

Reviewed by Žan Doberšek.

Add an unique ID to cairo surfaces created in ImageBackingStoreCairo. This unique ID allows us
to differentiate when the cairo surface that's backing an image has changed, so we are sure that
we're not using an incorrect value cached inside some ImageBackingStore.

* Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::attachSurfaceUniqueID):
(WebCore::getSurfaceUniqueID):
* Source/WebCore/platform/graphics/cairo/CairoUtilities.h:
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
* Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
(WebCore::ImageBackingStore::image const):

Canonical link: https://commits.webkit.org/272009@main
…ain/contain-size-inline-block-003.html only fail on GTK.

https://bugs.webkit.org/show_bug.cgi?id=266345
rdar://problem/119617786

Unreviewed, test gardening.

* LayoutTests/TestExpectations:
* LayoutTests/platform/gtk/TestExpectations:

Canonical link: https://commits.webkit.org/272010@main
https://bugs.webkit.org/show_bug.cgi?id=266357

Reviewed by Antti Koivisto.

Let's hold on to ruby base min/max width and make sure the associated annotation box's min/max values are taken into account.

* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):

Canonical link: https://commits.webkit.org/272011@main
https://bugs.webkit.org/show_bug.cgi?id=266294
rdar://119563251

Reviewed by Justin Michaud.

FOR_EACH_BYTECODE_HELPER_ID was mistakenly lumped in with FOR_EACH_LLINT_NATIVE_HELPER, which
does not populate their entries in g_opcodeMapWide16 and g_opcodeMapWide32.  This patch fixes
that.

This was causing CLoop runs to crash on nullptr derefs on these non-initialized entries.

* Source/JavaScriptCore/llint/LLIntOpcode.h:
* Source/JavaScriptCore/llint/LowLevelInterpreter.cpp:
(JSC::CLoop::execute):

Canonical link: https://commits.webkit.org/272012@main
…splay-sampling-profiler-output

https://bugs.webkit.org/show_bug.cgi?id=266327
rdar://119597908

Reviewed by Justin Michaud.

Add --top-bytecode-count and --top-function-count options to display-sampling-profiler-output to see more information easily.

* Tools/Scripts/display-sampling-profiler-output:

Canonical link: https://commits.webkit.org/272013@main
…ting AVSampleBufferAttachContentKey

https://bugs.webkit.org/show_bug.cgi?id=266375
rdar://119345487

Reviewed by Jer Noble.

On iOS a key may be usable for decryption even when its status isn't KeyStatus::Usable. Accounted
for this by reusing the logic in CDMInstanceFairPlayStreamingAVFObjC::isAnyKeyUsable to determine if
a key is usable. Also asserted that there is no usable key whenever
CDMInstanceSessionFairPlayStreamingAVFObjC::contentKeyForSample returns nil.

* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::isPotentiallyUsableKeyStatus):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::isAnyKeyUsable const):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::isAnyKeyUsable const):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::contentKeyForSample):

Canonical link: https://commits.webkit.org/272014@main
https://bugs.webkit.org/show_bug.cgi?id=266370

Reviewed by Ryosuke Niwa.

Stop using CheckedPtr / CheckedRef in TreeScopeOrderedMap.h. Use WeakPtr / WeakRef
instead to generate more actionable crashes. This tested as performance neutral on
Speedometer 2 & 3.

* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::getAllElementsById const):
(WebCore::TreeScope::labelElementsForId):
* Source/WebCore/dom/TreeScope.h:
* Source/WebCore/dom/TreeScopeOrderedMap.cpp:
(WebCore::TreeScopeOrderedMap::add):
(WebCore::TreeScopeOrderedMap::remove):
(WebCore::TreeScopeOrderedMap::get const):
(WebCore::TreeScopeOrderedMap::getAll const):
(WebCore::TreeScopeOrderedMap::getElementsByLabelForAttribute const):
(WebCore::TreeScopeOrderedMap::getAllElementsById const):
* Source/WebCore/dom/TreeScopeOrderedMap.h:

Canonical link: https://commits.webkit.org/272015@main
https://bugs.webkit.org/show_bug.cgi?id=265721

Reviewed by Justin Michaud.

This patch fixes two related issues. The main issue is that there is a cache
for type definition unrollings that didn't hold the values strongly, and since
these values are not held by the Wasm instance they could get de-allocated.
This could cause correctness issues or crashes.

That bug was in practice hard to trigger (though it did trigger on some large
compiled-to-wasm examples), because it was hidden by a second bug. The
placeholders in recursive types (used to delay type expansion to cut off
infinite expansion of recursive types) were also not held strongly by the
TypeInformation store, so they could also get de-allocated when an instance
gets collected. This bug makes memoization less effective but didn't affect
correctness.

This patch makes the placeholders held by the TypeInformation store itself,
similar to how special type signatures are held by the store. They are also
only allocated via a helper function now, which ensures the store holds the
typedef. It also fixes the cache by using RefPtr for the value type.

* JSTests/wasm/gc/typedef.js:
* Source/JavaScriptCore/wasm/WasmParser.h:
(JSC::Wasm::Parser<SuccessType>::parseValueType):
* Source/JavaScriptCore/wasm/WasmSectionParser.cpp:
(JSC::Wasm::SectionParser::parseSubtype):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::TypeInformation::getPlaceholderProjection):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.h:

Canonical link: https://commits.webkit.org/272016@main
https://bugs.webkit.org/show_bug.cgi?id=266056

Reviewed by Justin Michaud.

Use subtyping instead of type equality for annotated select arguments.

* JSTests/wasm/gc/bug266056.js: Added.
* Source/JavaScriptCore/wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseExpression):

Canonical link: https://commits.webkit.org/272017@main
https://bugs.webkit.org/show_bug.cgi?id=266302
rdar://119568570

Reviewed by Tim Horton.

Adopt `WKSE*`-prefixed objects, which are aliased to the new classes, protocols, or types and
constants exposed from the ServiceExtensions framework (if available), or otherwise aliased to the
`UIAsync*` SPI names.

No change in behavior; see below for more details.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/ios/WebEvent.mm:
(webEventType):
(isChangingKeyModifiers):
(-[WebEvent initWithKeyEvent:]):
(-[WebEvent originalKeyEvent]):
(-[WebEvent initWithUIKeyEvent:]): Deleted.
(-[WebEvent originalUIKeyEvent]): Deleted.
* Source/WebCore/platform/ios/WebEventPrivate.h:
* Source/WebCore/platform/ios/WebSEDefinitions.h: Copied from Source/WebKit/UIProcess/API/ios/WKSEDefinitions.h.
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/Shared/DocumentEditingContext.h:
* Source/WebKit/Shared/DocumentEditingContext.mm:
(WebKit::setOptionalEditingContextProperties):
(WebKit::DocumentEditingContext::toLegacyPlatformContext):
(WebKit::DocumentEditingContext::toPlatformContext):
* Source/WebKit/UIProcess/API/ios/WKSEDefinitions.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateRuntimeProtocolConformanceIfNeeded]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
(toGestureType):
(toWKSEGestureType):
(toSelectionTouch):
(toWKSESelectionTouch):
(toWKSESelectionFlags):
(toSelectionFlags):
(selectionChangedWithGesture):
(selectionChangedWithTouch):
(-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
(-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
(-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]):
(-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
(logTextInteraction):
(-[WKContentView insertTextSuggestion:]):
(shiftKeyState):
(-[WKContentView _deferKeyEventToInputMethodEditing:]):
(-[WKContentView _interpretKeyEvent:isCharEvent:]):
(-[WKContentView dataListTextSuggestions]):
(-[WKContentView setDataListTextSuggestions:]):
(-[WKContentView updateTextSuggestionsForInputDelegate]):
(-[WKContentView _provideSuggestionsToInputDelegate:]):
(-[WKContentView _provideUITextSuggestionsToInputDelegate:]):
(toWebRequest):
(-[WKContentView requestDocumentContext:completionHandler:]):

Make the completion handler here take an `NSObject`, representing either a `UIWKDocumentRequest` or
the replacement class from ServiceExtensions. This allows us to maintain both binary and source
compatibility in all the following cases:

-   Against iOS 17, which doesn't have async text input support at all, or against versions of iOS
    17 that have `UIAsyncTextInput` but not the replacement APIs in ServiceExtensions. We fall back
    to `UIWKDocumentContext` here.

-   Building/running against versions of iOS 17 that have both `UIAsyncTextInput` and the requisite
    APIs in ServiceExtensions, but have `UIKit/async_text_input` disabled by default — here, we use
    the new ServiceExtensions API objects and flags (which, for the most part, maintain binary
    compatibility), with the exception of `WKSETextDocumentRequest`. In the completion handler, if
    async text input is disabled, we return a `UIWKDocumentRequest` to maintain binary
    compatibility.

-   Lastly, building/running against versions of iOS 17 that have both `UIAsyncTextInput` and the
    requisite APIs in ServiceExtensions, and enable `UIKit/async_text_input` by default. Here, we
    return the new `WKSETextDocumentRequest`.

(-[WKContentView selectPositionAtPoint:withContextRequest:completionHandler:]):
(-[WKContentView asyncSystemInputDelegate]):
(-[WKContentView setAsyncSystemInputDelegate:]):
(-[WKContentView handleAsyncKeyEvent:withCompletionHandler:]):
(-[WKContentView replaceText:withText:options:withCompletionHandler:]):
(-[WKContentView requestTextContextForAutocorrectionWithCompletionHandler:]):

Refactor this code to use `WebKit::DocumentEditingContext` to create the document context, to avoid
having to duplicate messy logic for initializing either of the two `WKSETextDocumentRequest` types,
depending on the SDK version. Note: we don't need to consult the async text input feature flag here
and return a legacy `UIWKDocumentRequest`, since this codepath is only ever invoked in the async
text input codepath to begin with.

(-[WKContentView adjustSelection:completionHandler:]):
(-[WKContentView shiftKeyStateChangedFrom:to:]):
(-[WKContentView selectionWillChange:]):
(-[WKContentView selectionDidChange:]):
(toUIWKGestureType): Deleted.
(toUIWKSelectionTouch): Deleted.
(toUIWKSelectionFlags): Deleted.
* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h:
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.h:
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(-[WKTextInteractionWrapper initWithView:]):
(-[WKTextInteractionWrapper selectionChangedWithGestureAt:withGesture:withState:withFlags:]):
(-[WKTextInteractionWrapper selectionChangedWithTouchAt:withSelectionTouch:withFlags:]):
(SOFT_LINK_CLASS_OPTIONAL): Deleted.
* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(+[WKDataListTextSuggestion textSuggestionWithInputText:]):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::requestDocumentEditingContext):

Drive-by fixes: make both the completion handler and method itself take rvalue references, instead
of passing by value.

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

Canonical link: https://commits.webkit.org/272018@main
https://bugs.webkit.org/show_bug.cgi?id=266388
rdar://119634195

Reviewed by Pascoe.

In 270267@main I introduced a null dereference that introduced a possible crash.
Covered by the test in the radar.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::updateFirstPartyForCookies):

Canonical link: https://commits.webkit.org/272019@main
https://bugs.webkit.org/show_bug.cgi?id=266281
rdar://119555352

Reviewed by Aditya Keerthi.

Make RenderThemeIOS build on ControlStyle::State rather than
ControlStates::States. The ControlStates architecture is dated, does
not account for shadow hosts, and should probably be disappeared
entirely. This is an incremental step towards that goal.

Then provide the switch's thumb painting code has access to the system
outline color.

And ensure that by default we don't draw an outline for a switch on
iOS. Web developers can override this by using a non-auto outline-style
value, but that will not draw the outline around the thumb.

* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::extractControlStyleStatesForRendererInternal const):
(WebCore::adjustRendererForAppearance):
(WebCore::RenderTheme::extractControlStyleStatesForRenderer const):
(WebCore::RenderTheme::extractControlStyleForRenderer const):
* Source/WebCore/rendering/RenderTheme.h:
* Source/WebCore/rendering/RenderThemeIOS.h:
* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::renderThemePaintSwitchThumb):
(WebCore::renderThemePaintSwitchTrack):
(WebCore::RenderThemeIOS::adjustSwitchStyle const):
(WebCore::RenderThemeIOS::paintSwitchThumb):
(WebCore::RenderThemeIOS::paintSwitchTrack):
(WebCore::RenderThemeIOS::checkboxRadioBorderColor):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundGradient):
(WebCore::RenderThemeIOS::checkboxRadioIndicatorColor):
(WebCore::RenderThemeIOS::paintCheckboxRadioInnerShadow):
(WebCore::RenderThemeIOS::paintCheckbox):
(WebCore::RenderThemeIOS::paintRadio):

Canonical link: https://commits.webkit.org/272020@main
https://bugs.webkit.org/show_bug.cgi?id=266278

Reviewed by Carlos Garcia Campos.

Changeset 271330@main makes use of function
'zwp_linux_dmabuf_v1_get_surface_feeback', which is only available since
wayland-protocols v1.24.

Also, update 'wayland' to 1.18 since it's the version available in the oldest
system supported at this time, Ubuntu 20.04. Update JHBuild modules
accordingly.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:
* Tools/gtk/jhbuild.modules:
* Tools/jhbuild/jhbuild-minimal.modules:
* Tools/wpe/jhbuild.modules:

Canonical link: https://commits.webkit.org/272021@main
… and `height` are animated

https://bugs.webkit.org/show_bug.cgi?id=211986
rdar://63309680

Reviewed by Simon Fraser.

When animating the `transform` or `translate` property, we resolve percentage values for translate
operations to fixed values. However, if the element also has an animation of `width` or `height`,
the resolved translation values will no longer be correct while the animation is in flight.

In that case, we need to detect such a case and turn off acceleration support.

* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-percent-with-width-and-height-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-percent-with-width-and-height-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-percent-with-width-and-height-separate-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-percent-with-width-and-height-separate-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-percent-with-width-and-height-separate.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-percent-with-width-and-height.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-percent-with-width-and-height-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-percent-with-width-and-height-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-percent-with-width-and-height-separate-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-percent-with-width-and-height-separate-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-percent-with-width-and-height-separate.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-percent-with-width-and-height.html: Added.
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::setBlendingKeyframes):
(WebCore::KeyframeEffect::canBeAccelerated const):
(WebCore::KeyframeEffect::applyPendingAcceleratedActions):
(WebCore::KeyframeEffect::computeHasSizeDependentTransform):
* Source/WebCore/animation/KeyframeEffect.h:

Canonical link: https://commits.webkit.org/272022@main
https://bugs.webkit.org/show_bug.cgi?id=266350
rdar://119217913

Reviewed by Brent Fulgham.

Call _RegisterApplication on Catalyst while holding a XPC sandbox extension. Calling this function
without the sandbox extension will crash.

* Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
* Source/WebKit/WebProcess/WebProcess.h
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Canonical link: https://commits.webkit.org/272023@main
https://bugs.webkit.org/show_bug.cgi?id=250454
rdar://104377727

Reviewed by Chris Dumez.

In case a service worker is located in the same process as a controlled document, they both share the same memory cache.
Before the patch, in case of preloads triggered byt he speculative parser and the preloads are not cacheable, the following would happen:
- Trigger a preload, which gets registered in the memory cache.
- Let the service worker handle the preload, which triggers a fetch of the same resource.
- This fetch will remove the preload resource from the memory cache and do the actual network load.
- The real load of the HTML resource kicks in and tries to load the resource from the memory cache.
- Given the resource is not a preload and is not reusable according the HTTP headers, a new load is triggered.

This makes it so that two loads are happening for the same resource (one for the preload and one for the actual load).
To resolve the issue, we do not add the service worker fetch resource in the memory cache in the following case:
- There is an existing cached resource, which is a preload, and not a service worker request.
- The new request is a service worker request.

This ensures that we keep the preload cached resource in the memory cache which allows reuse when the actual load happens.

* LayoutTests/http/wpt/service-workers/resources/serviceworker-and-preloads-iframe.html: Added.
* LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-img.png: Added.
* LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-img.png.headers: Added.
* LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-script.js: Added.
* LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-script.js.headers: Added.
* LayoutTests/http/wpt/service-workers/serviceworker-and-preloads-expected.txt: Added.
* LayoutTests/http/wpt/service-workers/serviceworker-and-preloads-worker.js: Added.
* LayoutTests/http/wpt/service-workers/serviceworker-and-preloads.html: Added.
* Source/WebCore/loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
(WebCore::computeShouldAddToMemoryCache):
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::loadResource):
* Source/WebCore/loader/cache/CachedResourceLoader.h:

Canonical link: https://commits.webkit.org/272024@main
https://bugs.webkit.org/show_bug.cgi?id=266385
rdar://119615258

Reviewed by Jer Noble.

Changes in 271514@main exposed an underlying existing issue. The MediaSource's duration was initialised to NaN
but the GPU process one was initialised to 0. Following 271514@main the inital value would be identical.

If the media source duration was set prior any sourcebuffer being created, we wouldn't set the SourceBuffer
initial duration, and the step `If the media segment contains data beyond the current duration, then run the duration change algorithm with new duration set to the maximum of the current duration and the [[group end timestamp]].`
would always be skipped.

We set the initial duration to the sourceBuffer when created.

Add tests.

* LayoutTests/media/media-source/media-source-append-buffer-durationchange-expected.txt: Added.
* LayoutTests/media/media-source/media-source-append-buffer-durationchange.html: Added.
* Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::addSourceBuffer):
* Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp:
(WebCore::MockMediaSourcePrivate::addSourceBuffer):

Canonical link: https://commits.webkit.org/272025@main
https://bugs.webkit.org/show_bug.cgi?id=266394

Reviewed by Carlos Garcia Campos.

Fixes linking error. Symbol 'wl_proxy_marshal_flags' is only defined
since wayland 1.20.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:
* Tools/gtk/jhbuild.modules:
* Tools/jhbuild/jhbuild-minimal.modules:
* Tools/wpe/jhbuild.modules:

Canonical link: https://commits.webkit.org/272026@main
https://bugs.webkit.org/show_bug.cgi?id=266330
rdar://119599179

Unreviewed test expectations gardening.

A lot of tests under `http/tests/paymentrequest/` were previously skipped
on both macOS and iOS because they tested for features yet to be
available in public versions of PassKit. This is no longer the case, so
we can safely unskip these tests. The only kink comes from having to
single out some tests to skip on macOS Monterey. These tests happen to be
testing features available from macOS Ventura-onwards only.

Some more tests still do not require the DumpJSConsoleLogInStdErr
classification, either because they are not producing JS console logs or
because their expectations have been rebaselined to reflect the console
log. We also unskip these tests.

* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/mac-monterey-wk2/TestExpectations:
* LayoutTests/platform/mac-ventura-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:

Canonical link: https://commits.webkit.org/272027@main
…r::equal(KeyTraits::emptyValue(), key)

https://bugs.webkit.org/show_bug.cgi?id=266333

Reviewed by Xabier Rodriguez-Calvar.

HashMap doesn't like to store key that evaluate to false, so a TrackID with value 0 would trigger an
ASSERT. So switch back to unordered_map for tracks storage, and avoid std::views for access, which
is not available in clang-14.

* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
(WebCore::MediaSourcePrivateGStreamer::startPlaybackIfHasAllTracks):
* Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
(WebCore::SourceBufferPrivateGStreamer::flush):
(WebCore::SourceBufferPrivateGStreamer::enqueueSample):
(WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
(WebCore::SourceBufferPrivateGStreamer::precheckInitializationSegment):
* Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:

Canonical link: https://commits.webkit.org/272028@main
https://bugs.webkit.org/show_bug.cgi?id=265791
rdar://119133276

Reviewed by Eric Carlson.

Migrate code from deprecated webrtc::AsyncResolverFactory to webrtc::AsyncDnsResolverFactory.
This in particular simplifies how we do memory management, since the peer connection factory is now owned by the peer connection.

We keep using a map of WeakPtr to allow to handle IPC responses from network process.

We work around a header conflict between SDK and libwebrtc by isolating absl::InvokeCall in LibWebRTCDnsResolverFactory.cpp.

* Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::createPeerConnection):
* Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* Source/WebKit/Sources.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.cpp: Added.
(WebKit::LibWebRTCDnsResolverFactory::CreateAndResolve):
(WebKit::LibWebRTCDnsResolverFactory::Create):
(WebKit::LibWebRTCDnsResolverFactory::Resolver::Start):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCDnsResolverFactory.h: Added.
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createPeerConnection):
(WebKit::RTCSocketFactory::CreateAsyncDnsResolver):
(WebKit::RTCSocketFactory::CreateAsyncResolver): Deleted.
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
(WebKit::LibWebRTCResolver::~LibWebRTCResolver):
(WebKit::LibWebRTCResolver::start):
(WebKit::LibWebRTCResolver::result const):
(WebKit::LibWebRTCResolver::setResolvedAddress):
(WebKit::LibWebRTCResolver::setError):
(WebKit::LibWebRTCResolver::Start): Deleted.
(WebKit::LibWebRTCResolver::Destroy): Deleted.
(WebKit::LibWebRTCResolver::doDestroy): Deleted.
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::createAsyncDnsResolver):
(WebKit::LibWebRTCSocketFactory::createAsyncResolver): Deleted.
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
(WebKit::LibWebRTCSocketFactory::resolver):
(WebKit::LibWebRTCSocketFactory::removeResolver):
(WebKit::LibWebRTCSocketFactory::takeResolver): Deleted.
* Source/WebKit/WebProcess/Network/webrtc/WebRTCResolver.cpp:
(WebKit::WebRTCResolver::setResolvedAddress):
(WebKit::WebRTCResolver::resolvedAddressError):

Canonical link: https://commits.webkit.org/272029@main
…change CPU frequency governor for RPis

https://bugs.webkit.org/show_bug.cgi?id=266353

Reviewed by Philippe Normand.

This updates the Yocto layers used for the RPi build with the following major changes:

 - meta-webkit: include libbacktrace and libportal into the base build.
   libbacktrace is required by the default build of WPE now and libportal is required by Cog since bug 266351

 - meta-raspberrypi: stop setting "powersave" as the default CPU frequency governor and use
   "schedutil" instead. This will likely mean a big change in the performance results of all tests.
   See agherzan/meta-raspberrypi#1243 for context.

 - poky, meta-openembedded: just update to the last version of the Mickledore branch

 - backport a change landed in meta-openembedded master to the Mickledore branch that
   updates libbacktrace to allow building it on riscv64.

* Tools/yocto/meta-openembedded_backport-libbacktrace-patch-to-mickledore-branch.patch: Added.
* Tools/yocto/riscv/manifest.xml:
* Tools/yocto/rpi/manifest.xml:
* Tools/yocto/targets.conf:

Canonical link: https://commits.webkit.org/272030@main
…nlineFormattingUtils::inlineItemWidth

https://bugs.webkit.org/show_bug.cgi?id=266387

Reviewed by Antti Koivisto.

Do not try to measure out-of-flow content while rebuilding the line due to "revert to last breaking position" type of content.

* LayoutTests/fast/inline/inline-content-with-out-of-flow-assert-expected.txt: Added.
* LayoutTests/fast/inline/inline-content-with-out-of-flow-assert.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::rebuildLineWithInlineContent):

Canonical link: https://commits.webkit.org/272031@main
…teBindGroupLayout.html are failing

https://bugs.webkit.org/show_bug.cgi?id=266318
<radar://119586689>

Reviewed by Tadeu Zagallo.

Add validation such tat createBindGroupLayout.html passes and add the passing
expectation.

Add passing expectations for validation/createBindGroup.html and add some
validation so that the CTS test passes.

* LayoutTests/http/tests/webgpu/webgpu/api/validation/createBindGroup-expected.txt:
* LayoutTests/http/tests/webgpu/webgpu/api/validation/createBindGroupLayout-expected.txt:
* Source/WebCore/Modules/WebGPU/GPUStorageTextureAccess.h:
(WebCore::convertToBacking):
* Source/WebCore/Modules/WebGPU/GPUStorageTextureAccess.idl:
* Source/WebCore/Modules/WebGPU/Implementation/WebGPUConvertToBackingContext.cpp:
(WebCore::WebGPU::ConvertToBackingContext::convertToBacking):
* Source/WebCore/Modules/WebGPU/Implementation/WebGPUDeviceImpl.cpp:
(WebCore::WebGPU::DeviceImpl::createSampler):
(WebCore::WebGPU::DeviceImpl::createBindGroup):
* Source/WebCore/Modules/WebGPU/InternalAPI/WebGPU.serialization.in:
* Source/WebCore/Modules/WebGPU/InternalAPI/WebGPUStorageTextureAccess.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::convertAccess):
(WGSL::bindingMemberForGlobal):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WebGPU/BindGroup.mm:
(WebGPU::hasProperUsageFlags):
(WebGPU::hasBinding):
(WebGPU::formatType):
(WebGPU::formatIsFloat):
(WebGPU::formatIsDepth):
(WebGPU::formatIsSignedInt):
(WebGPU::formatIsUnsignedInt):
(WebGPU::validateTextureSampleType):
(WebGPU::validateTextureViewDimension):
(WebGPU::validateStorageTextureViewFormat):
(WebGPU::validateSamplerType):
(WebGPU::Device::createBindGroup):
* Source/WebGPU/WebGPU/BindGroupLayout.h:
(WebGPU::BindGroupLayout::create):
(WebGPU::BindGroupLayout::createInvalid):
* Source/WebGPU/WebGPU/BindGroupLayout.mm:
(WebGPU::createArgumentDescriptor):
(WebGPU::Device::createBindGroupLayout):
(WebGPU::BindGroupLayout::BindGroupLayout):
(WebGPU::BindGroupLayout::uniformBuffersPerStage const):
(WebGPU::BindGroupLayout::storageBuffersPerStage const):
(WebGPU::BindGroupLayout::samplersPerStage const):
(WebGPU::BindGroupLayout::texturesPerStage const):
(WebGPU::BindGroupLayout::storageTexturesPerStage const):
(WebGPU::BindGroupLayout::device const):
(WebGPU::BindGroupLayout::isAutoGenerated const):
* Source/WebGPU/WebGPU/Buffer.h:
* Source/WebGPU/WebGPU/Buffer.mm:
(WebGPU::Buffer::isDestroyed const):
* Source/WebGPU/WebGPU/ComputePipeline.mm:
(WebGPU::createComputePipelineState):
(WebGPU::returnInvalidComputePipeline):
(WebGPU::Device::createComputePipeline):
(WebGPU::Device::createComputePipelineAsync):
* Source/WebGPU/WebGPU/Device.h:
* Source/WebGPU/WebGPU/PipelineLayout.mm:
(WebGPU::Device::createPipelineLayout):
* Source/WebGPU/WebGPU/RenderPipeline.mm:
(WebGPU::convertToMTLCompare):
(WebGPU::convertAccess):
(WebGPU::convertFormat):
(WebGPU::Device::addPipelineLayouts):
(WebGPU::returnInvalidRenderPipeline):
(WebGPU::Device::createRenderPipeline):
(WebGPU::Device::createRenderPipelineAsync):
* Source/WebGPU/WebGPU/Sampler.mm:
(WebGPU::compareFunction):
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::wgslAccess):
(WebGPU::wgslFormat):
(WebGPU::convertBindingLayout):
* Source/WebGPU/WebGPU/Texture.h:
* Source/WebGPU/WebGPU/Texture.mm:
(WebGPU::Texture::hasStorageBindingCapability):
(WebGPU::Device::errorValidatingTextureCreation):
(WebGPU::Texture::isDestroyed const):
(WebGPU::hasStorageBindingCapability): Deleted.
* Source/WebGPU/WebGPU/TextureView.h:
* Source/WebGPU/WebGPU/TextureView.mm:
(WebGPU::TextureView::usage const):
(WebGPU::TextureView::sampleCount const):
(WebGPU::TextureView::format const):
(WebGPU::TextureView::mipLevelCount const):
(WebGPU::TextureView::isDestroyed const):
* Source/WebGPU/WebGPU/WebGPU.h:

Canonical link: https://commits.webkit.org/272032@main
achristensen07 and others added 29 commits December 18, 2023 16:57
…LocalFrame lifetime

https://bugs.webkit.org/show_bug.cgi?id=266105
rdar://116202445

Reviewed by Pascoe.

Before this PR we were calling addRootFrame in an ad-hoc manner, and we weren't calling
remoteRootFrame at all except confusingly in the LocalFrame constructor, which was quite
incorrect.  This caused memory leaks and crashes when site isolation was enabled.

To fix this, I call addRootFrame in the LocalFrame constructor and removeRootFrame in the
LocalFrame destructor.  During the destructor call, we can't reliably check the parent
frame because it may have also been destroyed, so I cache the value of whether the
LocalFrame is a root frame using a const bool member function.  I use the ChromeClient
to tell the WebPage's DrawingArea about the creation and destruction of root frames.

In order to successfully draw after this root frame lifetime management change, I needed
the WebPage to already have a DrawingArea when the main frame is constructed, which
required moving it up in the list of constructed members of the WebPage.  When I did this,
though, the calls to WebPage::corePage in the DrawingArea constructors returned null because
the DrawingArea was being constructed before the WebCore::Page.  To fix this, I just moved
the settings update code from the DrawingArea constructors to the WebPage constructor
after creating the WebCore::Page.  Additionally, a few members needed to be initialized
before the DrawingArea constructor might use them, so I moved them around, and the call to
TiledCoreAnimationDrawingArea::setViewExposedRect needs the main frame to have been initialized,
so I moved that to after the main frame was initialized.

I need the Frame to be destroyed when it transitions between LocalFrame and RemoteFrame,
and FocusController was keeping it alive sometimes, which caused crashes.  I changed
FocusController to have a WeakPtr instead of a RefPtr keeping the Frame alive.

When the Frame is destroyed after having called Frame::takeWindowProxyFrom on it, it does some
teardown on its WindowProxy.  To make that teardown not happen on a WindowProxy that is still
being used by another Frame, I added a call to frame.resetWindowProxy() but without the
detachFromFrame() call.  This is needed to keep the WindowProxy pointing to the right Frame
and DOMWindow after the transition when the Frame lifetime is managed better.

* Source/WebCore/loader/EmptyClients.h:
* Source/WebCore/page/ChromeClient.h:
* Source/WebCore/page/FrameTree.h:
(WebCore::FrameTree::thisFrame const):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::isRootFrame):
(WebCore::LocalFrame::LocalFrame):
(WebCore::LocalFrame::~LocalFrame):
(WebCore::LocalFrame::isRootFrame const):
* Source/WebCore/page/LocalFrame.h:
* Source/WebCore/page/Page.cpp:
(WebCore::createMainFrame):
(WebCore::Page::addRootFrame):
(WebCore::Page::removeRootFrame):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::rootFrameAdded):
(WebKit::WebChromeClient::rootFrameRemoved):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::removeRootFrame):
(WebKit::DrawingArea::shouldForceCompositingMode const):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::RemoteLayerTreeDrawingArea::removeRootFrame):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::transitionToLocal):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::m_historyItemClient):
(WebKit::addRootFramesToNewDrawingArea):
(WebKit::WebPage::reinitializeWebPage):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
* Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h:

Canonical link: https://commits.webkit.org/272224@main
https://bugs.webkit.org/show_bug.cgi?id=244054

Reviewed by Jonathan Bedard.

* Tools/CISupport/ews-app/ews/common/github.py:
(GitHubEWS):

Canonical link: https://commits.webkit.org/272225@main
https://bugs.webkit.org/show_bug.cgi?id=260039

Reviewed by Justin Michaud.

Use subtyping for module linking in general. Also add and re-enable more tests
about linking.

Note: we don't add subtyping for exception tags for now, because the exception
proposal is in flux.

* JSTests/wasm/gc-spec-tests/type-subtyping.wast.js:
* JSTests/wasm/gc/linking.js: Added.
(testLinking):
* Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::initializeImports):

Canonical link: https://commits.webkit.org/272226@main
… set of out-of-flow boxes

https://bugs.webkit.org/show_bug.cgi?id=266580

Reviewed by Antti Koivisto.

Replace this visual tree dump with slightly more flexible, inline content.

* LayoutTests/TestExpectations:
* LayoutTests/fast/ruby/ruby-expansion-cjk-2-expected.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk-2.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk-3-expected.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk-3.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk-5-expected.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk-5.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk-expected.html:
* LayoutTests/fast/ruby/ruby-expansion-cjk.html:
* LayoutTests/fast/ruby/ruby-justification-expected.html:
* LayoutTests/fast/ruby/ruby-justification.html:

Canonical link: https://commits.webkit.org/272227@main
https://bugs.webkit.org/show_bug.cgi?id=266583

Reviewed by Don Olmstead.

Build fix -- revert 263486@main and 263783@main for PlayStation.

* Source/WebCore/platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::enableHttp):
* Source/WebCore/platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didReceiveHeader):
(WebCore::CurlRequest::didReceiveData):
* Source/cmake/OptionsPlayStation.cmake:

Canonical link: https://commits.webkit.org/272228@main
…er double tapping trackpad causes page to scroll down

https://bugs.webkit.org/show_bug.cgi?id=266529
rdar://116419609

Reviewed by Tim Horton.

The smart magnify gesture (two-finger double tap on the trackpad) results in some combination of
scrolling and zooming. `RemoteLayerTreeDrawingAreaProxyMac::commitTransientZoom()` uses a
CAAnimation to animate to the final state, but the completion handler of that animation put the
transform directly onto the `layerForPageScale`.

That's OK if the gesture results in a scale change; that transform will get replaced by one that
comes from the web process. However, if a gesture just resulted in a scroll with no scale change,
we never get a new transform from the web process, so we leave that transform on
`layerForPageScale`. This transform has a translation baked in, so this causes a permanent scroll
offset.

So we have to stop shoving the transform onto this layer. This revealed an issue where there was a
jump when the animation was removed. Fixing this just requires two things:

1. Delay removing the transient zoom animations until we know the web process has committed the new
   scale and scroll position (via a `callAfterNextPresentationUpdate()`).

2. Override any scroll position changes that come from the web process before this by adding a
   CAAnimation onto the scrolled contents layer which overrides the `position` property. If we
   don't do this, scroll position changes cause a flash of offset content. This requires tracking
   m_pageScrollingLayerID, but that information was already in the transaction for banner hookup.

* LayoutTests/view-gestures/smart-magnify/double-tap-zoom-scroll-above-top-expected.html: Added.
* LayoutTests/view-gestures/smart-magnify/double-tap-zoom-scroll-above-top.html: Added.
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::didCommitLayerTree):
(WebKit::fillFowardsAnimationWithKeyPath):
(WebKit::transientZoomTransformOverrideAnimation):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::applyTransientZoomToLayer):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::removeTransientZoomFromLayer):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::commitTransientZoom):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::sendCommitTransientZoom):

Canonical link: https://commits.webkit.org/272229@main
https://bugs.webkit.org/show_bug.cgi?id=266562
rdar://119793659

Reviewed by Pascoe.

Add a test to make sure the feature `verifyWindowOpenUserGestureFromUIProcess` works correctly when a
mouse event is used to open a window.

The import in WKWebExtensionAPIDeclarativeNetRequest.mm is needed for unified sources.

* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/VerifyUserGestureFromUIProcess.mm: Added.
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIDeclarativeNetRequest.mm:

Canonical link: https://commits.webkit.org/272230@main
https://bugs.webkit.org/show_bug.cgi?id=264737
rdar://117805319

Reviewed by Brent Fulgham.

Until now, when we are purging inactive font data, we would just clear
the glyph page cache if we had to purge system fallback font.
This means that we consider glyph page cache would only point to
fonts from system fonts fallback.

When we are handling unicode's in the Private-User-Area (PUA) block,
we shouldn't fallback to system fonts searching for a font that can render
it, per spec: https://www.w3.org/TR/css-fonts-4/#char-handling-issues
Instead, we render the glyph 0 with the last resort font. However, this
font is just added to the custom font cache, and its font pointer in the
Glyph Page cache is not cleared during memory pressure.

We should add this font to the system font fallback set, to make sure
that the associated font pointer is removed from the glyph page cache
during memory pressure.

* LayoutTests/fonts/font-cache-memory-pressure-crash.html: Added.
* Source/WebCore/platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForVariant):
* LayoutTests/fonts/font-cache-memory-pressure-crash-expected.txt: Added.

Originally-landed-as: a595ddd8348d. rdar://119598929
Canonical link: https://commits.webkit.org/272231@main
https://bugs.webkit.org/show_bug.cgi?id=266585

Reviewed by Tim Nguyen.

Link to spec was broken; fixed it.

* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):

Canonical link: https://commits.webkit.org/272232@main
https://bugs.webkit.org/show_bug.cgi?id=266578
rdar://119816733

Reviewed by Aditya Keerthi.

Prepare our API tests for async text input enablement on iOS, many of which currently call into
legacy SPI methods that crash with the feature flag enabled. To avoid these release assertions, we
refactor all tests which explicitly call into these codepaths, such that they'll invoke their
`UIAsyncTextInput` counterparts when `UIKit/async_text_input` is enabled.

See below for more details.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView moveInDirection:byGranularity:]):
(-[WKContentView extendInDirection:byGranularity:]):

Also drive-by fix an actual bug that was caught by `SelectionTests.ModifyByParagraphBoundary`.
Instead of just moving backward or forward by paragraph granularity in the `UIAsyncTextInput` method
`-extendInDirection:byGranularity:`, we need to additionally move backwards or forwards by character
before doing so in order to maintain parity with `-_moveToEndOfParagraph:withHistory:` and
`_moveToStartOfParagraph:withHistory:`.

* Source/WebKit/UIProcess/ios/WKSEDefinitions.h: Renamed from Source/WebKit/UIProcess/API/ios/WKSEDefinitions.h.

Also move `WKSEDefinitions.h` to `UIProcess/ios` instead of `UIProcess/API/ios`, since the latter
just holds iOS-specific files related to WebKit API objects (in this case, only `WKWebView`).
Putting this in `UIProcess/ios` seems more appropriate, and also allows us to include it directly in
WebKitTestRunner.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestRunnerShared/spi/UIKitSPIForTesting.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
(-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm:
(TestWebKitAPI::simulateEditContextMenuAppearance):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEditActions.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(TestWebKitAPI::simulateEditContextMenuAppearance):
* Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
(-[TestWKWebView autocorrectionRectsForString:]): Deleted.
(-[TestWKWebView synchronouslyRequestAutocorrectionContext]): Deleted.
* Tools/TestWebKitAPI/Tests/ios/EnterKeyHintTests.mm:
(-[TestWKWebView test:enterKeyHint:returnKeyType:]):
* Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
* Tools/TestWebKitAPI/Tests/ios/SelectionModifyByParagraphBoundary.mm:
* Tools/TestWebKitAPI/Tests/ios/TextServicesTests.mm:
* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:

Add a bunch of new category helpers on `WKWebView`, which replace many of the direct calls into
`WKContentView` in our API tests when exercising various `UIWKInteractionViewProtocol` SPIs. These
helper methods will call directly into these legacy SPIs when async text input is disabled, but will
call into their new `UIAsyncTextInput` counterparts when async text input is enabled.

(-[WKWebView defineSelection]):
(-[WKWebView shareSelection]):
(-[WKWebView hasAsyncTextInput]):
(-[WKWebView selectionClipRect]):
(-[WKWebView moveSelectionToStartOfParagraph]):
(-[WKWebView extendSelectionToStartOfParagraph]):
(-[WKWebView moveSelectionToEndOfParagraph]):
(-[WKWebView extendSelectionToEndOfParagraph]):
(-[WKWebView asyncTextInput]):
(-[WKWebView extendedTextInputTraits]):
(-[WKWebView autocorrectionRectsForString:]):
(-[WKWebView autocorrectionContext]):
(-[WKWebView effectiveTextInputTraits]):
(-[WKWebView replaceText:withText:shouldUnderline:completion:]):
(wrap):
(unwrap):
(-[WKWebView synchronouslyAdjustSelectionWithDelta:]):
(-[WKWebView selectTextForContextMenuWithLocationInView:completion:]):
(-[WKWebView handleKeyEvent:completion:]):
* Tools/WebKitTestRunner/Configurations/Base.xcconfig:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::asyncTextInput const):

Canonical link: https://commits.webkit.org/272233@main
https://bugs.webkit.org/show_bug.cgi?id=265432
<radar://118866310>

Reviewed by Dan Glastonbury.

https://webkit.org/demos/webgpu/ was pointing to old samples which
do not function as they were built against outdated versions of the specification.

Update index.html to direct to the publically maintained GitHub samples which
function in ToT builds of WebKit.

* Websites/webkit.org/demos/webgpu/index.html:
* Websites/webkit.org/demos/webgpu/resources/animometer.png: Added.
* Websites/webkit.org/demos/webgpu/resources/babylon-helmet.png: Removed.
* Websites/webkit.org/demos/webgpu/resources/babylon-sphere.png: Removed.
* Websites/webkit.org/demos/webgpu/resources/bitonic-sort.png: Added.
* Websites/webkit.org/demos/webgpu/resources/compute-blur.png:
* Websites/webkit.org/demos/webgpu/resources/compute-boids.png:
* Websites/webkit.org/demos/webgpu/resources/hello-cube.png:
* Websites/webkit.org/demos/webgpu/resources/hello-triangle.png:
* Websites/webkit.org/demos/webgpu/resources/motionmark.jpeg: Removed.
* Websites/webkit.org/demos/webgpu/resources/photon-mapping.png: Added.
* Websites/webkit.org/demos/webgpu/resources/textured-cube.png:
* Websites/webkit.org/demos/webgpu/resources/video-uploading.png: Added.
* Websites/webkit.org/demos/webgpu/resources/webkit-logo.png: Removed.

Canonical link: https://commits.webkit.org/272234@main
* LayoutTests/platform/wincairo/TestExpectations:

Canonical link: https://commits.webkit.org/272235@main
…KWebExtensionAPITabs.SendMessageWithPromiseReply timeout

https://webkit.org/b/266518
rdar://problem/119740501

Reviewed by Brian Weinstein.

Adopt EagerCallbackAggregator for the reply handler. This was added on the UIProcess side
for the message sending in 271636@main. It can also be used here, with the help of an ObjC
wrapper object that can keep the aggregator in scope for the required blocks.

We can't use BlockPtr for these since the JSValue ObjC translation requires blocks to have
a signature to translate them into JavaScript functions, which is only for compiled blocks.
Without this, the aggregator falls out of scope and is released.

Added additional tests to make sure async replies work in addition to sync replies. Also
adopted optional chaining for some tests since an exception is thrown when response is null.

* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm:
(-[_WKReplyCallbackAggregator initWithAggregator:]): Added.
(-[_WKReplyCallbackAggregator aggregator]): Added.
(WebKit::WebExtensionContextProxy::internalDispatchRuntimeMessageEvent):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/272236@main
https://webkit.org/b/261848
rdar://problem/115809590

Unreviewed test gardening.

Enable the WKWebExtensionAPITabs.RemovedEvent test, since it no longer fails
after hundreds of iterations.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/272237@main
… tests in inspector/timeline are flaky crash with ASSERTION FAILED in void WebCore::InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType)

https://bugs.webkit.org/show_bug.cgi?id=266591
rdar://119828743

Unreviewed test gardening.

Adding test expectation

* LayoutTests/platform/mac-wk2/TestExpectations:

Canonical link: https://commits.webkit.org/272238@main
@mnutt mnutt merged commit 2d2b379 into master Jan 12, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet