[webkit-changes] [WebKit/WebKit] a2331c: Cherry-pick 99c9a20cadf6. rdar://problem/108417115

MyahCobbs noreply at github.com
Tue May 16 11:25:29 PDT 2023


  Branch: refs/heads/safari-7616.1.14-branch
  Home:   https://github.com/WebKit/WebKit
  Commit: a2331ce0a56b90898c33a1962087d0afa96a505a
      https://github.com/WebKit/WebKit/commit/a2331ce0a56b90898c33a1962087d0afa96a505a
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    M Source/WebKit/Scripts/update-info-plist-for-runningboard.sh

  Log Message:
  -----------
  Cherry-pick 99c9a20cadf6. rdar://problem/108417115

    Regression(262025 at main) WebProcesses on macOS 13.0 are still marked as managed by RunningBoard
    https://bugs.webkit.org/show_bug.cgi?id=256489
    rdar://108417115

    Reviewed by Geoffrey Garen and Ben Nham.

    WebProcesses on macOS 13.0 are still marked as managed by RunningBoard even
    though 262025 at main made it so that we only use RunningBoard assertions on macOS
    13.3+.

    USE(RUNNINGBOARD) requires `__MAC_OS_X_VERSION_MIN_REQUIRED >= 130300` after
    262025 at main but update-info-plist-for-runningboard.sh was still checking for
    130000. This meant RunningBoard was managing process priority on macOS 13.0+
    even though we are only taking RunningBoard assertion on macOS 13.3+. This
    was causing our processes to have low priority.

    * Source/WebKit/Scripts/update-info-plist-for-runningboard.sh:

    Canonical link: https://commits.webkit.org/263830@main

Identifier: 263769.1 at safari-7616.1.14-branch


  Commit: ac3a1cdf34b1501a7f8a3e0d8ef4322aa0e3f170
      https://github.com/WebKit/WebKit/commit/ac3a1cdf34b1501a7f8a3e0d8ef4322aa0e3f170
  Author: Commit Queue <commit-queue at webkit.org>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    M Source/WebCore/Modules/mediasession/MediaSession.cpp
    M Source/WebCore/Modules/mediasession/MediaSession.h
    M Source/WebCore/Modules/mediasession/MediaSession.idl
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    R Source/WebCore/bindings/js/JSMediaSessionCustom.cpp

  Log Message:
  -----------
  Cherry-pick dfd1f46364b9. rdar://problem/109059889

    Unreviewed, reverting r263715 at main.
    https://bugs.webkit.org/show_bug.cgi?id=256488

    causes crashes

    Reverted changeset:

    "MediaSession should keep its action handlers alive"
    https://bugs.webkit.org/show_bug.cgi?id=256334
    https://commits.webkit.org/263715@main

    Canonical link: https://commits.webkit.org/263826@main

Identifier: 263769.2 at safari-7616.1.14-branch


  Commit: 0cbfef833ca9f39822326ab2849f1b0288d1496b
      https://github.com/WebKit/WebKit/commit/0cbfef833ca9f39822326ab2849f1b0288d1496b
  Author: Commit Queue <commit-queue at webkit.org>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    R LayoutTests/media/media-session/actionHandler-no-document-leak-expected.txt
    R LayoutTests/media/media-session/actionHandler-no-document-leak.html
    R LayoutTests/media/media-session/resources/media-session-action-handler-document-leak-frame.html
    M Source/WebCore/Modules/mediasession/MediaSessionActionHandler.h
    M Source/WebCore/Modules/mediasession/MediaSessionActionHandler.idl

  Log Message:
  -----------
  Cherry-pick 3409130b94be. rdar://problem/109060195

    Unreviewed, reverting r263660 at main.
    https://bugs.webkit.org/show_bug.cgi?id=256490

    causes crashes

    Reverted changeset:

    "The Document object is leaked on some pages using media (like YouTube.com)"
    https://bugs.webkit.org/show_bug.cgi?id=251835
    https://commits.webkit.org/263660@main

    Canonical link: https://commits.webkit.org/263827@main

Identifier: 263769.3 at safari-7616.1.14-branch


  Commit: d1cfdd08a8989e561ab21bb6d596ce9781fd90a7
      https://github.com/WebKit/WebKit/commit/d1cfdd08a8989e561ab21bb6d596ce9781fd90a7
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/JSONObject.cpp

  Log Message:
  -----------
  Cherry-pick 970f62aaf87c. rdar://problem/109053647

    Unreviewed, use previous length checking in JSON.stringify
    https://bugs.webkit.org/show_bug.cgi?id=256494
    rdar://109053647

    FastStringifier is not using m_buffer entirely. So it is separately tracking m_capacity right now.
    This design looks very strange, but let's stick with it.

    * Source/JavaScriptCore/runtime/JSONObject.cpp:
    (JSC::FastStringifier::append):

    Canonical link: https://commits.webkit.org/263834@main

Identifier: 263769.4 at safari-7616.1.14-branch


  Commit: 993a1cd06a8b55a1ec735de9b25bc38f823f5c4b
      https://github.com/WebKit/WebKit/commit/993a1cd06a8b55a1ec735de9b25bc38f823f5c4b
  Author: Myah Cobbs <mcobbs at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M Configurations/Version.xcconfig

  Log Message:
  -----------
  Versioning.

