2022-03-09 Russell Epstein Cherry-pick r290515. rdar://problem/89376484 [WebAuthn] Use default pubKeyCredParams if empty in makeCredential https://bugs.webkit.org/show_bug.cgi?id=237109 rdar://problem/89376484 Reviewed by Brent Fulgham. Source/WebCore: The Web Authentication level 2 spec was updated to clarify that a set of default pubKeyCredParams should be used if the list supplied by the RP is empty. This patch starts using the default and updates associated tests. * Modules/webauthn/AuthenticatorCoordinator.cpp: (WebCore::AuthenticatorCoordinator::create const): * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * Modules/webauthn/WebAuthenticationConstants.h: LayoutTests: Update tests to take in account using default pubKeyCredParams. * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure.https.html: * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-hid.https.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290515 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-25 J Pascoe [WebAuthn] Use default pubKeyCredParams if empty in makeCredential https://bugs.webkit.org/show_bug.cgi?id=237109 rdar://problem/89376484 Reviewed by Brent Fulgham. Update tests to take in account using default pubKeyCredParams. * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure.https.html: * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-hid.https.html: 2022-03-09 Russell Epstein Cherry-pick r290760. rdar://problem/83745510 Rendering issues with many dynamically-added sticky elements inside overflow scroll https://bugs.webkit.org/show_bug.cgi?id=237378 Reviewed by Cameron McCormack. Source/WebCore: A bug was filed describing a symptom where position:sticky elements would eventually fail to render when many of them were dynamically added inside a non-stacking context overflow scroll. Debugging showed that CALayers were accumulating, causing us to hit per-process IOSurface limits, at which point content fails to render (this is being fixed via rdar://89640915). Further debugging showed that these layers were unparented, and being entrained by ScrollingStateStickyNodes, which were accumulating in ScrollingStateTree's m_unparentedNodes. This happened because with this scrolling configuration, each ScrollingStateStickyNode is parented via a ScrollingStateOverflowScrollProxyNode which is referenced by entries in RenderLayerBacking's m_ancestorClippingStack. On cleanup, the ScrollingStateOverflowScrollProxyNode was unparented first, leaving the ScrollingStateStickyNode in m_unparentedNodes. The fix is to have ScrollingStateTree::unparentChildrenAndDestroyNode() remove nodes from m_unparentedNodes. To test, add a m_unparentedNodes count to scrollingStateTreeAsText output, which means having scrollingStateTreeAsText() as a member function on ScrollingStateTree. Test: scrollingcoordinator/scrolling-tree/accumulated-unparented-sticky-nodes.html * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText const): * page/scrolling/ScrollingStateTree.cpp: (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode): (WebCore::ScrollingStateTree::scrollingStateTreeAsText const): * page/scrolling/ScrollingStateTree.h: LayoutTests: * scrollingcoordinator/scrolling-tree/accumulated-unparented-sticky-nodes-expected.txt: Added. * scrollingcoordinator/scrolling-tree/accumulated-unparented-sticky-nodes.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290760 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-02 Simon Fraser Rendering issues with many dynamically-added sticky elements inside overflow scroll https://bugs.webkit.org/show_bug.cgi?id=237378 Reviewed by Cameron McCormack. * scrollingcoordinator/scrolling-tree/accumulated-unparented-sticky-nodes-expected.txt: Added. * scrollingcoordinator/scrolling-tree/accumulated-unparented-sticky-nodes.html: Added. 2022-03-09 Russell Epstein Cherry-pick r290646. rdar://problem/88911184 focus({preventScroll: true}) does not prevent scrolling on iOS https://bugs.webkit.org/show_bug.cgi?id=236584 rdar://88911184 Reviewed by Simon Fraser. Source/WebCore: Plumb `FocusOptions` through `Element::dispatchFocusEvent()` as well as the chrome client hooks for `elementDidRefocus` and `elementDidFocus`, instead of just a `FocusDirection` flag. * dom/Document.cpp: (WebCore::Document::setFocusedElement): * dom/Element.cpp: (WebCore::Element::focus): (WebCore::Element::dispatchFocusEvent): * dom/Element.h: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::dispatchFocusEvent): * html/HTMLSelectElement.h: * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::dispatchFocusEvent): * html/HTMLTextFormControlElement.h: * loader/EmptyClients.h: * page/ChromeClient.h: (WebCore::ChromeClient::elementDidFocus): (WebCore::ChromeClient::elementDidRefocus): * page/FocusController.cpp: (WebCore::dispatchEventsOnWindowAndFocusedElement): (WebCore::FocusController::setFocusedElement): Source/WebKit: Add support for `preventScroll` on iOS by avoiding UI-side zooming/scrolling to reveal the focused element if it was focused with `preventScroll: true`. See below for more details. Tests: fast/forms/select-focus-prevent-scroll.html fast/forms/text-field-focus-prevent-scroll.html * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: Add a boolean flag to `FocusedElementInformation` to indicate whether or not scrolling to reveal the focused element should be prevented. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _zoomToRevealFocusedElement]): Only zoom to reveal the focused element if the focused element information's `preventScroll` flag is `NO`. (-[WKContentView _elementDidBlur]): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::elementDidFocus): (WebKit::WebChromeClient::elementDidRefocus): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::elementDidRefocus): (WebKit::WebPage::elementDidFocus): Use `FocusOptions` to set the `preventScroll` flag when propagating `FocusedElementInformation`. * WebProcess/WebPage/WebPage.h: Source/WebKitLegacy/ios: Adjust the method signature of elementDidFocus. See WebCore ChangeLog for more information. * WebCoreSupport/WebChromeClientIOS.h: * WebCoreSupport/WebChromeClientIOS.mm: (WebChromeClientIOS::elementDidFocus): Source/WebKitLegacy/mac: Adjust the method signature of elementDidFocus. See WebCore ChangeLog for more information. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::elementDidFocus): LayoutTests: Add a couple of new layout tests to verify that passing in `{ preventScroll: true }` for focus options causes us to avoid scrolling to reveal focused select elements and text fields. * fast/forms/select-focus-prevent-scroll-expected.txt: Added. * fast/forms/select-focus-prevent-scroll.html: Added. * fast/forms/text-field-focus-prevent-scroll-expected.txt: Added. * fast/forms/text-field-focus-prevent-scroll.html: Added. * resources/ui-helper.js: Also make it safe to call `waitForInputSessionToDismiss()` in a platform-agnostic test, by bailing early if we're not on iOS, using WebKit2. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290646 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-01 Wenson Hsieh focus({preventScroll: true}) does not prevent scrolling on iOS https://bugs.webkit.org/show_bug.cgi?id=236584 rdar://88911184 Reviewed by Simon Fraser. Add a couple of new layout tests to verify that passing in `{ preventScroll: true }` for focus options causes us to avoid scrolling to reveal focused select elements and text fields. * fast/forms/select-focus-prevent-scroll-expected.txt: Added. * fast/forms/select-focus-prevent-scroll.html: Added. * fast/forms/text-field-focus-prevent-scroll-expected.txt: Added. * fast/forms/text-field-focus-prevent-scroll.html: Added. * resources/ui-helper.js: Also make it safe to call `waitForInputSessionToDismiss()` in a platform-agnostic test, by bailing early if we're not on iOS, using WebKit2. 2022-03-09 Russell Epstein Cherry-pick r290556. rdar://problem/89525864 Re-import inert and WPT https://bugs.webkit.org/show_bug.cgi?id=237243 Reviewed by Youenn Fablet. Upstream commit: https://github.com/web-platform-tests/wpt/commit/9261ca87db106c1f31f1ab4f54b8f4a2617cbc24 LayoutTests/imported/w3c: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-in-replaced-renderer-expected.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-in-replaced-renderer-ref.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-in-replaced-renderer.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-in-table-column-expected.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-in-table-column-ref.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-in-table-column.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log: * web-platform-tests/inert/inert-and-contenteditable.tentative-expected.txt: Added. * web-platform-tests/inert/inert-and-contenteditable.tentative.html: Added. * web-platform-tests/inert/inert-iframe-hittest.tentative-expected.txt: * web-platform-tests/inert/inert-iframe-hittest.tentative.html: * web-platform-tests/inert/inert-iframe-tabbing.tentative-expected.txt: * web-platform-tests/inert/inert-iframe-tabbing.tentative.html: * web-platform-tests/inert/w3c-import.log: LayoutTests: * TestExpectations: * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-hittest.tentative-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-tabbing.tentative-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290556 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-27 Tim Nguyen Re-import inert and WPT https://bugs.webkit.org/show_bug.cgi?id=237243 Reviewed by Youenn Fablet. Upstream commit: https://github.com/web-platform-tests/wpt/commit/9261ca87db106c1f31f1ab4f54b8f4a2617cbc24 * TestExpectations: * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-hittest.tentative-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-tabbing.tentative-expected.txt: 2022-03-09 Russell Epstein Cherry-pick r289071. rdar://problem/89997434 ANGLE Metal and ANGLE OpenGL cannot be initialised one after the other https://bugs.webkit.org/show_bug.cgi?id=236030 Patch by Kimmo Kinnunen on 2022-02-03 Reviewed by Dean Jackson. Source/WebCore: Test: webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html Remove the power-preference specific native displays. Add a native display for opengl, and use the default one for Metal. After the recent ANGLE roll, ANGLE uses (native display, power preference) as the key to look up EGLDisplays. * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLANGLE::releaseThreadResources): * platform/graphics/angle/GraphicsContextGLANGLE.h: * platform/graphics/cocoa/GraphicsContextGLCocoa.mm: (WebCore::initializeEGLDisplay): LayoutTests: * webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt: Added. * webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html: Added. * webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289071 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-03 Kimmo Kinnunen ANGLE Metal and ANGLE OpenGL cannot be initialised one after the other https://bugs.webkit.org/show_bug.cgi?id=236030 Reviewed by Dean Jackson. * webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt: Added. * webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html: Added. * webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html: Added. 2022-03-08 Russell Epstein Cherry-pick r288701. rdar://problem/83734079 "Unrecognized Content-Security-Policy directive 'worker-src'." https://bugs.webkit.org/show_bug.cgi?id=235260 Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * web-platform-tests/content-security-policy/child-src/child-src-cross-origin-load.sub-expected.txt: * web-platform-tests/content-security-policy/child-src/child-src-worker-blocked.sub-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-self/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-self/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-self/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-self/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-wildcard/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-wildcard/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-wildcard/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/script-src-wildcard/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-classic.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-classic.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-import.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-import.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-module.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/sharedworker-module.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-classic.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-classic.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-import.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-import.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-module.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-none/worker-module.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/sharedworker-import.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/sharedworker-import.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-wildcard/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-wildcard/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-wildcard/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-wildcard/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-self/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-self/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-self/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-self/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-wildcard/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-wildcard/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-wildcard/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/script-src-wildcard/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/worker-src/dedicated-fallback.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/dedicated-none.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/dedicated-worker-src-child-fallback-blocked.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/dedicated-worker-src-script-fallback.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/dedicated-worker-src-self-fallback.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/service-none.https.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/service-worker-src-child-fallback-blocked.https.sub-expected.txt: * web-platform-tests/content-security-policy/worker-src/shared-child.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-fallback.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-list.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-none.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-self.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-worker-src-child-fallback-blocked.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-worker-src-child-fallback.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-worker-src-default-fallback.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-worker-src-script-fallback.sub-expected.txt: Added. * web-platform-tests/content-security-policy/worker-src/shared-worker-src-self-fallback.sub-expected.txt: Added. * web-platform-tests/content-security-policy/blob/self-doesnt-match-blob.sub-expected.txt: * web-platform-tests/content-security-policy/blob/star-doesnt-match-blob.sub-expected.txt: * web-platform-tests/content-security-policy/gen/top.http-rp/worker-src-self/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/sharedworker-classic.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/sharedworker-classic.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/sharedworker-module.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/sharedworker-module.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-classic.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-classic.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-import.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-import.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-module.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-none/worker-module.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-self/sharedworker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-self/sharedworker-import-data.https-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-self/worker-import-data.http-expected.txt: * web-platform-tests/content-security-policy/gen/top.meta/worker-src-self/worker-import-data.https-expected.txt: Source/WebCore: Implementation of worker-src directive. According to https://www.w3.org/TR/CSP3/#changes-from-level-2 the worker-src directive now restricts URLs that can be loaded by workers, and defers to child-src if not specified. * bindings/js/WorkerModuleScriptLoader.cpp: (WebCore::WorkerModuleScriptLoader::load): Check worker-src instead of child-src for worker loads. * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy): * loader/ThreadableLoader.h: Check worker-src instead of child-src for worker loads. * page/csp/ContentSecurityPolicy.cpp: We can remove allowChildContextFromSource which is now fully replaced by allowWorkerFromSource. (WebCore::ContentSecurityPolicy::allowWorkerFromSource const): (WebCore::ContentSecurityPolicy::allowChildContextFromSource const): Deleted. * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::operativeDirectiveForWorkerSrc const): worker-src defers to child-src, then script-src, then default-src. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForWorker): (WebCore::ContentSecurityPolicyDirectiveList::addDirective): * page/csp/ContentSecurityPolicyDirectiveList.h: * page/csp/ContentSecurityPolicyDirectiveNames.cpp: * page/csp/ContentSecurityPolicyDirectiveNames.h: * workers/AbstractWorker.cpp: (WebCore::AbstractWorker::resolveURL): * workers/AbstractWorker.h: We check LegacySchemeRegistry::schemeShouldBypassContentSecurityPolicy in allowWorkerFromSource, so we don't need to check in in AbstractWorker::resolveURL anymore. We can also replace the child-src checks with worker-src ones. * workers/Worker.cpp: (WebCore::Worker::create): * workers/WorkerFontLoadRequest.cpp: (WebCore::WorkerFontLoadRequest::load): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): Block service worker registrations not specified by worker-src. * workers/shared/SharedWorker.cpp: (WebCore::SharedWorker::create): Block shared worker urls not specified by worker-src. * workers/shared/SharedWorkerScriptLoader.cpp: (WebCore::SharedWorkerScriptLoader::SharedWorkerScriptLoader): Source/WebKit: * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): LayoutTests: Update tests now that worker-src defaults eventually to script-src. Since this was not the case with child-src, legacy CSP tests do not expect script-src policies to affect workers. We can fix this by specifying a separate worker-src policy for these tests to maintain behavior. * TestExpectations: Some wpt tests log random URL strings that change for every test iteration. For now we can't unskip those. * http/tests/security/contentSecurityPolicy/1.1/child-src/worker-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/child-src/worker-redirect-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-blocks-eval.html: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-importScripts-block-aborts-all-subsequent-imports.html: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-importScripts-redirect-cross-origin-blocked.html: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp.html: * http/tests/security/contentSecurityPolicy/worker-script-src.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker-blob-eval.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker-blob-importScript-redirect-cross-origin.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker-blob-xhr.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288701 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-27 Kate Cheney "Unrecognized Content-Security-Policy directive 'worker-src'." https://bugs.webkit.org/show_bug.cgi?id=235260 Reviewed by Brent Fulgham. Update tests now that worker-src defaults eventually to script-src. Since this was not the case with child-src, legacy CSP tests do not expect script-src policies to affect workers. We can fix this by specifying a separate worker-src policy for these tests to maintain behavior. * TestExpectations: Some wpt tests log random URL strings that change for every test iteration. For now we can't unskip those. * http/tests/security/contentSecurityPolicy/1.1/child-src/worker-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/child-src/worker-redirect-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-blocks-eval.html: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-importScripts-block-aborts-all-subsequent-imports.html: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-importScripts-redirect-cross-origin-blocked.html: * http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp.html: * http/tests/security/contentSecurityPolicy/worker-script-src.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker-blob-eval.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker-blob-importScript-redirect-cross-origin.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker-blob-xhr.html: * http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html: 2022-03-07 Russell Epstein Cherry-pick r290853. rdar://problem/88669147 about:blank iframes do not always inherit parent CSP https://bugs.webkit.org/show_bug.cgi?id=236347 Reviewed by Brent Fulgham. Source/WebCore: Test: http/tests/security/contentSecurityPolicy/block-eval-onload-in-nested-about-blank-iframe.html Usually we initialize CSP for window when we create a jsWindowProxy for that frame. In this case, we load an about:blank iframe that attempts to run eval() in the onload function of its own nested iframe. Since we never run script in frame, we don't initialize a jsWindowProxy and thus never propogate its CSP. This fix checks the document's CSP in FrameLoader::clear when we initialize a new JSGlobalObject and sets the eval value in the window accordingly to properly enforce CSP. * bindings/js/ScriptController.cpp: (WebCore::ScriptController::enableEval): * bindings/js/ScriptController.h: * loader/FrameLoader.cpp: (WebCore::FrameLoader::clear): * page/csp/ContentSecurityPolicy.h: (WebCore::ContentSecurityPolicy::evalErrorMessage const): LayoutTests: * http/tests/security/contentSecurityPolicy/block-eval-onload-in-nested-about-blank-iframe-expected.txt: Added. * http/tests/security/contentSecurityPolicy/block-eval-onload-in-nested-about-blank-iframe.html: Added We can't use modern js-test.js and related functions because js-test.js uses eval() and loading it makes the test time out when the eval is blocked by the document's CSP. We can't specify unsafe-eval because the whole point of this test is to block eval. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290853 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-04 Kate Cheney about:blank iframes do not always inherit parent CSP https://bugs.webkit.org/show_bug.cgi?id=236347 Reviewed by Brent Fulgham. * http/tests/security/contentSecurityPolicy/block-eval-onload-in-nested-about-blank-iframe-expected.txt: Added. * http/tests/security/contentSecurityPolicy/block-eval-onload-in-nested-about-blank-iframe.html: Added We can't use modern js-test.js and related functions because js-test.js uses eval() and loading it makes the test time out when the eval is blocked by the document's CSP. We can't specify unsafe-eval because the whole point of this test is to block eval. 2022-03-07 Russell Epstein Cherry-pick r290812. rdar://problem/84662329 Element with position: sticky after sticking, starts to move incorrectly when scrolling https://bugs.webkit.org/show_bug.cgi?id=231953 Reviewed by Sam Weinig. Source/WebCore: Sometimes we'd fail to push new StickyPositionViewportConstraints to the scrolling tree, because operator== failed to compare m_constrainingRectAtLastLayout. This breaks the requirement that the "last committed scroll position" for the overflow scrolling node has to be updated in the same commit as the "constraining-rect-at-last-layout" on the sticky node. Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html * page/scrolling/ScrollingConstraints.cpp: (WebCore::operator<<): * page/scrolling/ScrollingConstraints.h: (WebCore::StickyPositionViewportConstraints::operator== const): LayoutTests: * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added. * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added. * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290812 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-03 Simon Fraser Element with position: sticky after sticking, starts to move incorrectly when scrolling https://bugs.webkit.org/show_bug.cgi?id=231953 Reviewed by Sam Weinig. * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added. * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added. * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html: Added. 2022-03-07 Russell Epstein Cherry-pick r290785. rdar://problem/66568551 nasa.gov page with fixed backgrounds paints incorrectly on scroll https://bugs.webkit.org/show_bug.cgi?id=237405 Reviewed by Antti Koivisto. Source/WebCore: https://www.nasa.gov/specials/artemis/ shows an issue where elements with background-attachment:fixed don't repaint on scroll. This page has scrollable and , and the elements with fixed backgrounds are composited, so this reveals that we fail to repaint composited children of an overflow scroll in this case. Fix by having RenderLayerScrollableArea::scrollTo() do repaints on slow repaint objects which are scrolled by the current scroller. Do some unrelated cleanup in code that I was going to use in this patch but turned out not to need: rename hasFixedBackgroundImage() to hasAnyFixedBackground() for clarity, and share the implementation with hasAnyLocalBackground(). Test: fast/repaint/background-attachment-fixed-in-composited-scroll.html * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): (WebCore::RenderElement::willBeDestroyed): * rendering/RenderLayer.cpp: * rendering/RenderLayerScrollableArea.cpp: (WebCore::RenderLayerScrollableArea::scrollTo): * rendering/style/FillLayer.cpp: (WebCore::FillLayer::hasImageWithAttachment const): (WebCore::FillLayer::hasFixedImage const): Deleted. * rendering/style/FillLayer.h: * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::hasAnyLocalBackground const): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::hasBackgroundImage const): (WebCore::RenderStyle::hasAnyFixedBackground const): (WebCore::RenderStyle::hasAnyLocalBackground const): (WebCore::RenderStyle::hasFixedBackgroundImage const): Deleted. LayoutTests: Repaint test which is only valid for mac-wk2 (iOS does not support background-attachment:fixed). * TestExpectations: * fast/repaint/background-attachment-fixed-in-composited-scroll-expected.txt: Added. * fast/repaint/background-attachment-fixed-in-composited-scroll.html: Added. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290785 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-03 Simon Fraser nasa.gov page with fixed backgrounds paints incorrectly on scroll https://bugs.webkit.org/show_bug.cgi?id=237405 Reviewed by Antti Koivisto. Repaint test which is only valid for mac-wk2 (iOS does not support background-attachment:fixed). * TestExpectations: * fast/repaint/background-attachment-fixed-in-composited-scroll-expected.txt: Added. * fast/repaint/background-attachment-fixed-in-composited-scroll.html: Added. * platform/mac-wk2/TestExpectations: 2022-03-07 Russell Epstein Cherry-pick r290778. rdar://problem/88297045 macOS Safari 15.2 Audio Echo Issue after camera pause/unpause https://bugs.webkit.org/show_bug.cgi?id=235544 Reviewed by Eric Carlson. Source/WebCore: After https://commits.webkit.org/r275600, the muted state of MediaPlayer would be set to the page muted state without taking into consideration HTMLMediaElement.muted. Update the call site to use effectiveMuted instead. Add internals API to write a corresponding layout test. Test: fast/mediastream/mediastreamtrack-audiovideo-mutepage.html * html/HTMLMediaElement.cpp: * testing/Internals.cpp: * testing/Internals.h: * testing/Internals.idl: LayoutTests: * fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt: Added. * fast/mediastream/mediastreamtrack-audiovideo-mutepage.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290778 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-03 Youenn Fablet macOS Safari 15.2 Audio Echo Issue after camera pause/unpause https://bugs.webkit.org/show_bug.cgi?id=235544 Reviewed by Eric Carlson. * fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt: Added. * fast/mediastream/mediastreamtrack-audiovideo-mutepage.html: Added. 2022-03-07 Russell Epstein Cherry-pick r290765. rdar://problem/89232969 Throw proper exception on failed removeEntry() calls https://bugs.webkit.org/show_bug.cgi?id=237382 Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-getDirectoryHandle.https.any-expected.txt: * web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-getDirectoryHandle.https.any.worker-expected.txt: * web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-getFileHandle.https.any-expected.txt: * web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-getFileHandle.https.any.worker-expected.txt: * web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-removeEntry.https.any-expected.txt: * web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-removeEntry.https.any.worker-expected.txt: Source/WebKit: Updated existing tests. * NetworkProcess/storage/FileSystemStorageError.h: (WebKit::convertToException): * NetworkProcess/storage/FileSystemStorageHandle.cpp: (WebKit::FileSystemStorageHandle::removeEntry): LayoutTests: * storage/filesystemaccess/handle-move-expected.txt: * storage/filesystemaccess/handle-move-worker-expected.txt: * storage/filesystemaccess/resources/handle-move.js: (async test): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290765 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-02 Sihui Liu Throw proper exception on failed removeEntry() calls https://bugs.webkit.org/show_bug.cgi?id=237382 Reviewed by Chris Dumez. * storage/filesystemaccess/handle-move-expected.txt: * storage/filesystemaccess/handle-move-worker-expected.txt: * storage/filesystemaccess/resources/handle-move.js: (async test): 2022-03-07 Russell Epstein Cherry-pick r290706. rdar://problem/89566459 REGRESSION(r285232) https://alvaromontoro.github.io/almond.css/demo/ looks wrong in Safari, ok in Chrome and Firefox https://bugs.webkit.org/show_bug.cgi?id=237276 Reviewed by Simon Fraser. Source/WebCore: r285232 introduced the isFixed() check as a resolvable preferred width type, but percent values are also resolvable as block layout gets the horizontal constraint from the containing block chain (unlike the height percent values) -i.e. 'width: 50%' can be resolved during preferred width computation. Test: fast/css-grid-layout/ascpect-ratio-with-percent-width.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const): LayoutTests: * fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html: Added. * fast/css-grid-layout/ascpect-ratio-with-percent-width.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290706 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-01 Alan Bujtas REGRESSION(r285232) https://alvaromontoro.github.io/almond.css/demo/ looks wrong in Safari, ok in Chrome and Firefox https://bugs.webkit.org/show_bug.cgi?id=237276 Reviewed by Simon Fraser. * fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html: Added. * fast/css-grid-layout/ascpect-ratio-with-percent-width.html: Added. 2022-03-07 Russell Epstein Cherry-pick r290606. rdar://problem/89482882 [macOS] Unable to upload ".pages" files to file inputs accepting ".pages" and ".jpeg" files https://bugs.webkit.org/show_bug.cgi?id=237219 rdar://89482882 Reviewed by Tim Horton and Said Abou-Hallawa. Source/WebCore: In r264286, WebKit began transcoding images of an unsupported format to a supported format, for file inputs that accepted image types. For example, selecting a HEIF image in an input that accepts JPEG images would transcode the selected image to a JPEG image. In order to determine when attempt transcoding, the logic added in r264286 obtains the MIME type corresponding to the selected file's extension, and compares that to the list of accepted MIME types. If there is a mismatch, transcoding is attempted. The ".pages" extension does not have a well-defined MIME type in NSURLFileTypeMappings. This is due to the fact that a the extension maps to both a file and a package type. Consequently, the retrieved MIME type for ".pages" files is an empty string. Following r227051, when the file input also accepts an image type, WebKit attempts to transcode these files, and any others that do not have a well-defined MIME type. While the aforementioned behavior can be considered strange, it is not an issue in practice, since WebKit will attempt to transcode the image, fail to do so, and upload the original file. The failure is detected in CGImageDestinationFinalize, which returns false if an image was not successfully written. However, a recent regression in the ImageIO framework is causing CGImageDestinationFinalize to return true, even if image transcoding fails. This results in WebKit uploading a zero byte JPEG file, when a user attempts to upload ".pages" files to file inputs accepting ".pages" and ".jpeg" files. Ideally, the described issue would be resolved by a fix in ImageIO. However, a more immediate solution exists in WebKit: only attempt to transcode files to an accepted image type, if the file selected is image. ".pages" files are not images, and WebKit should not attempt to transcode them. See below for further explanation of the solution. Test: fast/forms/file/entries-api/pages-jpeg-open-panel.html * platform/graphics/cg/ImageUtilitiesCG.cpp: (WebCore::transcodeImage): Prior to using ImageIO to perform transcoding, WebKit obtains a Uniform Type Identifier for the selected file using CGImageSourceCreateWithURL and CGImageSourceGetType. If the file is not an image, a null string is returned. WebKit can use this information to avoid the transcoding attempt, and avoid calls to ImageIO methods further down this method. Specifically, this solution works around the ImageIO bug by avoiding the call to CGImageDestinationFinalize for non-images. The solution is also an overall improvement, as WebKit now avoids unnecessary calls to multiple ImageIO methods, in cases where we know transcoding will fail. LayoutTests: Add a layout test that contains a file input that accepts ".pages" and ".jpeg" files, and attempts to upload a ".pages" file. * TestExpectations: * fast/forms/file/entries-api/pages-jpeg-open-panel-expected.txt: Added. * fast/forms/file/entries-api/pages-jpeg-open-panel.html: Added. * fast/forms/file/entries-api/pdf-jpeg-open-panel-expected.txt: Added. * fast/forms/file/entries-api/pdf-jpeg-open-panel.html: Added. * fast/forms/file/entries-api/resources/documents/document.pages: Added. * fast/forms/file/entries-api/resources/documents/document.pdf: Added. * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290606 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-28 Aditya Keerthi [macOS] Unable to upload ".pages" files to file inputs accepting ".pages" and ".jpeg" files https://bugs.webkit.org/show_bug.cgi?id=237219 rdar://89482882 Reviewed by Tim Horton and Said Abou-Hallawa. Add a layout test that contains a file input that accepts ".pages" and ".jpeg" files, and attempts to upload a ".pages" file. * TestExpectations: * fast/forms/file/entries-api/pages-jpeg-open-panel-expected.txt: Added. * fast/forms/file/entries-api/pages-jpeg-open-panel.html: Added. * fast/forms/file/entries-api/pdf-jpeg-open-panel-expected.txt: Added. * fast/forms/file/entries-api/pdf-jpeg-open-panel.html: Added. * fast/forms/file/entries-api/resources/documents/document.pages: Added. * fast/forms/file/entries-api/resources/documents/document.pdf: Added. * platform/mac-wk2/TestExpectations: 2022-03-07 Russell Epstein Cherry-pick r290559. rdar://problem/89510628 Optimize StyleSharingResolver inert checks https://bugs.webkit.org/show_bug.cgi?id=237235 Reviewed by Youenn Fablet. Source/WebCore: inert is an boolean attribute, the only thing that matters for the StyleAdjuster inertness adjustment is the presence of the attribute, not its value. E.g. `inert=false` is the same as `inert=inert` or `inert=true`. This saves getting and comparing values for those attributes, and also allows `inert=inert` and `inert=true` or `inert=false` to start sharing style. * style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::canShareStyleWithElement const): LayoutTests: Add small test that style sharing is not wrongly applied. * fast/css/inert-style-sharing-expected.html: Added. * fast/css/inert-style-sharing.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290559 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-27 Tim Nguyen Optimize StyleSharingResolver inert checks https://bugs.webkit.org/show_bug.cgi?id=237235 Reviewed by Youenn Fablet. Add small test that style sharing is not wrongly applied. * fast/css/inert-style-sharing-expected.html: Added. * fast/css/inert-style-sharing.html: Added. 2022-03-07 Russell Epstein Cherry-pick r290554. rdar://problem/83757966 Remove Node::deprecatedIsInert https://bugs.webkit.org/show_bug.cgi?id=230845 Reviewed by Antti Koivisto. LayoutTests/imported/w3c: This change unfortunately regresses focusability state when dynamically setting inert, due to a cached computed style invalidation bug. This is minor in practice, since focusability usually gets queried in user-initiated ways, when style already has fully been updated. However, making this change will improve performance by avoiding a full DOM ancestor walk when there is no inert attribute on the page, since we will only check a style bit after this patch. * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/remove-dialog-should-unblock-document-expected.txt: * web-platform-tests/inert/inert-canvas-fallback-content.tentative-expected.txt: * web-platform-tests/inert/inert-node-is-unfocusable.tentative-expected.txt: Source/WebCore: This change unfortunately regresses focusability state when dynamically setting inert, due to a cached computed style invalidation bug. This is minor in practice, since focusability usually gets queried in user-initiated ways, when style already has fully been updated. However, making this change will improve performance by avoiding a full DOM ancestor walk when there is no inert attribute on the page, since we will only check a style bit after this patch. * dom/Element.cpp: (WebCore::Element::isFocusable const): (WebCore::Element::isFocusableWithoutResolvingFullStyle const): (WebCore::Element::isVisibleWithoutResolvingFullStyle const): Deleted. * dom/Element.h: * dom/Node.cpp: (WebCore::Node::deprecatedIsInert const): Deleted. * dom/Node.h: * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::isFocusable const): LayoutTests: * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusing-steps-inert-expected.txt: Added. * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal-expected.txt: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290554 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-26 Tim Nguyen Remove Node::deprecatedIsInert https://bugs.webkit.org/show_bug.cgi?id=230845 Reviewed by Antti Koivisto. * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusing-steps-inert-expected.txt: Added. * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal-expected.txt: Added. 2022-03-07 Russell Epstein Cherry-pick r290430. rdar://problem/87713597 RELEASE_ASSERT(!renderer()); in WebCore::Node::~Node() + 479 (Node.cpp:366) https://bugs.webkit.org/show_bug.cgi?id=235380 Patch by Frédéric Wang on 2022-02-24 Reviewed by Ryosuke Niwa. Source/WebCore: RenderTreeUpdater::tearDownRenderers() browse the composed tree to tear down descendants. However, element with a shadow root are handled specially in ComposedTreeIterator::ComposedTreeIterator(), they have to be handled specially by calling a tearDownLeftoverShadowHostChildren(). This patch does the same for slot elements which are also handled specially in ComposedTreeIterator(). It also makes names within tearDownLeftoverShadowHostChildren() more generic. This in particular fixes a release assert when a slot with pseudo elements children is torn down. Test: fast/shadow-dom/slot-with-pseudo-element-children-renderer-teardown.html * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): Also call tearDownLeftoverShadowHostChildren for a slot element and add a comment pointing to the method corresponding to these special cases. (WebCore::RenderTreeUpdater::tearDownLeftoverChildrenOfComposedTree): Renamed to remove "shadow host". * rendering/updating/RenderTreeUpdater.h: Ditto. LayoutTests: Add non-regression test. * fast/shadow-dom/slot-with-pseudo-element-children-renderer-teardown-expected.txt: Added. * fast/shadow-dom/slot-with-pseudo-element-children-renderer-teardown.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290430 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-24 Frédéric Wang RELEASE_ASSERT(!renderer()); in WebCore::Node::~Node() + 479 (Node.cpp:366) https://bugs.webkit.org/show_bug.cgi?id=235380 Reviewed by Ryosuke Niwa. Add non-regression test. * fast/shadow-dom/slot-with-pseudo-element-children-renderer-teardown-expected.txt: Added. * fast/shadow-dom/slot-with-pseudo-element-children-renderer-teardown.html: Added. 2022-03-07 Russell Epstein Cherry-pick r290385. rdar://problem/70464703 [Subpixel] imported/w3c/web-platform-tests/css/css-flexbox/auto-margins-001.html fails at certain font sizes https://bugs.webkit.org/show_bug.cgi?id=217643 Unreviewed gardening. * platform/ios-simulator-wk2/TestExpectations: It must have progressed at some point. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290385 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-23 Alan Bujtas [Subpixel] imported/w3c/web-platform-tests/css/css-flexbox/auto-margins-001.html fails at certain font sizes https://bugs.webkit.org/show_bug.cgi?id=217643 Unreviewed gardening. * platform/ios-simulator-wk2/TestExpectations: It must have progressed at some point. 2022-03-07 Russell Epstein Cherry-pick r290356. rdar://problem/85765536 Crash when calling WEBGL_lose_context.loseContext() after the context has been lost https://bugs.webkit.org/show_bug.cgi?id=236966 Patch by Kimmo Kinnunen on 2022-02-23 Reviewed by Dean Jackson. Source/WebCore: WebGLRenderingContextBase::forceLostContext() would try to synthesize a GL error to the underlying m_context. However, m_context is cleared when a real context loss happens. This happens for example when we simulate a GPU status failure or when we create too many contexts. The m_context is not currently cleared when the page simulates context lost via WEBGL_lose_contexts.loseContext(). Test: webgl/lose-context-after-context-lost.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::synthesizeGLError): LayoutTests: * webgl/lose-context-after-context-lost-expected.txt: Added. * webgl/lose-context-after-context-lost.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290356 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-23 Kimmo Kinnunen Crash when calling WEBGL_lose_context.loseContext() after the context has been lost https://bugs.webkit.org/show_bug.cgi?id=236966 Reviewed by Dean Jackson. * webgl/lose-context-after-context-lost-expected.txt: Added. * webgl/lose-context-after-context-lost.html: Added. 2022-03-07 Russell Epstein Cherry-pick r290306. rdar://problem/88352589 Make pointer-events checks for SVG take in account inert subtrees https://bugs.webkit.org/show_bug.cgi?id=235836 Reviewed by Antti Koivisto. LayoutTests/imported/w3c: Added tests for both inert attribute & modal dialog cases. * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-svg-hittest-expected.txt: Added. * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-svg-hittest.html: Added. * web-platform-tests/inert/inert-svg-hittest.tentative-expected.txt: Added. * web-platform-tests/inert/inert-svg-hittest.tentative.html: Added. Source/WebCore: Re-using visibleToHitTesting in SVG code isn't possible, because visibleToHitTesting removes visibility: hidden; content from hit-testing, which we do not want to here, since pointer-events has values for SVG which still allow clicking content regardless of their visibility value (pointer-events: painted/fill/stroke/all). Instead, we add an inert-aware effectivePointerEvents, similar to effectiveUserSelect and re-use that across the codebase. Tests: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-svg-hittest.html imported/w3c/web-platform-tests/inert/inert-svg-hittest.tentative.html * rendering/RenderElement.cpp: (WebCore::RenderElement::styleWillChange): * rendering/RenderElement.h: (WebCore::RenderElement::visibleToHitTesting const): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::layerStyleChanged): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::effectivePointerEvents const): * rendering/svg/LegacyRenderSVGModelObject.cpp: (WebCore::LegacyRenderSVGModelObject::checkIntersection): (WebCore::LegacyRenderSVGModelObject::checkEnclosure): * rendering/svg/LegacyRenderSVGShape.cpp: (WebCore::LegacyRenderSVGShape::nodeAtFloatPoint): * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::nodeAtFloatPoint): * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::checkIntersection): (WebCore::RenderSVGModelObject::checkEnclosure): * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::nodeAtPoint): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::nodeAtFloatPoint): * rendering/svg/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::nodeAtPoint): LayoutTests: iOS doesn't support test_actions, so it needs different baselines. * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-svg-hittest-expected.txt: Added. * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-svg-hittest.tentative-expected.txt: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290306 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-22 Tim Nguyen Make pointer-events checks for SVG take in account inert subtrees https://bugs.webkit.org/show_bug.cgi?id=235836 Reviewed by Antti Koivisto. iOS doesn't support test_actions, so it needs different baselines. * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-svg-hittest-expected.txt: Added. * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-svg-hittest.tentative-expected.txt: Added. 2022-03-07 Russell Epstein Cherry-pick r290164. rdar://problem/89162532 Re-import inert and WPT https://bugs.webkit.org/show_bug.cgi?id=236808 Reviewed by Simon Fraser. Commit: https://github.com/web-platform-tests/wpt/commit/0d483a3bea340a2c60cb7a4add49eb63cbba2a64 LayoutTests/imported/w3c: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-delegatesfocus-expected.txt. * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-delegatesfocus.html. * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-expected.txt: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames-expected.txt: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-label-focus.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes-expected.txt: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-scroll-height.html: * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log: * web-platform-tests/inert/dynamic-inert-on-focused-element.tentative-expected.txt: Added. * web-platform-tests/inert/dynamic-inert-on-focused-element.tentative.html: Added. * web-platform-tests/inert/inert-canvas-fallback-content.tentative-expected.txt: Added. * web-platform-tests/inert/inert-canvas-fallback-content.tentative.html: Added. * web-platform-tests/inert/inert-iframe-hittest.tentative-expected.txt: Added. * web-platform-tests/inert/inert-iframe-hittest.tentative.html: Added. * web-platform-tests/inert/inert-iframe-tabbing.tentative-expected.txt: Added. * web-platform-tests/inert/inert-iframe-tabbing.tentative.html: Added. * web-platform-tests/inert/inert-node-is-uneditable.tentative.html: * web-platform-tests/inert/inert-with-modal-dialog-001.tentative-expected.txt: Added. * web-platform-tests/inert/inert-with-modal-dialog-001.tentative.html: Added. * web-platform-tests/inert/inert-with-modal-dialog-002.tentative-expected.txt: Added. * web-platform-tests/inert/inert-with-modal-dialog-002.tentative.html: Added. * web-platform-tests/inert/w3c-import.log: LayoutTests: * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-hittest.tentative-expected.txt: Added. * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-tabbing.tentative-expected.txt: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290164 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-18 Tim Nguyen Re-import inert and WPT https://bugs.webkit.org/show_bug.cgi?id=236808 Reviewed by Simon Fraser. Commit: https://github.com/web-platform-tests/wpt/commit/0d483a3bea340a2c60cb7a4add49eb63cbba2a64 * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-hittest.tentative-expected.txt: Added. * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-iframe-tabbing.tentative-expected.txt: Added. 2022-03-07 Russell Epstein Cherry-pick r289700. rdar://problem/85249360 WebGL2 AllowShared TypedArray should be accepted https://bugs.webkit.org/show_bug.cgi?id=232662 Reviewed by Dean Jackson. Source/WebCore: Test: webgl/webgl-allow-shared-typed-array.html TypedArray with [AllowShared] annotation is not handled properly, which results in handling it as Sequence, invoking iteration protocol to copy them. This patch adds that as the same to [AllowShared] ArrayBuffer / ArrayBufferView. * bindings/IDLTypes.h: * bindings/js/JSDOMConvertUnion.h: LayoutTests: * webgl/webgl-allow-shared-typed-array-expected.txt: Added. * webgl/webgl-allow-shared-typed-array.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289700 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-12 Yusuke Suzuki WebGL2 AllowShared TypedArray should be accepted https://bugs.webkit.org/show_bug.cgi?id=232662 Reviewed by Dean Jackson. * webgl/webgl-allow-shared-typed-array-expected.txt: Added. * webgl/webgl-allow-shared-typed-array.html: Added. 2022-03-07 Russell Epstein Cherry-pick r289533. rdar://problem/88452971 Settling of a fetch promise should be delayed in case page is entering page cache https://bugs.webkit.org/show_bug.cgi?id=236292 Reviewed by Chris Dumez. Source/WebCore: Make sure to enqueue a task before resolving fetch promise as otherwise, page might continue running JavaScript. Do this for worker as well for good measure. We move signal aborted checks to two clients to handle rejecting fetch promise synchronously. Test: http/tests/navigation/fetch-pagecache.html * Modules/cache/DOMCache.cpp: * Modules/fetch/FetchResponse.cpp: * Modules/fetch/FetchResponse.h: * Modules/fetch/WindowOrWorkerGlobalScopeFetch.cpp: * workers/service/FetchEvent.cpp: LayoutTests: * http/tests/navigation/fetch-pagecache-expected.txt: Added. * http/tests/navigation/fetch-pagecache.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289533 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-10 Youenn Fablet Settling of a fetch promise should be delayed in case page is entering page cache https://bugs.webkit.org/show_bug.cgi?id=236292 Reviewed by Chris Dumez. * http/tests/navigation/fetch-pagecache-expected.txt: Added. * http/tests/navigation/fetch-pagecache.html: Added. 2022-03-07 Russell Epstein Cherry-pick r289121. rdar://problem/88492251 Fix App Privacy Report redirect attribution https://bugs.webkit.org/show_bug.cgi?id=236111 Reviewed by Brent Fulgham. Source/WebCore: Test: http/tests/app-privacy-report/user-attribution-redirect.html Test: http/tests/app-privacy-report/app-attribution-redirect.html * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): Source/WebKit: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): LayoutTests: * http/tests/app-privacy-report/resources/redirect.js: Added. * http/tests/app-privacy-report/app-attribution-redirect-expected.txt: Added. * http/tests/app-privacy-report/app-attribution-redirect.html: Added. * http/tests/app-privacy-report/user-attribution-redirect-expected.txt: Added. * http/tests/app-privacy-report/user-attribution-redirect.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289121 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-04 Kate Cheney Fix App Privacy Report redirect attribution https://bugs.webkit.org/show_bug.cgi?id=236111 Reviewed by Brent Fulgham. * http/tests/app-privacy-report/resources/redirect.js: Added. * http/tests/app-privacy-report/app-attribution-redirect-expected.txt: Added. * http/tests/app-privacy-report/app-attribution-redirect.html: Added. * http/tests/app-privacy-report/user-attribution-redirect-expected.txt: Added. * http/tests/app-privacy-report/user-attribution-redirect.html: Added. 2022-03-07 Russell Epstein Cherry-pick r289101. rdar://problem/87625596 Two bopomofo tone marks are not moved to the correct place in vertical text with a particular bopomofo font https://bugs.webkit.org/show_bug.cgi?id=235257 Reviewed by Darin Adler. .: Thank you so much to Bobby Tung and But Ko for reporting this bug and providing a test font for it!!! * metadata/contributors.json: Source/WebCore: Turns out one of our character data tables was missing some characters. I really dislike these kinds of fixes, because it's just perpetuating the fact that WebKit has big tables of characters in its source code. A long-term fix would be a systemic replacement of this entire table with either Unicode property lookup, or more ideally, removing the need for it in the first place. Unfortunately, at this point in the release cycle, this fix probably needs to be smaller and more targetted. Tests: fast/text/bopomofo-tone-marks-2.html fast/text/bopomofo-tone-marks.html * platform/graphics/FontCascade.cpp: (WebCore::FontCascade::isCJKIdeographOrSymbol): LayoutTests: This can't be a WPT test because we only have permission to add the test font to the WebKit repository. Thank you so much to Bobby Tung and But Ko for reporting this bug and providing a test font for it!!! * fast/text/bopomofo-tone-marks-2-expected-mismatch.html: Added. * fast/text/bopomofo-tone-marks-2.html: Added. * fast/text/bopomofo-tone-marks-expected-mismatch.html: Added. * fast/text/bopomofo-tone-marks.html: Added. * fast/text/resources/BopomofoGposSubset-Regular/BopomofoGposSubset-Regular.ttf: Added. * fast/text/resources/BopomofoGposSubset-Regular/LICENSE: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289101 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-03 Myles C. Maxfield Two bopomofo tone marks are not moved to the correct place in vertical text with a particular bopomofo font https://bugs.webkit.org/show_bug.cgi?id=235257 Reviewed by Darin Adler. This can't be a WPT test because we only have permission to add the test font to the WebKit repository. Thank you so much to Bobby Tung and But Ko for reporting this bug and providing a test font for it!!! * fast/text/bopomofo-tone-marks-2-expected-mismatch.html: Added. * fast/text/bopomofo-tone-marks-2.html: Added. * fast/text/bopomofo-tone-marks-expected-mismatch.html: Added. * fast/text/bopomofo-tone-marks.html: Added. * fast/text/resources/BopomofoGposSubset-Regular/BopomofoGposSubset-Regular.ttf: Added. * fast/text/resources/BopomofoGposSubset-Regular/LICENSE: Added. 2022-03-07 Russell Epstein Cherry-pick r287898. rdar://problem/86035420 Rewrite touch and drag tests to be more robust. https://bugs.webkit.org/show_bug.cgi?id=235057 rdar://86035420 Reviewed by Wenson Hsieh. Rewrite the touch-and-drag tests to check for selection changes, not specific text selections. Specific selections and subject to small changes in font and layout, and all that is actually important is that there have been selection changes based off of dragged touches. The touch-event-radius test has been updated to use the screen size directly, since the radius is scaled by the screen size internally. The output has been changed to not need to be updated when the test phone changes. * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text-expected.txt: * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text.html: * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text-expected.txt: * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text.html: * fast/events/touch/ios/long-press-on-editable-content-then-drag-up-to-change-selected-text.html: * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt: * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html: * fast/events/touch/ios/long-press-then-drag-to-select-text-expected.txt: * fast/events/touch/ios/long-press-then-drag-to-select-text.html: * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt: * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html: * fast/events/touch/ios/touch-event-radius-expected.txt: * fast/events/touch/ios/touch-event-radius.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287898 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-11 Megan Gardner Rewrite touch and drag tests to be more robust. https://bugs.webkit.org/show_bug.cgi?id=235057 rdar://86035420 Reviewed by Wenson Hsieh. Rewrite the touch-and-drag tests to check for selection changes, not specific text selections. Specific selections and subject to small changes in font and layout, and all that is actually important is that there have been selection changes based off of dragged touches. The touch-event-radius test has been updated to use the screen size directly, since the radius is scaled by the screen size internally. The output has been changed to not need to be updated when the test phone changes. * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text-expected.txt: * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-down-to-change-selected-text.html: * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text-expected.txt: * fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-up-to-change-selected-text.html: * fast/events/touch/ios/long-press-on-editable-content-then-drag-up-to-change-selected-text.html: * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text-expected.txt: * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html: * fast/events/touch/ios/long-press-then-drag-to-select-text-expected.txt: * fast/events/touch/ios/long-press-then-drag-to-select-text.html: * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text-expected.txt: * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html: * fast/events/touch/ios/touch-event-radius-expected.txt: * fast/events/touch/ios/touch-event-radius.html: 2022-03-01 Russell Epstein Revert r289282. rdar://problem/88876661 2022-03-01 Russell Epstein Cherry-pick r290087. rdar://problem/88713302 Source/ThirdParty/ANGLE: Metal ANGLE: vertex array does not correctly observe contents of data buffers https://bugs.webkit.org/show_bug.cgi?id=236733 Patch by Kyle Piddington on 2022-02-17 Reviewed by Dean Jackson. Similar to previous bug (236427), we were not correctly observing changes to the vertex buffer data. This caused us to miss rebinding vertex buffers when data was updated without causing conversion * src/libANGLE/renderer/metal/VertexArrayMtl.h: * src/libANGLE/renderer/metal/VertexArrayMtl.mm: (rx::VertexArrayMtl::syncState): (rx::VertexArrayMtl::setupDraw): (rx::VertexArrayMtl::syncDirtyAttrib): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290087 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-03-01 Russell Epstein Cherry-pick r290512. rdar://problem/86582214 [Tables] Incorrect table sizing when colgroup comes after tbody https://bugs.webkit.org/show_bug.cgi?id=237205 Reviewed by Antti Koivisto. Source/WebCore: Let's use the colgroup for table sizing even when it comes after any thead, tbody, tfoot, and tr elements. This makes WebKit match other rendering engines (see https://src.chromium.org/viewvc/blink?revision=159442&view=revision) Test: fast/table/table-sizing-fails-when-colgroup-comes-after-content.html * rendering/RenderTable.cpp: (WebCore::RenderTable::firstColumn const): * rendering/RenderTableCol.cpp: (WebCore::RenderTableCol::nextColumn const): LayoutTests: * fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html: Added. * fast/table/table-sizing-fails-when-colgroup-comes-after-content.html: Added. * platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt: Progression. 2022-02-17 Kyle Piddington Metal ANGLE: vertex array does not correctly observe contents of data buffers https://bugs.webkit.org/show_bug.cgi?id=236733 Reviewed by Dean Jackson. Similar to previous bug (236427), we were not correctly observing changes to the vertex buffer data. This caused us to miss rebinding vertex buffers when data was updated without causing conversion * fast/canvas/webgl/buffer-data-subdata-dynamic-buffer.html: Added. * fast/canvas/webgl/buffer-data-subdata-dynamic-buffer-expected.txt: Added. * platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt: Progression. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290512 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-25 Alan Bujtas [Tables] Incorrect table sizing when colgroup comes after tbody https://bugs.webkit.org/show_bug.cgi?id=237205 Reviewed by Antti Koivisto. * fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html: Added. * fast/table/table-sizing-fails-when-colgroup-comes-after-content.html: Added. * platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt: Progression. * platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt: Progression. 2022-03-01 Russell Epstein Cherry-pick r290156. rdar://problem/89154452 ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled https://bugs.webkit.org/show_bug.cgi?id=236846 Patch by Sam Sneddon on 2022-02-18 Reviewed by Chris Dumez. Source/WebCore: Tests: http/wpt/push-api/onpush-disabled.html http/wpt/push-api/onpush-enabled.html * Modules/push-api/ServiceWorkerGlobalScope+PushAPI.idl: LayoutTests: * http/wpt/push-api/onpush-disabled-expected.txt: Added. * http/wpt/push-api/onpush-disabled.html: Added. * http/wpt/push-api/onpush-disabled.js: Added. (test): * http/wpt/push-api/onpush-enabled-expected.txt: Added. * http/wpt/push-api/onpush-enabled.html: Added. * http/wpt/push-api/onpush-enabled.js: Added. (test): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290156 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-18 Sam Sneddon ServiceWorkerGlobalScope+PushAPI requires PushAPIEnabled https://bugs.webkit.org/show_bug.cgi?id=236846 Reviewed by Chris Dumez. * http/wpt/push-api/onpush-disabled-expected.txt: Added. * http/wpt/push-api/onpush-disabled.html: Added. * http/wpt/push-api/onpush-disabled.js: Added. (test): * http/wpt/push-api/onpush-enabled-expected.txt: Added. * http/wpt/push-api/onpush-enabled.html: Added. * http/wpt/push-api/onpush-enabled.js: Added. (test): 2022-03-01 Russell Epstein Cherry-pick r289995. rdar://problem/87462825 REGRESSION(r285885) Unable to exit Trip Details in Amtrak app https://bugs.webkit.org/show_bug.cgi?id=236732 Reviewed by Simon Fraser. Source/WebCore: Starting from r285885 an (effective)”overflow: clip” value is set on any block box with “contain: paint”. It is supposed to ensure we don’t paint outside of the box’s border box (note that "contain: paint", as the name implies, should only affect painting). However this effective value trickles in to layout affecting certain layout constraints. In case of flex, it makes the flex layout think that the box is really a clipped box and it starts flexing it accordingly producing incorrect size. What it means is that the minimum preferred size ends up being 0px because now with "let's clip all the overflow content" 0px is indeed the smallest size a box could take that does not produce overflow (while with the initial, “overflow: visible” value, its minimum width would likely be > 0px -provided it has some content. Also note that setting “overflow: clip” on the box in the markup (so it becomes an explicit clip value and not just an “effective” implicit clip through “contain: paint”) produces the exact same rendering meaning that this effective property value does affect layout). This is a partial revert of r285885 (focusing on where the flex algorithm consults with the flex items' overflow values). Test: fast/flexbox/incorrect-min-size-with-paint-contain.html * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::mainAxisOverflowForChild const): (WebCore::RenderFlexibleBox::crossAxisOverflowForChild const): LayoutTests: * fast/flexbox/incorrect-min-size-with-paint-contain-expected.html: Added. * fast/flexbox/incorrect-min-size-with-paint-contain.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289995 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-16 Alan Bujtas REGRESSION(r285885) Unable to exit Trip Details in Amtrak app https://bugs.webkit.org/show_bug.cgi?id=236732 Reviewed by Simon Fraser. * fast/flexbox/incorrect-min-size-with-paint-contain-expected.html: Added. * fast/flexbox/incorrect-min-size-with-paint-contain.html: Added. 2022-03-01 Russell Epstein Cherry-pick r289693. rdar://problem/88264857 Suppress style invalidation when matching :checked https://bugs.webkit.org/show_bug.cgi?id=235910 Patch by Rob Buis on 2022-02-12 Reviewed by Antti Koivisto. Source/WebCore: Suppress style invalidation when matching :checked for option elements. Test: fast/selectors/has-select-option-crash.html * css/SelectorCheckerTestFunctions.h: (WebCore::isChecked): * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::selected const): (WebCore::HTMLOptionElement::setSelectedState): * html/HTMLOptionElement.h: * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::updateListItemSelectedStates): (WebCore::HTMLSelectElement::recalcListItems const): * html/HTMLSelectElement.h: LayoutTests: * fast/selectors/has-select-option-crash-expected.txt: Added. * fast/selectors/has-select-option-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289693 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-12 Rob Buis Suppress style invalidation when matching :checked https://bugs.webkit.org/show_bug.cgi?id=235910 Reviewed by Antti Koivisto. * fast/selectors/has-select-option-crash-expected.txt: Added. * fast/selectors/has-select-option-crash.html: Added. 2022-02-28 Russell Epstein Cherry-pick r289526. rdar://problem/87061239 [:has() pseudo-class] Nullptr crash with non-function :has https://bugs.webkit.org/show_bug.cgi?id=236431 rdar://87061239 Reviewed by Cameron McCormack. LayoutTests/imported/w3c: * web-platform-tests/css/selectors/parsing/parse-has-expected.txt: * web-platform-tests/css/selectors/parsing/parse-has.html: Source/WebCore: Test: fast/selectors/malformed-has.html * css/parser/CSSSelectorParser.cpp: (WebCore::isOnlyPseudoClassFunction): :has() is legal, plain :has is not. LayoutTests: * fast/selectors/malformed-has-expected.txt: Added. * fast/selectors/malformed-has.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289526 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-10 Antti Koivisto [:has() pseudo-class] Nullptr crash with non-function :has https://bugs.webkit.org/show_bug.cgi?id=236431 rdar://87061239 Reviewed by Cameron McCormack. * fast/selectors/malformed-has-expected.txt: Added. * fast/selectors/malformed-has.html: Added. 2022-02-28 Russell Epstein Cherry-pick r289462. rdar://problem/88580935 Don't return an empty value from AbortController.signal.reason and make it harder to return empty values from JSValueInWrappedObject https://bugs.webkit.org/show_bug.cgi?id=236318 Reviewed by Mark Lam. Source/WebCore: This patch makes it so we might not accidentally return the empty value to JavaScript code from JSValueInWrappedObject. Previously, JSValueInWrappedObject had an "operator JSValue()" method. This patch removes that, adds a new conversion method for converting between JSValueInWrappedObject and JSValue, and makes JSValueInWrappedObject return undefined inside this method when it used to return the empty value. This fixes a crash where we'd return the empty value to JS JIT code, and crash dereferencing a nullptr. It's never valid for a JS function call (or getter, etc) to return the empty value. Test: fast/dom/AbortSignal-reason-crash-2.html * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::getChannelData): * Modules/webaudio/AudioWorkletProcessor.cpp: (WebCore::toJSArray): (WebCore::toJSObject): (WebCore::AudioWorkletProcessor::buildJSArguments): * bindings/js/JSCustomEventCustom.cpp: (WebCore::JSCustomEvent::detail const): * bindings/js/JSDOMConvertAny.h: (WebCore::JSConverter::convert): * bindings/js/JSMessageEventCustom.cpp: (WebCore::JSMessageEvent::data const): * bindings/js/JSPaymentMethodChangeEventCustom.cpp: (WebCore::JSPaymentMethodChangeEvent::methodDetails const): * bindings/js/JSPopStateEventCustom.cpp: (WebCore::JSPopStateEvent::state const): * bindings/js/JSValueInWrappedObject.h: (WebCore::JSValueInWrappedObject::getValue const): (WebCore::JSValueInWrappedObject::operator bool const): (WebCore::cachedPropertyValue): (WebCore::JSValueInWrappedObject::operator JSC::JSValue const): Deleted. * dom/AbortSignal.cpp: (WebCore::AbortSignal::signalFollow): (WebCore::AbortSignal::throwIfAborted): * dom/ErrorEvent.cpp: (WebCore::ErrorEvent::error): (WebCore::ErrorEvent::trySerializeError): * dom/PopStateEvent.cpp: (WebCore::PopStateEvent::trySerializeState): * page/History.cpp: (WebCore::History::cachedState): LayoutTests: * fast/dom/AbortSignal-reason-crash-2-expected.txt: Added. * fast/dom/AbortSignal-reason-crash-2.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289462 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-09 Saam Barati Don't return an empty value from AbortController.signal.reason and make it harder to return empty values from JSValueInWrappedObject https://bugs.webkit.org/show_bug.cgi?id=236318 Reviewed by Mark Lam. * fast/dom/AbortSignal-reason-crash-2-expected.txt: Added. * fast/dom/AbortSignal-reason-crash-2.html: Added. 2022-02-28 Russell Epstein Cherry-pick r289377. rdar://problem/88178304 Return 'none' for the computed style of mask when there are no mask images https://bugs.webkit.org/show_bug.cgi?id=236265 Patch by Matt Woodrow on 2022-02-08 Reviewed by Dean Jackson. Source/WebCore: Rather than returning all the longhand properties, return 'none' if there are no mask images. This no longer matches the behaviour of the 'background' property, but better matches what other UAs do. Ideally we'd return the smallest possible canonical representation of the non-initial property values, but this is a much simpler change to fix a compat regression. Test: fast/masking/parsing-mask.html Updates expected results to match new behavior. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::getLayerCount): (WebCore::ComputedStyleExtractor::getFillLayerPropertyShorthandValue): (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue): (WebCore::ComputedStyleExtractor::getMaskShorthandValue): * css/CSSComputedStyleDeclaration.h: LayoutTests: * fast/masking/parsing-mask-expected.txt: * fast/masking/parsing-mask.html: Updated expected results to expect 'none' for all cases where there isn't an actual mask image. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289377 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-08 Matt Woodrow Return 'none' for the computed style of mask when there are no mask images https://bugs.webkit.org/show_bug.cgi?id=236265 Reviewed by Dean Jackson. * fast/masking/parsing-mask-expected.txt: * fast/masking/parsing-mask.html: Updated expected results to expect 'none' for all cases where there isn't an actual mask image. 2022-02-15 Russell Epstein Cherry-pick r289776. rdar://problem/88656665 Fix crash with deeply nested async overflow scroll https://bugs.webkit.org/show_bug.cgi?id=236599 Source/WebCore: rdar://88656665 Reviewed by Alan Bujtas. mergeClippingScopesRecursive() already does the append of the rects; doing so before calling recursing triggers double appends, hence exponentially growing rect lists. Test: compositing/layer-creation/clipping-scope/deeply-nested-overflow.html * rendering/LayerOverlapMap.cpp: (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): LayoutTests: Reviewed by Alan Bujtas. * compositing/layer-creation/clipping-scope/deeply-nested-overflow-expected.txt: Added. * compositing/layer-creation/clipping-scope/deeply-nested-overflow.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289776 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-14 Simon Fraser Fix crash with deeply nested async overflow scroll https://bugs.webkit.org/show_bug.cgi?id=236599 Reviewed by Alan Bujtas. * compositing/layer-creation/clipping-scope/deeply-nested-overflow-expected.txt: Added. * compositing/layer-creation/clipping-scope/deeply-nested-overflow.html: Added. 2022-02-14 Russell Epstein Cherry-pick r289686. rdar://problem/88689388 `contain:content` breaks fullscreen https://bugs.webkit.org/show_bug.cgi?id=236470 Reviewed by Simon Fraser. Source/WebCore: Paint/layout containment forms a containing block for fixed positioned block boxes. It makes all fixed positioned descendants anchored (contained) to this layout container. This patch enables fullscreen boxes break out of this non-ICB based layout scope (this is similar to what we do for other, "layout scope changing" properties, see canContainFixedPositionObjects). Test: fullscreen/fullscreen-prevented-by-containment.html * css/fullscreen.css: (:-webkit-full-screen-ancestor:not(iframe)): * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): LayoutTests: * fullscreen/fullscreen-prevented-by-containment-expected.txt: Added. * fullscreen/fullscreen-prevented-by-containment.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289686 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-11 Alan Bujtas `contain:content` breaks fullscreen https://bugs.webkit.org/show_bug.cgi?id=236470 Reviewed by Simon Fraser. * fullscreen/fullscreen-prevented-by-containment-expected.txt: Added. * fullscreen/fullscreen-prevented-by-containment.html: Added. 2022-02-10 Alan Coon Cherry-pick r288434. rdar://problem/56436745 texImage2d fails to set same video frame to multiple textures https://bugs.webkit.org/show_bug.cgi?id=203148 Patch by Kimmo Kinnunen on 2022-01-24 Reviewed by Darin Adler. Source/WebCore: WebGL optimizes repeated video uploads to same texture, due to this being usual practice among pages. Reason is that there are no API to know when the video frame updates. The algorithm was: - If the IOSurface is the same as in the last call - If the texture contents has not changed since we last modified this texture then skip the upload. However, this logic skips errorneously if the "last call" updates some other texture. Fix and test the above. There are other issues for the current algorithm. This patch fixes some other theoretical ones: - If the texture is deleted and new one gets assigned the same texture id and the content seed would clash - Video was uploaded to a different level The previous implementation was keeping per-texture seed value map in the context (GraphicsContextGLANGLE) and per-teture seed value map in the texture upload helper (GraphicsContextGLCVCocoa) and last uploaded IOSurface seed in the upload helper (not per texture). The implementation in this patch keeps per-texture known content description in the texture upload helper and invalidates this when each texture changes. The known content description is the parameter list of the texture upload call. Test: webgl/pending/conformance/textures/misc/tex-image-video-repeated.html * platform/graphics/GraphicsContextGLState.h: (WebCore::GraphicsContextGLState::setBoundTexture): * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLANGLE::texImage2D): (WebCore::GraphicsContextGLANGLE::texSubImage2D): (WebCore::GraphicsContextGLANGLE::compressedTexImage2D): (WebCore::GraphicsContextGLANGLE::compressedTexSubImage2D): (WebCore::GraphicsContextGLANGLE::texStorage2D): (WebCore::GraphicsContextGLANGLE::texStorage3D): (WebCore::GraphicsContextGLANGLE::texImage2DDirect): (WebCore::GraphicsContextGLANGLE::framebufferTexture2D): (WebCore::GraphicsContextGLANGLE::createTexture): (WebCore::GraphicsContextGLANGLE::deleteTexture): (WebCore::GraphicsContextGLANGLE::invalidateKnownTextureContent): (WebCore::GraphicsContextGLANGLE::textureSeed): Deleted. * platform/graphics/angle/GraphicsContextGLANGLE.h: * platform/graphics/cocoa/GraphicsContextGLCocoa.h: * platform/graphics/cocoa/GraphicsContextGLCocoa.mm: (WebCore::GraphicsContextGLCocoa::invalidateKnownTextureContent): * platform/graphics/cv/GraphicsContextGLCVCocoa.cpp: (WebCore::GraphicsContextGLCVCocoa::TextureContent::operator== const): (WebCore::GraphicsContextGLCVCocoa::copyVideoSampleToTexture): (WebCore::GraphicsContextGLCVCocoa::invalidateKnownTextureContent): * platform/graphics/cv/GraphicsContextGLCVCocoa.h: LayoutTests: Add a test for testing the bug in which some video texture uploads were skipped errorneously. * webgl/pending/conformance/textures/misc/tex-image-video-repeated.html: Added. * webgl/pending/conformance/textures/misc/tex-image-video-repeated-expected.txt: Added. * webgl/pending/resources/webgl_test_files/conformance/textures/misc/tex-image-video-repeated.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288434 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-24 Kimmo Kinnunen texImage2d fails to set same video frame to multiple textures https://bugs.webkit.org/show_bug.cgi?id=203148 Reviewed by Darin Adler. Add a test for testing the bug in which some video texture uploads were skipped errorneously. * webgl/pending/conformance/textures/misc/tex-image-video-repeated.html: Added. * webgl/pending/conformance/textures/misc/tex-image-video-repeated-expected.txt: Added. * webgl/pending/resources/webgl_test_files/conformance/textures/misc/tex-image-video-repeated.html: Added. 2022-02-08 Russell Epstein Cherry-pick r287055. rdar://problem/86488039 REGRESSION (r286982): ASSERTION FAILED: clipRectsContext.rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType] https://bugs.webkit.org/show_bug.cgi?id=234315 Unreviewed test gardening. * TestExpectations: Skip the test. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287055 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-12-14 Ryan Haddad REGRESSION (r286982): ASSERTION FAILED: clipRectsContext.rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType] https://bugs.webkit.org/show_bug.cgi?id=234315 Unreviewed test gardening. * TestExpectations: Skip the test. 2022-02-07 Russell Epstein Cherry-pick r289108. rdar://problem/88599722 HTMLMediaElement should dispatch the resize event asynchronously https://bugs.webkit.org/show_bug.cgi?id=230895 Reviewed by Darin Adler. Source/WebCore: The HTMLMediaElement is currently queueing a task to dispatch the resize event in the post layout phase. There is no need to run it synchronously and we could move it to another queue were it will be run asynchronously as it was done for other similar tasks in the past. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::layoutSizeChanged): LayoutTests: * media/modern-media-controls/media-controller/media-controller-resize.html: Remove the event listener to avoid an extra notification. * platform/mac/TestExpectations: Unskipped tests that pass now. * platform/wincairo/TestExpectations: Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289108 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-04 Sergio Villar Senin HTMLMediaElement should dispatch the resize event asynchronously https://bugs.webkit.org/show_bug.cgi?id=230895 Reviewed by Darin Adler. * media/modern-media-controls/media-controller/media-controller-resize.html: Remove the event listener to avoid an extra notification. * platform/mac/TestExpectations: Unskipped tests that pass now. * platform/wincairo/TestExpectations: Ditto. 2022-02-07 Russell Epstein Cherry-pick r289060. rdar://problem/86337125 null ptr deref in RenderTreeBuilder::Block::attachIgnoringContinuation https://bugs.webkit.org/show_bug.cgi?id=234170 Patch by Frédéric Wang on 2022-02-03 Reviewed by Antti Koivisto. Source/WebCore: When an element with "display: contents" is put into the top layer, its computed style for the display property becomes "block" [1]. However, RenderTreeUpdater::updateElementRenderer does not manage well this transition. In particular, a null ptr deref happens for some special configuration involving a . To work around that issue, always force tearing down renderers when updating an element in the top layer. [1] https://fullscreen.spec.whatwg.org/#new-stacking-layer Test: fast/layers/top-layer-display-contents-crash.html * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): Always force tearing down renderers for top layer element. LayoutTests: Add regression test. * fast/css/top-layer-display-contents-crash-expected.txt: Added. * fast/css/top-layer-display-contents-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289060 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-03 Frédéric Wang null ptr deref in RenderTreeBuilder::Block::attachIgnoringContinuation https://bugs.webkit.org/show_bug.cgi?id=234170 Reviewed by Antti Koivisto. Add regression test. * fast/css/top-layer-display-contents-crash-expected.txt: Added. * fast/css/top-layer-display-contents-crash.html: Added. 2022-02-07 Russell Epstein Cherry-pick r289021. rdar://problem/88599774 CSP: Fix matching wildcard hosts https://bugs.webkit.org/show_bug.cgi?id=235992 Reviewed by Kate Cheney. LayoutTests/imported/w3c: Update expectations. * web-platform-tests/content-security-policy/img-src/img-src-full-host-wildcard-blocked.sub-expected.txt: Source/WebCore: As per the spec wildcard hosts must include the leading '.' for matches: https://www.w3.org/TR/CSP3/#match-hosts. Test: http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html * page/csp/ContentSecurityPolicySource.cpp: (WebCore::ContentSecurityPolicySource::hostMatches const): LayoutTests: Rewrite test to expect CSP3 compliant behavior. * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed. * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added. * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289021 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-02 Patrick Griffis CSP: Fix matching wildcard hosts https://bugs.webkit.org/show_bug.cgi?id=235992 Reviewed by Kate Cheney. Rewrite test to expect CSP3 compliant behavior. * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed-expected.txt: Removed. * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked-expected.txt: Added. * http/tests/security/contentSecurityPolicy/image-full-host-wildcard-blocked.html: Renamed from LayoutTests/http/tests/security/contentSecurityPolicy/image-full-host-wildcard-allowed.html. 2022-02-07 Russell Epstein Cherry-pick r288949. rdar://problem/88226432 ServiceWorkerNavigationPreloader should only be used once https://bugs.webkit.org/show_bug.cgi?id=235882 Reviewed by Chris Dumez. Source/WebKit: In case service worker preload is being used and related service worker context crashes (or service worker context sends bad messages), We can end up in a bad state where we will ask the preload twice for the same response (once for good, and the next one as we go to didNotHandle case). To prevent this, we add checks in loadResponseFromPreloader and loadBodyFromPreloader. As part of this investigation, I found out that ServiceWorkerNavigationPreloader is not correctly handling the case of preload responses coming from cache. In particular, no body will be given since we return early in waitForBody in case the preload network load is null. Prevent this by making sure waitForBody calls the response completion handler if available, even if the preload network load is null. And update the response body callback before executing the response completion handler to make sure data received synchronously from the preload is given to the service worker fetch task. Test: http/wpt/service-workers/fetch-service-worker-preload-cache.https.html * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: * NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.cpp: LayoutTests: * http/wpt/service-workers/fetch-service-worker-preload-cache.https-expected.txt: Added. * http/wpt/service-workers/fetch-service-worker-preload-cache.https.html: Added. * http/wpt/service-workers/resources/fetch-service-worker-preload-script.py: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288949 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-02 Youenn Fablet ServiceWorkerNavigationPreloader should only be used once https://bugs.webkit.org/show_bug.cgi?id=235882 Reviewed by Chris Dumez. * http/wpt/service-workers/fetch-service-worker-preload-cache.https-expected.txt: Added. * http/wpt/service-workers/fetch-service-worker-preload-cache.https.html: Added. * http/wpt/service-workers/resources/fetch-service-worker-preload-script.py: 2022-02-07 Russell Epstein Cherry-pick r288881. rdar://problem/80246192 Animation from scale(0) has missing backing store https://bugs.webkit.org/show_bug.cgi?id=227733 Reviewed by Simon Fraser. Source/WebCore: Use the style recorded before we applied animations to this element the last time we resolved style for keyframes that don't set a value for the "transform" property. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const): LayoutTests: Add a new test which animates two squares, one on top of each other. The bottom square uses an animation that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus animating to scale(1) as well, and is white, matching the background color. The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0 value. This test assumes that both animations run at the same time and thus the white square will always cover the black square (which is smaller to ensure no issues at the edges) and yield a completely white page. * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added. * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288881 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-01 Antoine Quint Animation from scale(0) has missing backing store https://bugs.webkit.org/show_bug.cgi?id=227733 Reviewed by Simon Fraser. Add a new test which animates two squares, one on top of each other. The bottom square uses an animation that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus animating to scale(1) as well, and is white, matching the background color. The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0 value. This test assumes that both animations run at the same time and thus the white square will always cover the black square (which is smaller to ensure no issues at the edges) and yield a completely white page. * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added. * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288827. rdar://problem/87815745 Source/WebCore: Changed playbackRate and defaultPlaybackRate from unrestricted double to double. https://bugs.webkit.org/show_bug.cgi?id=235174 rdar://problem/87815745 Patch by Takeshi Sone on 2022-01-31 Reviewed by Eric Carlson. Test: media/video-playbackrate-undefined.html * html/HTMLMediaElement.idl: LayoutTests: Added a test to verify that setting undefined to video.playbackRate raises an exception. https://bugs.webkit.org/show_bug.cgi?id=235174 rdar://problem/87815745 Patch by Takeshi Sone on 2022-01-31 Reviewed by Eric Carlson. * media/video-playbackrate-undefined-expected.txt: Added. * media/video-playbackrate-undefined.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288827 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-31 Takeshi Sone Added a test to verify that setting undefined to video.playbackRate raises an exception. https://bugs.webkit.org/show_bug.cgi?id=235174 rdar://problem/87815745 Reviewed by Eric Carlson. * media/video-playbackrate-undefined-expected.txt: Added. * media/video-playbackrate-undefined.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288801. rdar://problem/88186663 (REGRESSION)[IFC][RTL] wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html https://bugs.webkit.org/show_bug.cgi?id=235823 Reviewed by Antti Koivisto. Source/WebCore: Reset the trailing whitespace bidi level before handing them over to visual reordering. see https://unicode.org/reports/tr9/#L1 "L1. On each line, reset the embedding level of the following characters to the paragraph embedding level: ... Any sequence of whitespace characters ... at the end of the line." It ensures that
AB C
and
AB
both have the trailing whitespace positioned _visually_ as trailing (and not leading) content. After the bidi paragraph processing "AB C" gets a uniform bidi level of 2, while "AB " is split into "AB" and " " with bidi levels of 2 and 1 respectively. In the latter case, the difference in bidi levels makes the runs flip visually at reordering. It makes the trailing whitespace "pushed" to the left side of the "AB" making it _visually_ trailing (the content renders as " AB"). However in case of "AB C" with the line breaking position after " ", we would end up with a single run of "AB " with the bidi level of 2. This run would render as "AB " turning the trailing whitespace into a _visually_ leading whitespace. In this patch we ensure that the trailing (non-collapsible) whitespace runs 1. are detached from their adjoining non-whitespace text runs and 2. they get their bidi levels reset Test: fast/text/rtl-pre-wrap-hanging-offset.html * layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp: (WebCore::Layout::InlineDisplayLineBuilder::build const): LayoutTests: * fast/text/rtl-pre-wrap-hanging-offset-expected.html: Added. * fast/text/rtl-pre-wrap-hanging-offset.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288801 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-30 Alan Bujtas (REGRESSION)[IFC][RTL] wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html https://bugs.webkit.org/show_bug.cgi?id=235823 Reviewed by Antti Koivisto. * fast/text/rtl-pre-wrap-hanging-offset-expected.html: Added. * fast/text/rtl-pre-wrap-hanging-offset.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288800. rdar://problem/88241513 [LFC][IFC] Do not break content at an inline box boundary https://bugs.webkit.org/show_bug.cgi?id=235868 Reviewed by Antti Koivisto. Source/WebCore: Handle nested inline boxes, when the breaking position is between at an inline box boundary. e.g.
this_content_overflow
while the breaking position is between the 3rd and the letter 't', we should not let the first line have all the content only, but instead find a more reasonable breaking position by looking at the previous runs. This patch expands "findTrailingRunIndex" to find multiple, subsequent (nested) inline boxes. Test: fast/inline/nested-inline-box-with-word-break.html * layout/formattingContexts/inline/InlineContentBreaker.cpp: (WebCore::Layout::findTrailingRunIndex): LayoutTests: * fast/inline/nested-inline-box-with-word-break-expected.html: Added. * fast/inline/nested-inline-box-with-word-break.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288800 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-30 Alan Bujtas [LFC][IFC] Do not break content at an inline box boundary https://bugs.webkit.org/show_bug.cgi?id=235868 Reviewed by Antti Koivisto. * fast/inline/nested-inline-box-with-word-break-expected.html: Added. * fast/inline/nested-inline-box-with-word-break.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288789. rdar://problem/88043325 Capturing WebGL canvas through peer connection shows the image flipped https://bugs.webkit.org/show_bug.cgi?id=235600 Patch by Kimmo Kinnunen on 2022-01-29 Reviewed by Dean Jackson. Source/WebCore: Mirror and rotate the WebGL image at the source since WebRTC does not support mirroring. Test: webrtc/canvas-to-peer-connection.html * platform/graphics/cocoa/GraphicsContextGLCocoa.h: * platform/graphics/cocoa/GraphicsContextGLCocoa.mm: (WebCore::GraphicsContextGLCocoa::paintCompositedResultsToMediaSample): * platform/graphics/cocoa/IOSurface.h: * platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::setOwnershipIdentity): * platform/graphics/cv/CVUtilities.h: * platform/graphics/cv/CVUtilities.mm: (WebCore::setOwnershipIdentityForCVPixelBuffer): LayoutTests: Test sending WebGL image through a peer connection to a local video and assert that the image is as drawn. * platform/glib/TestExpectations: * webrtc/canvas-to-peer-connection-expected.txt: Added. * webrtc/canvas-to-peer-connection.html: Added. * webrtc/routines.js: * webrtc/video-replace-track.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288789 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-29 Kimmo Kinnunen Capturing WebGL canvas through peer connection shows the image flipped https://bugs.webkit.org/show_bug.cgi?id=235600 Reviewed by Dean Jackson. Test sending WebGL image through a peer connection to a local video and assert that the image is as drawn. * platform/glib/TestExpectations: * webrtc/canvas-to-peer-connection-expected.txt: Added. * webrtc/canvas-to-peer-connection.html: Added. * webrtc/routines.js: * webrtc/video-replace-track.html: 2022-02-07 Russell Epstein Cherry-pick r288783. rdar://problem/88052073 REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath https://bugs.webkit.org/show_bug.cgi?id=235755 Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/css/css-fonts/synthetic-bold-space-width-expected.html: Added. * web-platform-tests/css/css-fonts/synthetic-bold-space-width.html: Added. Source/WebCore: r281687 made Font::widthForGlyph() return the non-synthetically-expanded width, instead of the synthetically-expanded width. I think this is philosophically correct, because Font::widthForGlyph() is called before shaping, and shaping requires the original width. If some custom code is asking for the width of specific characters without going through WidthIterator or ComplexTextController, that code needs to determine whether or not it's going to run shaping, and thus when it should be adding in the synthetic offset. adjustGlyphsAndAdvances() used to subtract out the synthetic offset because it was expecting Font::widthForGlyph() to return the already-expanded width. So, the solution is just stop subtracting the offset, because it hasn't been applied in the first place. Test: imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width.html * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): * platform/graphics/Font.h: LayoutTests: * platform/mac/fast/text/atsui-multiple-renderers-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288783 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-28 Myles C. Maxfield REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath https://bugs.webkit.org/show_bug.cgi?id=235755 Reviewed by Simon Fraser. * platform/mac/fast/text/atsui-multiple-renderers-expected.txt: 2022-02-07 Russell Epstein Cherry-pick r288631. rdar://problem/88020080 Unreviewed, revert r286855 as it caused form submission issues https://bugs.webkit.org/show_bug.cgi?id=235645 LayoutTests/imported/w3c: * web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt: * web-platform-tests/html/semantics/forms/the-input-element/radio-expected.txt: Source/WebCore: * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setChecked): (WebCore::HTMLInputElement::didChangeForm): (WebCore::HTMLInputElement::insertedIntoAncestor): (WebCore::HTMLInputElement::removedFromAncestor): (WebCore::HTMLInputElement::checkedRadioButtonForGroup const): * html/InputType.h: (WebCore::InputType::willUpdateCheckedness): Deleted. * html/RadioInputType.cpp: (WebCore::RadioInputType::valueMissing const): (WebCore::RadioInputType::willUpdateCheckedness): Deleted. * html/RadioInputType.h: LayoutTests: * fast/forms/radio/ValidityState-valueMissing-radio-expected.txt: * fast/forms/radio/ValidityState-valueMissing-radio.html: * fast/forms/radio/radio-live-validation-style-expected.txt: * fast/forms/radio/radio-live-validation-style.html: * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288631 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-26 Chris Dumez Unreviewed, revert r286855 as it caused form submission issues https://bugs.webkit.org/show_bug.cgi?id=235645 * fast/forms/radio/ValidityState-valueMissing-radio-expected.txt: * fast/forms/radio/ValidityState-valueMissing-radio.html: * fast/forms/radio/radio-live-validation-style-expected.txt: * fast/forms/radio/radio-live-validation-style.html: * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valueMissing-expected.txt: 2022-02-07 Russell Epstein Cherry-pick r288590. rdar://problem/87984277 Disable input-security CSS property https://bugs.webkit.org/show_bug.cgi?id=235557 rdar://87984277 Reviewed by Dean Jackson. Source/WebCore: CSSWG is planning to remove input-security from CSS UI 4 (https://github.com/w3c/csswg-drafts/issues/6788). Keep the property around as an experimental feature, so that it can be used in the UA stylesheet, and easily turned on if the resolution is not finalized. * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSProperties.json: * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): Enable input-security when parsing the UA stylesheet, as it is used to obscure text in password inputs. (WebCore::operator==): (WebCore::add): (WebCore::CSSParserContext::isPropertyRuntimeDisabled const): * css/parser/CSSParserContext.h: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): Source/WebKitLegacy/win: Add support for tests enabling the CSSInputSecurityEnabled preference. * WebPreferences.cpp: (WebPreferences::cssInputSecurityEnabled): * WebPreferences.h: * WebView.cpp: (WebView::notifyPreferencesChanged): Source/WTF: * Scripts/Preferences/WebPreferencesExperimental.yaml: Make input-security a disabled-by-default experimental feature. Tools: * DumpRenderTree/TestOptions.cpp: (WTR::TestOptions::defaults): Add default for WebKitLegacy on Windows. LayoutTests: * fast/css/computed-text-security-for-input-security.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288590 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-25 Aditya Keerthi Disable input-security CSS property https://bugs.webkit.org/show_bug.cgi?id=235557 rdar://87984277 Reviewed by Dean Jackson. * fast/css/computed-text-security-for-input-security.html: 2022-02-07 Russell Epstein Cherry-pick r288547. rdar://problem/87824766 (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present https://bugs.webkit.org/show_bug.cgi?id=235547 Reviewed by Antti Koivisto. Source/WebCore: The float box coordinates are always visual. They need to be converted to logical to be able to properly constrain the available space on the current line. Test: fast/inline/intrusive-float-with-rtl-content.html * layout/formattingContexts/inline/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::floatConstraints const): LayoutTests: * fast/inline/intrusive-float-with-rtl-content-expected.html: Added. * fast/inline/intrusive-float-with-rtl-content.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288547 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-25 Alan Bujtas (REGRESSION r287485) [LFC][IFC] Incorrect RTL content position when intrusive float is present https://bugs.webkit.org/show_bug.cgi?id=235547 Reviewed by Antti Koivisto. * fast/inline/intrusive-float-with-rtl-content-expected.html: Added. * fast/inline/intrusive-float-with-rtl-content.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288543. rdar://problem/84958961 REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView) https://bugs.webkit.org/show_bug.cgi?id=235449 Reviewed by Darin Adler. Source/WebCore/PAL: * pal/spi/cf/CoreTextSPI.h: Source/WebKit: The reason for this bug was I was misusing kCTFontOptionsSystemUIFont. I thought this flag just meant "allow the creation of system fonts" but it turns out it means something more subtle than that. Instead of unconditionally specifying this flag, we should just pull out the options field from the source font (which will include that flag if the font was a system font) and use that instead. Test: fast/text/user-installed-canvas.html * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder>::encodePlatformData): (IPC::createCTFont): (IPC::ArgumentCoder>::decodePlatformData): LayoutTests: * fast/text/user-installed-canvas-expected.html: Added. * fast/text/user-installed-canvas.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288543 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-24 Myles C. Maxfield REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView) https://bugs.webkit.org/show_bug.cgi?id=235449 Reviewed by Darin Adler. * fast/text/user-installed-canvas-expected.html: Added. * fast/text/user-installed-canvas.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288466. rdar://problem/82554226 REGRESSION (iOS 15): HTMLAudioElement fails to load new audio when device is locked or safari is in background https://bugs.webkit.org/show_bug.cgi?id=229688 Reviewed by Jer Noble. Source/WebCore: An iOS application loses its NowPlaying status as soon as the AudioSession category is set to Ambient, and it can only get it back again by changing the category to Playback *and* starting playback. When an application is in the background, however, it can't start playback unless it *already* has NowPlaying status. So, ipso facto, background playback will always fail once the category is set to Ambient. If an AudioSession's category is set to Playback when it is activated, it will interrupt another application playing audio, activate Bluetooth routes, etc. This means WebKit has to relinquish Playback when a page is unable to produce audio because AVFoundation automatically activates the audio session when playback starts - even if the AVPlayer is muted or has no audio. To allow pages that were playing audio when WebKit went into the background to continue to play after switching urls or activating another media element, add a grace period when switch from Playback to Ambient. Test: media/audio-session-category.html * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::updateSessionState): Source/WebKit: * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::category const): Return the most recently set category on all platforms so it is possible to test. LayoutTests: * fast/mediasession/metadata/audio-track-enabled.html: Wait longer for the audio session category to be reset. * media/audio-session-category-expected.txt: Added. * media/audio-session-category.html: Added. * platform/gtk/TestExpectations: Skip new test. * platform/mac-wk1/TestExpectations: Skip new test, MediaStream isn't supported on WK1. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288466 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-24 Eric Carlson REGRESSION (iOS 15): HTMLAudioElement fails to load new audio when device is locked or safari is in background https://bugs.webkit.org/show_bug.cgi?id=229688 Reviewed by Jer Noble. * fast/mediasession/metadata/audio-track-enabled.html: Wait longer for the audio session category to be reset. * media/audio-session-category-expected.txt: Added. * media/audio-session-category.html: Added. * platform/gtk/TestExpectations: Skip new test. * platform/mac-wk1/TestExpectations: Skip new test, MediaStream isn't supported on WK1. 2022-02-07 Russell Epstein Cherry-pick r288362. rdar://problem/87832940 WPT version of css/css-cascade/parsing/layer-import-parsing.html crashes with nullptr https://bugs.webkit.org/show_bug.cgi?id=235434 rdar://87832940 Reviewed by Alan Bujtas. LayoutTests/imported/w3c: * web-platform-tests/css/css-cascade/parsing/layer-import-parsing.html: Update to WPT version. Source/WebCore: Test: fast/css/insert-import-rule-crash.html * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::setCSSStyleSheet): Null check the parent stylesheet. It can be null if the rule has been removed. * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet): Also fix a debug assert in addPendingSheet, this can get called multiple times. LayoutTests: * fast/css/insert-import-rule-crash-expected.txt: Added. * fast/css/insert-import-rule-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288362 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-21 Antti Koivisto WPT version of css/css-cascade/parsing/layer-import-parsing.html crashes with nullptr https://bugs.webkit.org/show_bug.cgi?id=235434 rdar://87832940 Reviewed by Alan Bujtas. * fast/css/insert-import-rule-crash-expected.txt: Added. * fast/css/insert-import-rule-crash.html: Added. 2022-02-07 Russell Epstein Cherry-pick r288178. rdar://problem/79296770 REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus https://bugs.webkit.org/show_bug.cgi?id=235331 rdar://79296770 Reviewed by Tim Horton. Source/WebKit: After r264352 added the call to `_page->scheduleFullEditorStateUpdate();` during element focus, scrolling to reveal the selection in the focused body field in Mail stopped working. This is because Mail: 1. Sets `firstResponderKeyboardAvoidanceEnabled` to NO on the WKScrollView, which prevents automatic inset adjustment logic in UIKit from taking effect and adding the keyboard height to the bottom system content inset. 2. Manually sets `-contentScrollInset` on the WKScrollView during a UIKeyboardDidShowNotification, which occurs after we've already attempted to zoom to the selection. ...combined with the fact that without the call to `scheduleFullEditorStateUpdate()`, the next EditorState would've arrived only after the keyboard animation finished. The end result is that we don't end up avoiding the keyboard at all when focusing the body field in Mail compose. While rdar://87733414 tracks refactoring logic in WebKit2 Mail compose to ensure that the content scroll insets on WKScrollView are applied during UIKeyboardWillShowNotification instead of after the keyboard has finished animating in, this patch provides a short-term workaround by restoring pre-r264352 behavior, with respect to when the element is scrolled into view. Test: editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html * Platform/spi/ios/UIKitSPI.h: Add a declaration for the `-firstResponderKeyboardAvoidanceEnabled` SPI property on non-internal iOS SDKs. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _keyboardDidShow:]): Plumb this through to the WKContentView, so we can zoom/scroll to the focused element if needed. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _keyboardDidShow]): If we previously deferred the call to `-_zoomToRevealFocusedElement` due to the keyboard still animating in, schedule a call to it now on a 0-delay timer; this delay is necessary to ensure that this zoom occurs *after* Mail has already set the content inset, which also happens underneath a "KeyboardDidShow" notification. (-[WKContentView _zoomToRevealFocusedElement]): In the case where the (presumably internal) client has set `firstResponderKeyboardAvoidanceEnabled` to NO and the keyboard is animating in, defer the actual call into the web view to `-_zoomToRevealFocusedElement` until after the keyboard animation is finished. This ensures compatibility with existant logic in Mail for manually setting the content scroll inset on the WKScrollView after the keyboard animation is complete. (-[WKContentView resetShouldZoomToFocusRectAfterShowingKeyboard]): (-[WKContentView _elementDidBlur]): Tools: Add support for a UIScriptController hook to override `firstResponderKeyboardAvoidanceEnabled` on WKScrollView. See LayoutTests for more details. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::setScrollViewKeyboardAvoidanceEnabled): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::TestController::platformResetStateToConsistentValues): * WebKitTestRunner/ios/UIScriptControllerIOS.h: * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptControllerIOS::setScrollViewKeyboardAvoidanceEnabled): LayoutTests: Add a layout test that (at least) exercises the newly added codepath, where focusing an editor when the scroll view has `firstResponderKeyboardAvoidanceEnabled` set to NO will still allow us to scroll to the selection. * editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt: Added. * editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html: Added. * resources/ui-helper.js: (window.UIHelper.setScrollViewKeyboardAvoidanceEnabled): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288178 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-18 Wenson Hsieh REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus https://bugs.webkit.org/show_bug.cgi?id=235331 rdar://79296770 Reviewed by Tim Horton. Add a layout test that (at least) exercises the newly added codepath, where focusing an editor when the scroll view has `firstResponderKeyboardAvoidanceEnabled` set to NO will still allow us to scroll to the selection. * editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt: Added. * editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html: Added. * resources/ui-helper.js: (window.UIHelper.setScrollViewKeyboardAvoidanceEnabled): 2022-02-07 Russell Epstein Cherry-pick r288132. rdar://problem/87569029 CSP: Improve handling of multiple policies https://bugs.webkit.org/show_bug.cgi?id=235199 Reviewed by Kate Cheney. LayoutTests/imported/w3c: Add new test expectations with more passes. * web-platform-tests/content-security-policy/script-src/script-src-multiple-policies-one-using-hashing-algorithms-expected.txt: * web-platform-tests/content-security-policy/script-src/script-src-strict_dynamic_parser_inserted-expected.txt: * web-platform-tests/content-security-policy/style-src/style-src-error-event-fires-expected.txt: * web-platform-tests/content-security-policy/style-src/style-src-inline-style-nonce-blocked-error-event-expected.txt: * web-platform-tests/content-security-policy/style-src/style-src-multiple-policies-multiple-hashing-algorithms-expected.txt: Added. Source/WebCore: This fixes many issues with multiple CSP policies. To quote the spec for script-src: > Their behavior will be blocked unless every policy allows inline script, either implicitly by not specifying a script-src (or default-src) directive, or explicitly, by specifying "unsafe-inline", a nonce-source or a hash-source that matches the inline block. The previous structure was many distinct calls to check if there was a nonce in any policy, then if there was a hash in any policy, etc, rather than actually checking the policies as a whole to know if they allow or block a behavior. This lead to various issues where polices were not properly respected and where reports were inaccurate. The allScriptPoliciesAllow() function did try to consider all policies but was not very flexible and had buggy behavior like for each policy it would call findHashOfContentInPolicies() meaning hashes from other policies incorrectly applied to the current policy, plus general inefficiency of hashing the same content many times over. The new behavior relies more on passing all required information in a single function call to verify all policies in a single pass. * bindings/js/CachedScriptFetcher.cpp: (WebCore::CachedScriptFetcher::requestScriptWithCache const): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): (WebCore::ScriptElement::executeClassicScript): * dom/StyledElement.cpp: (WebCore::StyledElement::styleAttributeChanged): * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy): * loader/ResourceLoaderOptions.h: * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const): * page/csp/ContentSecurityPolicy.cpp: (WebCore::parseSubResourceIntegrityIntoDigests): (WebCore::generateHashesForContent): (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const): (WebCore::ContentSecurityPolicy::allowInlineEventHandlers const): (WebCore::ContentSecurityPolicy::allowNonParserInsertedScripts const): (WebCore::ContentSecurityPolicy::allowInlineScript const): (WebCore::ContentSecurityPolicy::allowInlineStyle const): (WebCore::ContentSecurityPolicy::allowScriptFromSource const): (WebCore::ContentSecurityPolicy::allowStyleFromSource const): (WebCore::ContentSecurityPolicy::allScriptPoliciesAllow const): Deleted. (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies const): Deleted. (WebCore::ContentSecurityPolicy::checkHashAndReportViolation const): Deleted. * page/csp/ContentSecurityPolicy.h: * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineScriptElement const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForInlineJavascriptURL const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForInlineEventHandlers const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForNonParserInsertedScripts const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineStyleElement const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineStyleAttribute const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScript const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyle const): (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeHashScript const): Deleted. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeHashStyle const): Deleted. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForParserInsertedScript const): Deleted. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineScriptAttribute const): Deleted. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScriptHash const): Deleted. (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyleHash const): Deleted. * page/csp/ContentSecurityPolicyDirectiveList.h: LayoutTests: Update test expectations, Some newly passing tests are no longer skipped and some have new reports. * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scripthash-in-enforced-policy-and-not-in-report-only-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scripthash-multiple-policies-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-enforced-policy-and-blocked-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-enforced-policy-and-blocked-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-enforced-policy-and-allowed-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-enforced-policy-and-allowed-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-multiple-policies-expected.txt: * http/tests/security/contentSecurityPolicy/inline-script-blocked-javascript-url-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-by-default-src-star-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/window-open-javascript-url-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/window-open-javascript-url-with-target-blocked-expected.txt: * platform/glib/TestExpectations: * platform/wk2/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-in-iframe-report-only-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288132 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-18 Patrick Griffis CSP: Improve handling of multiple policies https://bugs.webkit.org/show_bug.cgi?id=235199 Reviewed by Kate Cheney. Update test expectations, Some newly passing tests are no longer skipped and some have new reports. * TestExpectations: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scripthash-in-enforced-policy-and-not-in-report-only-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scripthash-multiple-policies-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-enforced-policy-and-blocked-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-enforced-policy-and-blocked-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-allowed-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-enforced-policy-and-allowed-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-enforced-policy-and-allowed-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-blocked-by-legacy-enforced-policy-and-blocked-by-report-policy2-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt: * http/tests/security/contentSecurityPolicy/1.1/scriptnonce-multiple-policies-expected.txt: * http/tests/security/contentSecurityPolicy/inline-script-blocked-javascript-url-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-by-default-src-star-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/window-open-javascript-url-blocked-expected.txt: * http/tests/security/contentSecurityPolicy/window-open-javascript-url-with-target-blocked-expected.txt: * platform/glib/TestExpectations: * platform/wk2/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-css-in-iframe-report-only-expected.txt: 2022-02-07 Russell Epstein Cherry-pick r288031. rdar://problem/82997136 [Cocoa] rVFC() isn't called for initial video load https://bugs.webkit.org/show_bug.cgi?id=235006 Reviewed by Eric Carlson. Source/WebCore: Tests: media/request-video-frame-loadstart.html media/request-video-frame-seek.html Add a new utility class, QueuedVideoOutput, which will pull pixel buffers out of an AVPlayerItemVideoOutput pre-emptively. Once those pixel buffers are enqueued locally, their associated timing information can be used to fire a callback for that buffer's display time. Previously, paints were blocked from pulling new pixel buffers from the video output. With the QueuedVideoOutput class, this is no longer necessary. The QueuedVideoOutput will notify its client when the image for currentTime changes, and other clients can freely ask for the currentTime's image. To curb runaway memory growth, frames are purged as soon as a new image for the current time is available, and when the video output signals that its own queues were purged. * WebCore.xcodeproj/project.pbxproj: * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::cancelVideoFrameCallback): (WebCore::HTMLVideoElement::serviceRequestVideoFrameCallbacks): * html/HTMLVideoElement.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC): (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage): (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::startVideoFrameMetadataGathering): (WebCore::MediaPlayerPrivateAVFoundationObjC::checkNewVideoFrameMetadata): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput): (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer): (WebCore::MediaPlayerPrivateAVFoundationObjC::videoOutputHasAvailableFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): (WebCore::MediaPlayerPrivateAVFoundationObjC::pixelBufferForCurrentTime): (WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime): (WebCore::MediaPlayerPrivateAVFoundationObjC::colorSpace): (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange): (WebCore::globalPullDelegateQueue): Deleted. (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange): Deleted. (-[WebCoreAVFPullDelegate initWithPlayer:]): Deleted. (-[WebCoreAVFPullDelegate outputMediaDataWillChange:]): Deleted. (-[WebCoreAVFPullDelegate outputSequenceWasFlushed:]): Deleted. * platform/graphics/avfoundation/objc/QueuedVideoOutput.h: Added. * platform/graphics/avfoundation/objc/QueuedVideoOutput.mm: Added. (-[WebQueuedVideoOutputDelegate initWithParent:]): (-[WebQueuedVideoOutputDelegate outputMediaDataWillChange:]): (-[WebQueuedVideoOutputDelegate outputSequenceWasFlushed:]): (-[WebQueuedVideoOutputDelegate observeValueForKeyPath:ofObject:change:context:]): (WebCore::globalOutputDelegateQueue): (WebCore::QueuedVideoOutput::create): (WebCore::QueuedVideoOutput::QueuedVideoOutput): (WebCore::QueuedVideoOutput::~QueuedVideoOutput): (WebCore::QueuedVideoOutput::invalidate): (WebCore::decltype): (WebCore::QueuedVideoOutput::hasImageForTime const): (WebCore::QueuedVideoOutput::takeVideoFrameEntryForTime): (WebCore::QueuedVideoOutput::addCurrentImageChangedObserver): (WebCore::QueuedVideoOutput::configureNextImageObserver): (WebCore::QueuedVideoOutput::imageForCurrentTimeChanged): (WebCore::QueuedVideoOutput::addVideoFrameEntries): (WebCore::QueuedVideoOutput::purgeVideoFrameEntries): (WebCore::QueuedVideoOutput::purgeImagesBeforeTime): (WebCore::QueuedVideoOutput::rateChanged): Source/WebCore/PAL: * pal/spi/cocoa/AVFoundationSPI.h: LayoutTests: * media/request-video-frame-loadstart-expected.txt: Added. * media/request-video-frame-loadstart.html: Added. * media/request-video-frame-seek-expected.txt: Added. * media/request-video-frame-seek.html: Added. * platform/ios-wk2/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288031 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-01-14 Jer Noble [Cocoa] rVFC() isn't called for initial video load https://bugs.webkit.org/show_bug.cgi?id=235006 Reviewed by Eric Carlson. * media/request-video-frame-loadstart-expected.txt: Added. * media/request-video-frame-loadstart.html: Added. * media/request-video-frame-seek-expected.txt: Added. * media/request-video-frame-seek.html: Added. * platform/ios-wk2/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/mac-wk2/TestExpectations: 2022-02-07 Russell Epstein Cherry-pick r288003. rdar://problem/85505101 Only apply automatic minimum block-size aspect-ratio rules to non-replaced elements https://bugs.webkit.org/show_bug.cgi?id=235058 Reviewed by Alan Bujtas. Source/WebCore: The rules in https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum that define the automatic minimum size of an element subject to an aspect-ratio only apply if the element is non-replaced. In constrainLogicalHeightByMinMax specifically, when min-height is auto, after applying the aspect-ratio to produce an automatic minimum height, we bump it up to the content height if the element has children. This, presumably, is to account for the way the height of a block is computed in CSS 2.2. (As CSS 2.2 doesn't have an auto value for min-height, and a CSS Block Layout module has not been written in terms of CSS Sizing concepts, there is no clear definition of automatic minimum sizing for blocks at the moment.) If we erroneously apply this to a replaced element, such as an image or video, it can get a computed min-height equal to the intrinsic height of the image, which may be much larger than expected. This commit adds an is() check for both automatic minimum logical width and height calculations, although I was unable to produce a test to exercise the logical width case (which does not take the intrinsic size into account when computing the automatic minimum). Test: fast/css/aspect-ratio-min-height-replaced.html * rendering/RenderBox.cpp: (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const): (WebCore::RenderBox::constrainLogicalHeightByMinMax const): LayoutTests: Test that replaced elements with child content (in this case, a