Identifier: 263769.5 at safari-7616.1.14-branch


  Commit: 24e011ba1bdc3cab0772c35a4bc762a31f8cec6c
      https://github.com/WebKit/WebKit/commit/24e011ba1bdc3cab0772c35a4bc762a31f8cec6c
  Author: Ryan Reno <rreno at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    A LayoutTests/fast/canvas/canvas-gradient-can-outlive-context-expected.txt
    A LayoutTests/fast/canvas/canvas-gradient-can-outlive-context.html
    A LayoutTests/fast/canvas/canvas-state-stack-gradient-expected.txt
    A LayoutTests/fast/canvas/canvas-state-stack-gradient.html
    A LayoutTests/http/tests/canvas/ctx.2d-canvas-style-no-document-leak-expected.txt
    A LayoutTests/http/tests/canvas/ctx.2d-canvas-style-no-document-leak.html
    A LayoutTests/http/tests/canvas/resources/background.png
    A LayoutTests/http/tests/canvas/resources/ctx.2d-fillStyle-color.html
    A LayoutTests/http/tests/canvas/resources/ctx.2d-fillStyle-gradient.html
    A LayoutTests/http/tests/canvas/resources/ctx.2d-fillStyle-pattern.html
    M Source/WebCore/html/canvas/CanvasGradient.cpp
    M Source/WebCore/html/canvas/CanvasGradient.h
    M Source/WebCore/html/canvas/CanvasStyle.cpp
    M Source/WebCore/html/canvas/CanvasStyle.h

  Log Message:
  -----------
  Cherry-pick ade36a336115. rdar://problem/108845985

    HTMLCanvasElement is orphaned causing a HTMLDocument leak on YouTube video pages
    https://bugs.webkit.org/show_bug.cgi?id=256262
    rdar://108845985

    Reviewed by Darin Adler.

    CanvasRenderingContext2DBase has a State stack for setting up drawing
    state. Two of the fields - strokeStyle and fillStyle - each hold CanvasStyle
    objects. These objects may be set with colors or images or gradients. In
    the case of a CanvasGradient, the gradient has a strong reference
    to the context which creates a reference cycle.

    CanvasRenderingContext2DBase -> State -> CanvasStyle -> CanvasGradient -> CanvasRenderingContext(2DBase)

    What makes this cycle dangerous is the CanvasRenderingContext will
    increase the ref count of an HTMLCanvasElement which, being a Node, will
    increment the referencingNodeCount of a Document object. So if a
    gradient is set on the context's fillStyle or strokeStyle we can cause a
    Document leak if the state is never cleared like on YouTube video pages.

    This patch changes the CanvasGradient object to hold a weak reference to
    the CanvasRenderingContext instead of a strong reference which breaks the cycle.

    * LayoutTests/fast/canvas
        Add tests to verify the now-decoupled lifetimes of gradient and
        context do not cause crashes.
    * LayoutTests/fast/canvas/canvas-gradient-can-outlive-context-expected.txt: Added.
    * LayoutTests/fast/canvas/canvas-gradient-can-outlive-context.html: Added.
    * LayoutTests/fast/canvas/canvas-state-stack-gradient-expected.txt: Added.
    * LayoutTests/fast/canvas/canvas-state-stack-gradient.html: Added.

    * LayoutTests/http/tests/canvas
        Add a test to verify that setting the style of a 2D canvas context
        does not leak Documents.
    * LayoutTests/http/tests/canvas/ctx.2d-canvas-style-no-document-leak-expected.txt: Added.
    * LayoutTests/http/tests/canvas/ctx.2d-canvas-style-no-document-leak.html: Added.
    * LayoutTests/http/tests/canvas/resources/background.png: Added.
    * LayoutTests/http/tests/canvas/resources/ctx.2d-fillStyle-color.html: Added.
    * LayoutTests/http/tests/canvas/resources/ctx.2d-fillStyle-gradient.html: Added.
    * LayoutTests/http/tests/canvas/resources/ctx.2d-fillStyle-pattern.html: Added.

    * Source/WebCore/html/canvas/CanvasGradient.cpp:
    (WebCore::CanvasGradient::addColorStop):
    * Source/WebCore/html/canvas/CanvasGradient.h:
    * Source/WebCore/html/canvas/CanvasStyle.cpp:
    (WebCore::parseColor):
        Since the gradient can outlive the context that created it, we need
        to be able to parse colors without having a CSSParserContext
        reference. This overload calls CSSParser::parseColorWithoutContext
        in that case.
    * Source/WebCore/html/canvas/CanvasStyle.h:
    (WebCore::CanvasStyle::canvasGradient const):

    Canonical link: https://commits.webkit.org/263774@main

Identifier: 263769.6 at safari-7616.1.14-branch


  Commit: fe912bca4cb4afbceea067b1a3bffb11022bae9d
      https://github.com/WebKit/WebKit/commit/fe912bca4cb4afbceea067b1a3bffb11022bae9d
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/platform/gtk/TestExpectations
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WebCore/platform/graphics/coretext/FontCustomPlatformDataCoreText.cpp

  Log Message:
  -----------
  Cherry-pick 26583bfadc4b. rdar://problem/108447198

    Fix variable-opsz-size-adjust.html (optical size) test fails (255862)
    https://bugs.webkit.org/show_bug.cgi?id=255862
    rdar://108447198

    Reviewed by Myles C. Maxfield.

    UnrealizedFont was getting size before size-adjust adjustment and for that
    reason size-adjust was not affecting the optical-size.

    * LayoutTests/TestExpectations:
    - Bug fixed for CoreText.

    * LayoutTests/platform/gtk/TestExpectations:
    * LayoutTests/platform/wpe/TestExpectations:
    - It still fails for FreeType, so I'm creating a separated bug.

    * Source/WebCore/platform/graphics/coretext/FontCustomPlatformDataCoreText.cpp:
    (WebCore::FontCustomPlatformData::fontPlatformData):

    Canonical link: https://commits.webkit.org/263795@main

Identifier: 263769.7 at safari-7616.1.14-branch


  Commit: 02bbd56b0ddcd27995fb27e892c95cc42d2ccc2b
      https://github.com/WebKit/WebKit/commit/02bbd56b0ddcd27995fb27e892c95cc42d2ccc2b
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M Source/WebCore/css/CSSGroupingRule.cpp
    M Source/WebCore/css/CSSStyleSheet.cpp
    M Source/WebCore/css/StyleSheetContents.cpp
    M Source/WebCore/css/StyleSheetContents.h
    M Source/WebCore/css/parser/CSSParserImpl.cpp

  Log Message:
  -----------
  Cherry-pick 1ffbfef4c616. rdar://problem/109051188

    Disallow caching of StyleSheetContents that uses nesting
    https://bugs.webkit.org/show_bug.cgi?id=256449
    rdar://108758349

    Reviewed by Alan Baradlay.

    Mutations to cached document may affect other stylesheets.

    * Source/WebCore/css/CSSGroupingRule.cpp:
    (WebCore::CSSGroupingRule::prepareChildStyleRuleForNesting):
    * Source/WebCore/css/CSSStyleSheet.cpp:
    (WebCore::CSSStyleSheet::prepareChildStyleRuleForNesting):
    * Source/WebCore/css/StyleSheetContents.cpp:
    (WebCore::StyleSheetContents::isCacheable const):
    * Source/WebCore/css/StyleSheetContents.h:
    * Source/WebCore/css/parser/CSSParserImpl.cpp:
    (WebCore::CSSParserImpl::consumeRegularRuleList):
    (WebCore::CSSParserImpl::consumeStyleRule):

    Canonical link: https://commits.webkit.org/263799@main

Identifier: 263769.8 at safari-7616.1.14-branch


  Commit: 986864cd8fa107d2b526305e128a2f6e8848664e
      https://github.com/WebKit/WebKit/commit/986864cd8fa107d2b526305e128a2f6e8848664e
  Author: Ryan Reno <rreno at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    A LayoutTests/media/media-session/actionHandler-lifetime-expected.txt
    A LayoutTests/media/media-session/actionHandler-lifetime.html
    A LayoutTests/media/media-session/actionHandler-no-document-leak-expected.txt
    A LayoutTests/media/media-session/actionHandler-no-document-leak.html
    A LayoutTests/media/media-session/resources/media-session-action-handler-document-leak-frame.html
    M Source/WebCore/Modules/mediasession/MediaSession.cpp
    M Source/WebCore/Modules/mediasession/MediaSession.h
    M Source/WebCore/Modules/mediasession/MediaSession.idl
    M Source/WebCore/Modules/mediasession/MediaSessionActionHandler.h
    M Source/WebCore/Modules/mediasession/MediaSessionActionHandler.idl
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/bindings/js/JSMediaSessionCustom.cpp

  Log Message:
  -----------
  Cherry-pick e938617efad6. rdar://problem/105112595

    The Document object is leaked on some pages using media (like YouTube.com)
    https://bugs.webkit.org/show_bug.cgi?id=251835
    rdar://105112595

    Reviewed by Chris Dumez.

    Re-land of 263660 at main (and 263715 at main) fixing crashes due to
    prematurely garbage collected MediaSessionActionHandler JS wrappers.

    By default a callback holds a Strong<> reference to the JS Function
    object. This has the effect of making the callback a GC root. Another
    option is to annotate the callback with the IsWeakCallback extended
    attribute which will hold the callback object as a Weak reference and
    keep it alive via the visitJSFunction mechanism instead of making it a
    root.

    In the case of MediaSessionActionHandler the strong reference will
    prevent an HTMLDocument from being garbage collected even after
    navigating away and clearing the caches (after a low memory warning, for
    example). This change adds the IsWeakCallback attribute and the
    necessary virtual function to the MediaSessionActionHandler base class
    and makes changes to allow the MediaSession to mark any action handlers
    that have been added to it.

    LayoutTests:

        Add a test to check that action handlers installed by the page are
        not leaked. Use an iframe to install and exercise the action
        handlers before the iframe is navigated away and a garbage
        collection is triggered (repeatedly). If after 500 attempts at GC
        the document containing the action handlers still exists we consider
        the document leaked.

        Also add a test to check that action handlers survive garbage
        collection and can be called when appropriate.

    * LayoutTests/media/media-session/actionHandler-lifetime-expected.txt: Added.
    * LayoutTests/media/media-session/actionHandler-lifetime.html: Added.
    * LayoutTests/media/media-session/actionHandler-no-document-leak-expected.txt: Added.
    * LayoutTests/media/media-session/actionHandler-no-document-leak.html: Added.
    * LayoutTests/media/media-session/resources/media-session-action-handler-document-leak-frame.html: Added.

    * Source/WebCore/Modules/mediasession/MediaSession.cpp:
    (WebCore::MediaSession::virtualHasPendingActivity const):
    (WebCore::MediaSession::setActionHandler):
    (WebCore::MediaSession::callActionHandler):
    * Source/WebCore/Modules/mediasession/MediaSession.h:
    (WebCore::MediaSession::hasActiveActionHandlers const):
    (WebCore::MediaSession::visitActionHandlers const):
    * Source/WebCore/Modules/mediasession/MediaSession.idl:
    * Source/WebCore/Modules/mediasession/MediaSessionActionHandler.h:
    * Source/WebCore/Modules/mediasession/MediaSessionActionHandler.idl:
    * Source/WebCore/Sources.txt:
    * Source/WebCore/WebCore.xcodeproj/project.pbxproj:
    * Source/WebCore/bindings/js/JSMediaSessionCustom.cpp: Added.
    (WebCore::JSMediaSession::visitAdditionalChildren):

    Canonical link: https://commits.webkit.org/263868@main

Identifier: 263769.9 at safari-7616.1.14-branch


  Commit: e1cccf3f745435b6c0df9413f5077f8645a16bd1
      https://github.com/WebKit/WebKit/commit/e1cccf3f745435b6c0df9413f5077f8645a16bd1
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M Source/WebCore/css/CSSSelector.cpp

  Log Message:
  -----------
  Cherry-pick 28bb70d0289c. rdar://problem/108836283

    [CSS] Fix memory leak in CSSSelector copy ctor
    https://bugs.webkit.org/show_bug.cgi?id=256412
    rdar://108836283

    Reviewed by Antti Koivisto.

    After leakRef(), the counter is already at 1, calling ref() is wrong.

    * Source/WebCore/css/CSSSelector.cpp:
    (WebCore::CSSSelector::CSSSelector):

    Canonical link: https://commits.webkit.org/263859@main

Identifier: 263769.10 at safari-7616.1.14-branch


  Commit: 729c78d2b5e92f28e9ba07928b273d61b0ff43a8
      https://github.com/WebKit/WebKit/commit/729c78d2b5e92f28e9ba07928b273d61b0ff43a8
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M LayoutTests/http/tests/css/resources/shared-stylesheet-mutation.js
    M LayoutTests/http/tests/css/resources/shared.css
    M LayoutTests/http/tests/css/shared-stylesheet-mutation-preconstruct-expected.txt
    M Source/WebCore/css/CSSCounterStyleRule.h

  Log Message:
  -----------
  Cherry-pick 37bb9afc0b47. rdar://problem/109082260

    Fix assert crash "SHOULD NEVER BE REACHED" in StyleRuleCounterStyle
    https://bugs.webkit.org/show_bug.cgi?id=256522
    rdar://109082260

    Reviewed by Antti Koivisto.

    We need to add copy for CSSCounterStyleRule since a change
    on style will force a copy-on-write operation.

    * Source/WebCore/css/CSSCounterStyleRule.h:
    Implement copy().

    * LayoutTests/http/tests/css/resources/shared.css:
    (@counter-style fooCounter):
    (@counter-style fooExtends):
    - Adding @counter-style rules for exercising the code path tested here.

    (@counter-style fooExtends):
    * LayoutTests/http/tests/css/shared-stylesheet-mutation-preconstruct-expected.txt:
    - Testing mutations on new rules.

    * LayoutTests/http/tests/css/shared-stylesheet-mutation-preconstruct-expected.txt:
    - Rebasing the this test for new rules.

    Canonical link: https://commits.webkit.org/263870@main

Identifier: 263769.11 at safari-7616.1.14-branch


  Commit: 1f15357226f30959a8a7dd7205b81e670cf88552
      https://github.com/WebKit/WebKit/commit/1f15357226f30959a8a7dd7205b81e670cf88552
  Author: Myah Cobbs <mcobbs at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Configurations/Version.xcconfig

  Log Message:
  -----------
  Versioning.

Identifier: 263769.12 at safari-7616.1.14-branch


  Commit: b207c7a9799b575dbc9e9f22ee8a0295ceef2a38
      https://github.com/WebKit/WebKit/commit/b207c7a9799b575dbc9e9f22ee8a0295ceef2a38
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/JSObject.h
    M Source/JavaScriptCore/runtime/JSObjectInlines.h
    M Source/JavaScriptCore/runtime/ObjectConstructor.h

  Log Message:
  -----------
  Cherry-pick 0a95f7ae6739. rdar://problem/109049306

    [JSC] Simplify constructEmptyObject
    https://bugs.webkit.org/show_bug.cgi?id=256478
    rdar://109049306

    Reviewed by Alexey Shvayka and Keith Miller.

    This patch simplifies constructEmptyObject because this is super hot code in JSON.parse.

    1. gcSafeZeroMemory is not necessary in JSFinalObject's constructor. memset is OK since
       this object is not exposed to GC yet.
    2. We use constant defaultInlineCapacity in constructEmptyObject's fast path to make
       the above constant assignment instead of loop.

    * Source/JavaScriptCore/runtime/JSObject.h:
    (JSC::JSFinalObject::createWithButterfly):
    * Source/JavaScriptCore/runtime/JSObjectInlines.h:
    (JSC::JSFinalObject::createDefaultEmptyObject):
    * Source/JavaScriptCore/runtime/ObjectConstructor.h:
    (JSC::constructEmptyObject):

    Canonical link: https://commits.webkit.org/263815@main

Identifier: 263769.13 at safari-7616.1.14-branch


  Commit: a0fb225e6d8d65517bb0eeb7fd7c2b45756c94ce
      https://github.com/WebKit/WebKit/commit/a0fb225e6d8d65517bb0eeb7fd7c2b45756c94ce
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/RenderThemeCocoa.h
    M Source/WebCore/rendering/RenderThemeCocoa.mm
    M Source/WebCore/rendering/RenderThemeIOS.h
    M Source/WebCore/rendering/RenderThemeIOS.mm
    M Source/WebCore/rendering/TextBoxPainter.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  Cherry-pick b199f7db6bc8. rdar://problem/108355409

    [Mac Catalyst] Adjust autocorrection underline color based on caret color
    https://bugs.webkit.org/show_bug.cgi?id=256475
    rdar://108355409

    Reviewed by Wenson Hsieh.

    The autocorrection underline color should be a variant of the current caret
    color. In order to facilitate this, the insertion point color is plumbed from
    the UI Process into the Web Process.

    * Source/WebCore/rendering/RenderTheme.cpp:
    (WebCore::RenderTheme::autocorrectionReplacementMarkerColor const):
    (WebCore::RenderTheme::documentMarkerLineColor const):
    * Source/WebCore/rendering/RenderTheme.h:

    Add a `RenderText` parameter to `documentMarkerLineColor`, since it is
    necessary to determine the caret color.

    * Source/WebCore/rendering/RenderThemeCocoa.h:
    * Source/WebCore/rendering/RenderThemeCocoa.mm:
    (WebCore::RenderThemeCocoa::platformAutocorrectionReplacementMarkerColor const): Deleted.

    Remove override, as the color is too dynamic to be cached. `caret-color` can
    differ per-element, so the autocorrection underline color can no longer be cached.

    * Source/WebCore/rendering/RenderThemeIOS.h:

    Add a static method to set the insertion point color to avoid unnecessary
    initialization of the singleton.

    * Source/WebCore/rendering/RenderThemeIOS.mm:
    (WebCore::cachedInsertionPointColor):
    (WebCore::RenderThemeIOS::insertionPointColor):
    (WebCore::RenderThemeIOS::autocorrectionReplacementMarkerColor const):

    Adjust the autocorrection underline color based on the current caret color. If
    `caret-color` is `auto`, use the default color from the UI process. The
    adjustment is performed using the HSL colorspace, matching UIKit.

    (WebCore::RenderThemeIOS::setInsertionPointColor):
    * Source/WebCore/rendering/TextBoxPainter.cpp:
    (WebCore::TextBoxPainter<TextBoxPath>::paintPlatformDocumentMarker):
    * Source/WebKit/Shared/WebPageCreationParameters.cpp:
    (WebKit::WebPageCreationParameters::encode const):
    (WebKit::WebPageCreationParameters::decode):
    * Source/WebKit/Shared/WebPageCreationParameters.h:
    * Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
    * Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
    (-[WKWebView _insertionPointColor]):

    Get the insertion point color from the text input traits if it exists. Otherwise,
    use the default color specified in UIKit.

    * Source/WebKit/UIProcess/PageClient.h:

    Add a `PageClient` hook to get the insertion point color.

    * Source/WebKit/UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::creationParameters):
    * Source/WebKit/UIProcess/WebPageProxy.h:
    * Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
    * Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
    (WebKit::PageClientImpl::insertionPointColor):
    * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
    (-[WKContentView tintColorDidChange]):

    Ensure the insertion point color is up-to-date, following changes to the view's
    tint color.

    * Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
    (WebKit::WebPageProxy::insertionPointColorDidChange):
    * Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
    (WebKit::WebPage::platformInitialize):
    * Source/WebKit/WebProcess/WebPage/WebPage.h:
    * Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
    * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
    (WebKit::WebPage::setInsertionPointColor):

    Canonical link: https://commits.webkit.org/263879@main

Identifier: 263769.14 at safari-7616.1.14-branch


  Commit: 688fc4494b48a7f062b5c2defaf000882ff30830
      https://github.com/WebKit/WebKit/commit/688fc4494b48a7f062b5c2defaf000882ff30830
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WTF/wtf/LoggerHelper.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModel.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h
    M Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm
    M Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.h
    M Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm
    M Source/WebCore/platform/graphics/FloatSize.h
    M Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.h
    M Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm
    M Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h
    M Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
    M Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.h
    M Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.mm
    M Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.h
    M Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in
    M Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm
    M Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h
    M Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm
    M Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h
    M Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm

  Log Message:
  -----------
  Cherry-pick 8877cb0fb4d4. rdar://problem/108427487

    [Cocoa] Add runtime logging for PlaybackSessionMangager and VideoFullscreenMangager and their proxies
    https://bugs.webkit.org/show_bug.cgi?id=255843
    rdar://108427487

    Reviewed by Eric Carlson.

    Add logging to the constellation of classes that make up PlaybackSessionManager and VideoFullscreenManager.

    * Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.h:
    (WebCore::VideoFullscreenModelVideoElement::logClassName const):
    * Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm:
    (WebCore::VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
    (WebCore::VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement):
    (WebCore::VideoFullscreenModelVideoElement::setVideoElement):
    (WebCore::VideoFullscreenModelVideoElement::willExitFullscreen):
    (WebCore::VideoFullscreenModelVideoElement::createVideoFullscreenLayer):
    (WebCore::VideoFullscreenModelVideoElement::setVideoFullscreenLayer):
    (WebCore::VideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
    (WebCore::VideoFullscreenModelVideoElement::requestFullscreenMode):
    (WebCore::VideoFullscreenModelVideoElement::setVideoLayerFrame):
    (WebCore::VideoFullscreenModelVideoElement::setVideoSizeFenced):
    (WebCore::VideoFullscreenModelVideoElement::setVideoLayerGravity):
    (WebCore::VideoFullscreenModelVideoElement::fullscreenModeChanged):
    (WebCore::VideoFullscreenModelVideoElement::setHasVideo):
    (WebCore::VideoFullscreenModelVideoElement::setVideoDimensions):
    (WebCore::VideoFullscreenModelVideoElement::willEnterPictureInPicture):
    (WebCore::VideoFullscreenModelVideoElement::didEnterPictureInPicture):
    (WebCore::VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
    (WebCore::VideoFullscreenModelVideoElement::willExitPictureInPicture):
    (WebCore::VideoFullscreenModelVideoElement::didExitPictureInPicture):
    (WebCore::VideoFullscreenModelVideoElement::loggerPtr):
    (WebCore::VideoFullscreenModelVideoElement::logIdentifier):
    (WebCore::VideoFullscreenModelVideoElement::logChannel const):
    * Source/WebCore/platform/graphics/FloatSize.h:
    * Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
    (WebKit::PlaybackSessionManagerProxy::logger const):
    (WebKit::PlaybackSessionManagerProxy::logIdentifier const):
    (WebKit::PlaybackSessionManagerProxy::logClassName const):
    * Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
    * Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
    (WebKit::PlaybackSessionModelContext::PlaybackSessionModelContext):
    (WebKit::PlaybackSessionModelContext::play):
    (WebKit::PlaybackSessionModelContext::pause):
    (WebKit::PlaybackSessionModelContext::togglePlayState):
    (WebKit::PlaybackSessionModelContext::beginScrubbing):
    (WebKit::PlaybackSessionModelContext::endScrubbing):
    (WebKit::PlaybackSessionModelContext::seekToTime):
    (WebKit::PlaybackSessionModelContext::fastSeek):
    (WebKit::PlaybackSessionModelContext::beginScanningForward):
    (WebKit::PlaybackSessionModelContext::beginScanningBackward):
    (WebKit::PlaybackSessionModelContext::endScanning):
    (WebKit::PlaybackSessionModelContext::setDefaultPlaybackRate):
    (WebKit::PlaybackSessionModelContext::setPlaybackRate):
    (WebKit::PlaybackSessionModelContext::selectAudioMediaOption):
    (WebKit::PlaybackSessionModelContext::selectLegibleMediaOption):
    (WebKit::PlaybackSessionModelContext::togglePictureInPicture):
    (WebKit::PlaybackSessionModelContext::toggleMuted):
    (WebKit::PlaybackSessionModelContext::setMuted):
    (WebKit::PlaybackSessionModelContext::setVolume):
    (WebKit::PlaybackSessionModelContext::setPlayingOnSecondScreen):
    (WebKit::PlaybackSessionModelContext::playbackStartedTimeChanged):
    (WebKit::PlaybackSessionModelContext::durationChanged):
    (WebKit::PlaybackSessionModelContext::currentTimeChanged):
    (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
    (WebKit::PlaybackSessionModelContext::rateChanged):
    (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
    (WebKit::PlaybackSessionModelContext::logChannel const):
    (WebKit::PlaybackSessionManagerProxy::PlaybackSessionManagerProxy):
    (WebKit::PlaybackSessionManagerProxy::~PlaybackSessionManagerProxy):
    (WebKit::PlaybackSessionManagerProxy::invalidate):
    (WebKit::PlaybackSessionManagerProxy::setLogIdentifier):
    (WebKit::PlaybackSessionManagerProxy::logChannel const):
    * Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
    * Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
    (WebKit::VideoFullscreenModelContext::requestCloseAllMediaPresentations):
    (WebKit::VideoFullscreenModelContext::requestFullscreenMode):
    (WebKit::VideoFullscreenModelContext::setVideoLayerFrame):
    (WebKit::VideoFullscreenModelContext::setVideoLayerGravity):
    (WebKit::VideoFullscreenModelContext::fullscreenModeChanged):
    (WebKit::VideoFullscreenModelContext::requestUpdateInlineRect):
    (WebKit::VideoFullscreenModelContext::requestVideoContentLayer):
    (WebKit::VideoFullscreenModelContext::returnVideoContentLayer):
    (WebKit::VideoFullscreenModelContext::returnVideoView):
    (WebKit::VideoFullscreenModelContext::didSetupFullscreen):
    (WebKit::VideoFullscreenModelContext::failedToEnterFullscreen):
    (WebKit::VideoFullscreenModelContext::didEnterFullscreen):
    (WebKit::VideoFullscreenModelContext::willExitFullscreen):
    (WebKit::VideoFullscreenModelContext::didExitFullscreen):
    (WebKit::VideoFullscreenModelContext::didCleanupFullscreen):
    (WebKit::VideoFullscreenModelContext::fullscreenMayReturnToInline):
    (WebKit::VideoFullscreenModelContext::requestRouteSharingPolicyAndContextUID):
    (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
    (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
    (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
    (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
    (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
    (WebKit::VideoFullscreenModelContext::logIdentifier const):
    (WebKit::VideoFullscreenModelContext::logger const):
    (WebKit::VideoFullscreenModelContext::logChannel const):
    (WebKit::VideoFullscreenManagerProxy::VideoFullscreenManagerProxy):
    (WebKit::VideoFullscreenManagerProxy::~VideoFullscreenManagerProxy):
    (WebKit::VideoFullscreenManagerProxy::invalidate):
    (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen):
    (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive):
    (WebKit::VideoFullscreenManagerProxy::hasVideoInPictureInPictureDidChange):
    (WebKit::VideoFullscreenManagerProxy::logger const):
    (WebKit::VideoFullscreenManagerProxy::logIdentifier const):
    (WebKit::VideoFullscreenManagerProxy::logClassName const):
    (WebKit::VideoFullscreenManagerProxy::logChannel const):
    * Source/WebKit/UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::logIdentifier const):
    * Source/WebKit/UIProcess/WebPageProxy.h:
    * Source/WebKit/WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::logger const):
    (WebKit::WebPage::logIdentifier const):
    * Source/WebKit/WebProcess/WebPage/WebPage.h:
    * Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h:
    (WebKit::PlaybackSessionManager::logger const):
    (WebKit::PlaybackSessionManager::logIdentifier const):
    (WebKit::PlaybackSessionManager::logClassName const):
    * Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm:
    (WebKit::PlaybackSessionManager::PlaybackSessionManager):
    (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
    (WebKit::PlaybackSessionManager::invalidate):
    (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
    (WebKit::PlaybackSessionManager::logChannel const):
    * Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h:
    * Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm:
    (WebKit::VideoFullscreenManager::VideoFullscreenManager):
    (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
    (WebKit::VideoFullscreenManager::invalidate):
    (WebKit::VideoFullscreenManager::setupRemoteLayerHosting):
    (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
    (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement):
    (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
    (WebKit::VideoFullscreenManager::requestVideoContentLayer):
    (WebKit::VideoFullscreenManager::returnVideoContentLayer):
    (WebKit::VideoFullscreenManager::didSetupFullscreen):
    (WebKit::VideoFullscreenManager::willExitFullscreen):
    (WebKit::VideoFullscreenManager::didEnterFullscreen):
    (WebKit::VideoFullscreenManager::failedToEnterFullscreen):
    (WebKit::VideoFullscreenManager::didExitFullscreen):
    (WebKit::VideoFullscreenManager::didCleanupFullscreen):
    (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum):
    (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
    (WebKit::VideoFullscreenManager::logger const):
    (WebKit::VideoFullscreenManager::logIdentifier const):
    (WebKit::VideoFullscreenManager::logClassName const):
    (WebKit::VideoFullscreenManager::logChannel const):

    Canonical link: https://commits.webkit.org/263773@main

Identifier: 263769.15 at safari-7616.1.14-branch


  Commit: 5f441493a5623eb8afd249865c90874046015443
      https://github.com/WebKit/WebKit/commit/5f441493a5623eb8afd249865c90874046015443
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WebCore/platform/cocoa/VideoFullscreenModel.h
    M Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.h
    M Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.h
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm
    M Source/WebCore/platform/cocoa/WebAVPlayerLayerView.mm
    M Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
    M Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm
    M Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm

  Log Message:
  -----------
  Cherry-pick 95f95436a7cd. rdar://problem/105929105

    [Cocoa] Video doesn't resize on YouTube.com in theater mode
    https://bugs.webkit.org/show_bug.cgi?id=256473
    rdar://105929105

    Reviewed by Simon Fraser.

    A rare timing issue will sometimes cause WebAVPlayerLayer to get "stuck" thinking it has an empty
    videoDimensions. This seems to occur when layerCreationProperies are initialized in the WebContent
    process before the video element has a valid nativeSize, but the video element's "resize" event
    is fired before the layer is created in the UI process.

    One cause of this symptom is that not all the relevant objects are notified when the videoDimensions
    change in the UI process. The VideoFullscreenModelContext object has a videoDimensions() method whose
    instance variable is never modified. And notifying the relevent objects becomes a job of the
    VideoFullscreenManagerProxy itself, and that coverage was spotty.

    Instead, fully implement VideoFullscreenModelContext::setVideoDimensions() and use the pre-existing
    VideoFullscreenModelClient callbacks to notify both the VideoFullscreenInterface{Mac,AVKit} and the
    WebAVPlayerLayer when the underlying video dimensions change.

    WebAVPlayerLayer will therefore need a VideoFullscreenModelClient proxy object to use as the client
    for the model, and since the only thing it uses a VideoFullscreenInteraface object for is to get its
    associated model, it should just keep a weak reference to the model itself. Adding the model to the
    WebAVPlayerLayer will cause its videoDimensions property to update. And when the videoDimensions
    change, it can mark itself as needing layout.

    Drive-by fix: In WebAVPlayerLayer, the -layoutSublayers method would bail out early if its own
    affineTransform property was identity. This was incorrect, it should have checked it's videoSublayer's
    affineTransform property, as that's what is actually changed later in the method. Also, don't
    disable animations in the -layoutSublayers method, as this will cause animated property changes
    to break (such as PiP animations on iOS).

    * Source/WebCore/platform/cocoa/VideoFullscreenModel.h:
    (WebCore::VideoFullscreenModel::logIdentifier const):
    (WebCore::VideoFullscreenModel::loggerPtr const):
    * Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.h:
    * Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm:
    (WebCore::VideoFullscreenModelVideoElement::logIdentifier const):
    (WebCore::VideoFullscreenModelVideoElement::logIdentifier): Deleted.
    * Source/WebCore/platform/cocoa/WebAVPlayerLayer.h:
    * Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm:
    (WebCore::WebAVPlayerLayerFullscreenModelClient::WebAVPlayerLayerFullscreenModelClient):
    (WebCore::WebAVPlayerLayerFullscreenModelClient::videoDimensionsChanged):
    (-[WebAVPlayerLayer init]):
    (-[WebAVPlayerLayer fullscreenModel]):
    (-[WebAVPlayerLayer setFullscreenModel:]):
    (-[WebAVPlayerLayer videoDimensions]):
    (-[WebAVPlayerLayer setVideoDimensions:]):
    (-[WebAVPlayerLayer layoutSublayers]):
    (-[WebAVPlayerLayer resolveBounds]):
    (-[WebAVPlayerLayer setVideoGravity:]):
    (-[WebAVPlayerLayer logIdentifier]):
    (-[WebAVPlayerLayer loggerPtr]):
    (-[WebAVPlayerLayer fullscreenInterface]): Deleted.
    (-[WebAVPlayerLayer setFullscreenInterface:]): Deleted.
    * Source/WebCore/platform/cocoa/WebAVPlayerLayerView.mm:
    (WebCore::WebAVPlayerLayerView_startRoutingVideoToPictureInPicturePlayerLayerView):
    * Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm:
    (VideoFullscreenInterfaceAVKit::doSetup):
    * Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm:
    (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
    (WebCore::boolString): Deleted.
    * Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
    * Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
    (WebKit::VideoFullscreenModelContext::setVideoDimensions):
    (WebKit::VideoFullscreenManagerProxy::createLayerWithID):
    (WebKit::VideoFullscreenManagerProxy::createViewWithID):
    (WebKit::VideoFullscreenManagerProxy::setVideoDimensions):

    Canonical link: https://commits.webkit.org/263836@main

Identifier: 263769.16 at safari-7616.1.14-branch


  Commit: 282d731088c6d9c59656c46981ffa95c69a7ebfe
      https://github.com/WebKit/WebKit/commit/282d731088c6d9c59656c46981ffa95c69a7ebfe
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm

  Log Message:
  -----------
  Cherry-pick 1c22f6e64ba0. rdar://problem/105929105

    [Cocoa] Video doesn't resize on YouTube.com in theater mode
    https://bugs.webkit.org/show_bug.cgi?id=256473
    rdar://105929105

    Unreviewed follow-up to 263836 at main; fix runtime crash in -[WebAVPlayerLayer dealloc].

    Just do the client deregistration explicitly in the dealloc method.

    * Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm:
    (-[WebAVPlayerLayer dealloc]):

    Canonical link: https://commits.webkit.org/263846@main

Identifier: 263769.17 at safari-7616.1.14-branch


  Commit: bdf360f20336fcbac2e0ed0fd3b91a6e6654f697
      https://github.com/WebKit/WebKit/commit/bdf360f20336fcbac2e0ed0fd3b91a6e6654f697
  Author: Per Arne Vollan <pvollan at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

  Log Message:
  -----------
  Cherry-pick 5e5a722eefb0. rdar://problem/109095468

    WebContent logging is being redacted
    https://bugs.webkit.org/show_bug.cgi?id=256523
    rdar://109095468

    Reviewed by Chris Dumez and Alexey Proskuryakov.

    When forwarding WebContent logs to the Networking process, the logs are being redacted in non internal builds.
    This patch addresses this by switching to '%{public}s' in the format string for the preprocessed string from
    the WebContent process. This should not reveal any redacted information in the string, since it has already
    been composed in the WebContent process.

    * Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
    (WebKit::NetworkConnectionToWebProcess::logOnBehalfOfWebContent):

    Canonical link: https://commits.webkit.org/263871@main

Identifier: 263769.18 at safari-7616.1.14-branch


  Commit: 614c3b1f985dbd032a5b4c600a4c74c83d3ff3b2
      https://github.com/WebKit/WebKit/commit/614c3b1f985dbd032a5b4c600a4c74c83d3ff3b2
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    A JSTests/microbenchmarks/proxy-get-by-val-hit.js
    A JSTests/microbenchmarks/proxy-get-by-val-miss.js
    A JSTests/microbenchmarks/proxy-get-megamorphic.js
    M Source/JavaScriptCore/builtins/ProxyHelpers.js
    M Source/JavaScriptCore/bytecode/AccessCase.cpp
    M Source/JavaScriptCore/bytecode/AccessCase.h
    M Source/JavaScriptCore/bytecode/GetByStatus.cpp
    M Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp
    M Source/JavaScriptCore/bytecode/Repatch.cpp
    M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGClobberize.h
    M Source/JavaScriptCore/dfg/DFGDoesGC.cpp
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/dfg/DFGNode.h
    M Source/JavaScriptCore/dfg/DFGNodeType.h
    M Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
    M Source/JavaScriptCore/dfg/DFGSafeToExecute.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
    M Source/JavaScriptCore/ftl/FTLCapabilities.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/jit/JITOperations.cpp
    M Source/JavaScriptCore/jit/JITOperations.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h

  Log Message:
  -----------
  Cherry-pick 871d04ba21fb. rdar://problem/108920491

    [JSC] Optimize Proxy get with various keys without handlers
    https://bugs.webkit.org/show_bug.cgi?id=256340
    rdar://108920491

    Reviewed by Michael Saboff.

    This patch optimizes the use case, which is the following,

        var proxy = new Proxy({}, { .. not get handler });
        proxy[varousKeys];

    1. First, we introduce IndexedProxyObjectLoad IC to handle GetByVal with ProxyObject case.
       We just extend existing ProxyObjectLoad with non-constant subscript. And to enforce property-keys,
       we need to call @toPropertyKey, and that's why we introduce a performProxyObjectGetByVal separately
       from performProxyObjectGet.
    2. Inside performProxyObjectGetByVal, we would like to handle GetByValWithThis efficiently. And one of
       the key improvement we can have is introducing megamorphic IC for that. Because megamorphic IC only
       handles non-getter cases, it perfectly works well with GetByValWithThis since megamorphic IC fast
       path does not care about |this| value.
    3. We introduce GetByValWithThisMegamorphic and GetByIdWithThisMegamorphic DFG / FTL nodes to handle
       these megamorphic cases efficiently in DFG and FTL.

                                             ToT                     Patched

        proxy-get-by-val-hit          334.7270+-1.2121     ^     62.1673+-0.2790        ^ definitely 5.3843x faster
        proxy-get-megamorphic          33.8379+-0.1459     ^      9.9726+-0.0896        ^ definitely 3.3931x faster
        proxy-get-by-val-miss         390.1010+-1.5733     ^     57.8217+-0.2928        ^ definitely 6.7466x faster

    * Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp:
    (JSC::InlineCacheCompiler::regenerate):
    * Source/JavaScriptCore/bytecode/Repatch.cpp:
    (JSC::repatchGetBy):
    * Source/JavaScriptCore/jit/JITOperations.cpp:
    (JSC::JSC_DEFINE_JIT_OPERATION):
    * Source/JavaScriptCore/jit/JITOperations.h:

    Canonical link: https://commits.webkit.org/263892@main

Identifier: 263769.19 at safari-7616.1.14-branch


  Commit: ba47a0da16de90d517b7e3296f87711f23643ccb
      https://github.com/WebKit/WebKit/commit/ba47a0da16de90d517b7e3296f87711f23643ccb
  Author: Brent Fulgham <bfulgham at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WebKit/GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in
    M Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp
    M Source/WebKit/UIProcess/UserMediaProcessManager.cpp

  Log Message:
  -----------
  Cherry-pick 419d742e96e5. rdar://problem/109117566

    Dynamically extend GPU Process to Apple Camera Client IOKit Classes when appropriate
    https://bugs.webkit.org/show_bug.cgi?id=256562
    <rdar://109117566>

    Reviewed by Youenn Fablet, Eric Carlson and Per Arne Vollan.

    Continue the work from Bug 256013 by dynamically extending the IOKit classes used
    when the camera is enabled during WebRTC.

    * Source/WebKit/GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
    * Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp:
    (WebKit::addCameraSandboxExtensions):
    * Source/WebKit/UIProcess/UserMediaProcessManager.cpp:
    (WebKit::UserMediaProcessManager::willCreateMediaStream):

    Canonical link: https://commits.webkit.org/263903@main

Identifier: 263769.20 at safari-7616.1.14-branch


  Commit: 6c0c822f2792193b0bc75252b6e233b9c8405e35
      https://github.com/WebKit/WebKit/commit/6c0c822f2792193b0bc75252b6e233b9c8405e35
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt
    M Source/WebCore/css/CSSFontFaceSrcValue.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.h
    M Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp
    M Source/WebCore/css/parser/CSSSupportsParser.cpp
    M Source/WebCore/platform/graphics/coretext/FontCustomPlatformDataCoreText.cpp
    M Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
    M Source/WebCore/platform/graphics/win/FontCustomPlatformDataWin.cpp

  Log Message:
  -----------
  Cherry-pick 0a0261e666d9. rdar://problem/108897052

    Fix list of supported font-formats at parse time (256313)
    https://bugs.webkit.org/show_bug.cgi?id=256313
    rdar://108897052

    Reviewed by Myles C. Maxfield.

    We are now rejecting unsupported formats at parsing time.
    We are also moving the code fragment that parses the font-format to
    its own function, so it can be used by both @font-face src and @supports
    parsers.

    * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt:
    * Source/WebCore/css/CSSFontFaceSrcValue.cpp:
    (WebCore::CSSFontFaceSrcResourceValue::fontLoadRequest):
    * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
    (WebCore::CSSPropertyParserHelpers::consumeFontFormat):
    (WebCore::CSSPropertyParserHelpers::identMatchesSupportedFontFormat): Deleted.
    * Source/WebCore/css/parser/CSSPropertyParserHelpers.h:
    * Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp:
    (WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
    * Source/WebCore/css/parser/CSSSupportsParser.cpp:
    (WebCore::CSSSupportsParser::consumeSupportsFontFormatFunction):
    * Source/WebCore/platform/graphics/coretext/FontCustomPlatformDataCoreText.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat):
    * Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat):
    * Source/WebCore/platform/graphics/win/FontCustomPlatformDataWin.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat):

    Canonical link: https://commits.webkit.org/263914@main

Identifier: 263769.21 at safari-7616.1.14-branch


  Commit: f88b24c2ad3e7b1a4c973119d359dc9fb3ef24b4
      https://github.com/WebKit/WebKit/commit/f88b24c2ad3e7b1a4c973119d359dc9fb3ef24b4
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

  Log Message:
  -----------
  Cherry-pick 6537be3e9a0b. rdar://problem/109042873

    Unreviewed build fix on macOS
    https://bugs.webkit.org/show_bug.cgi?id=256476
    rdar://109042873

    * Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm:
    (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):

    Canonical link: https://commits.webkit.org/263804@main

Identifier: 263769.22 at safari-7616.1.14-branch


  Commit: 7ec0064dac7a14a1dc6750815032e58c6423d334
      https://github.com/WebKit/WebKit/commit/7ec0064dac7a14a1dc6750815032e58c6423d334
  Author: Myah Cobbs <mcobbs at apple.com>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    M Configurations/Version.xcconfig

  Log Message:
  -----------
  Versioning.

Identifier: 263769.23 at safari-7616.1.14-branch


  Commit: ba05a3f43cd3da071e6952a63b58eecd2d3bb08a
      https://github.com/WebKit/WebKit/commit/ba05a3f43cd3da071e6952a63b58eecd2d3bb08a
  Author: David Degazio <d_degazio at apple.com>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    A JSTests/wasm/stress/divide-by-constant-power-of-two.js
    A JSTests/wasm/stress/remainder-by-constant-power-of-two.js
    M Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
    M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp

  Log Message:
  -----------
  Cherry-pick acb670a0a6d0. rdar://problem/108073980

    Fix signed division bias for power-of-two divisor in BBQ JIT
    https://bugs.webkit.org/show_bug.cgi?id=256569
    rdar://108073980

    Reviewed by Yusuke Suzuki.

    Fixes instruction selection for integer division and remainder
    in BBQ JIT when the divisor is a constant power of two, with new
    tests for the edge cases previously not covered by our suite.

    * JSTests/wasm/stress/divide-by-constant-power-of-two.js: Added.
    (async test):
    * JSTests/wasm/stress/remainder-by-constant-power-of-two.js: Added.
    (async test):
    * Source/JavaScriptCore/assembler/MacroAssemblerARM64.h:
    (JSC::MacroAssemblerARM64::add64):
    * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
    (JSC::Wasm::BBQJIT::emitModOrDiv):

    Canonical link: https://commits.webkit.org/263925@main

Identifier: 263769.24 at safari-7616.1.14-branch


  Commit: 88adcae09b586c9d3cba8b92a74165b3145bbe74
      https://github.com/WebKit/WebKit/commit/88adcae09b586c9d3cba8b92a74165b3145bbe74
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    A JSTests/stress/object-prototype-is-immutable-prototype-object.js
    M Source/JavaScriptCore/runtime/JSObject.cpp
    M Source/JavaScriptCore/runtime/ProxyObject.cpp
    M Source/JavaScriptCore/runtime/ProxyObject.h

  Log Message:
  -----------
  Cherry-pick e1e2cbbf2d6f. rdar://problem/109119378

    [JSC] Cache lookups of ProxyObject's traps
    https://bugs.webkit.org/show_bug.cgi?id=256554
    <rdar://problem/109119378>

    Reviewed by Yusuke Suzuki.

    This patch introduces a caching of handler's traps by storing an array of property offsets, handler's
    structure ID, and handler's prototype structure ID. We optimize for common case of ProxyObject's handler
    being a plain JSFinalObject inheriting from Object.prototype, which [[Prototype]] is always `null`.

    For now, only 3 of the most popular traps are cached: "has", "get", and "set".
    Also, removes extra isCell() check from getMethod() to micro-optimize lookup of other traps.

    This change progresses microbenchmarks with missing handlers by 60-70% when IC is off,
    and speeds up Speedometer2/Flight-TodoMVC by 2%.

                                       ToT                      patch

    proxy-has-miss-handler      310.7297+-1.4310     ^    182.3500+-0.2509        ^ definitely 1.7040x faster
    proxy-set-miss-handler     1305.7705+-2.9307     ^   1179.7164+-4.0497        ^ definitely 1.1069x faster
    proxy-get-miss-handler      310.6261+-0.1537     ^    190.5240+-0.3619        ^ definitely 1.6304x faster

    <geometric>                 501.3743+-1.0979     ^    344.7815+-0.4166        ^ definitely 1.4542x faster

    * Source/JavaScriptCore/runtime/JSObject.cpp:
    (JSC::JSObject::getMethod):
    * Source/JavaScriptCore/runtime/ProxyObject.cpp:
    (JSC::ProxyObject::ProxyObject):
    (JSC::ProxyObject::getHandlerTrap):
    (JSC::ProxyObject::clearHandlerTrapsOffsetsCache):
    (JSC::performProxyGet):
    (JSC::ProxyObject::performHasProperty):
    (JSC::ProxyObject::performPut):
    (JSC::ProxyObject::visitChildrenImpl):
    * Source/JavaScriptCore/runtime/ProxyObject.h:

    Canonical link: https://commits.webkit.org/263944@main

Identifier: 263769.25 at safari-7616.1.14-branch


  Commit: ee2818b73a0080d5dccc9ecc4f7c996eac5de0ee
      https://github.com/WebKit/WebKit/commit/ee2818b73a0080d5dccc9ecc4f7c996eac5de0ee
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    M Source/WebKit/UIProcess/WebProcessProxy.cpp

  Log Message:
  -----------
  WebProcessProxy should use default settings values for near-suspended assertions when they have no page
https://bugs.webkit.org/show_bug.cgi?id=256648
rdar://108292314

Reviewed by Sihui Liu.

WebProcessProxy should use default settings values for near-suspended
assertions when they have no page. In WebKit, settings come from pages. The
WebProcessProxy therefore iterate through pages to figure out if it should take
near-suspended assertions and if it should drop them after a delay.

However, if the process doesn't have any pages, it would fall back to a value
that is not the default value for these settings, which would lead to
unexpected behavior in some case. This is particularly noticeable for service
worker processes which often don't have pages.

* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::shouldTakeNearSuspendedAssertion const):
(WebKit::WebProcessProxy::shouldDropNearSuspendedAssertionAfterDelay const):

Canonical link: https://commits.webkit.org/263975@main

Identifier: 263769.26 at safari-7616.1.14-branch


  Commit: b8444b0873477dfce05409bfe7359a5587a55626
      https://github.com/WebKit/WebKit/commit/b8444b0873477dfce05409bfe7359a5587a55626
  Author: Myah Cobbs <mcobbs at apple.com>
  Date:   2023-05-12 (Fri, 12 May 2023)

  Changed paths:
    M Configurations/Version.xcconfig

  Log Message:
  -----------
  Versioning.

Identifier: 263769.27 at safari-7616.1.14-branch


  Commit: 35ebdfa44671489f0f2e417e4ddc5e875450b342
      https://github.com/WebKit/WebKit/commit/35ebdfa44671489f0f2e417e4ddc5e875450b342
  Author: Myah Cobbs <mcobbs at apple.com>
  Date:   2023-05-12 (Fri, 12 May 2023)

  Changed paths:
    M Configurations/Version.xcconfig

  Log Message:
  -----------
  Versioning.

Identifier: 263769.28 at safari-7616.1.14-branch


Compare: https://github.com/WebKit/WebKit/compare/a2331ce0a56b%5E...35ebdfa44671


More information about the webkit-changes mailing list