Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2edaa071178a43a44dfaa4c37716247c43642c66
https://github.com/WebKit/WebKit/commit/2edaa071178a43a44dfaa4c37716247c43642c66
Author: Anne van Kesteren <[email protected]>
Date: 2026-10-09 (Fri, 09 Oct 2026)
Changed paths:
M Source/WTF/wtf/Ref.h
M Source/WTF/wtf/RefPtr.h
M Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
M Source/WebCore/Modules/websockets/WebSocket.cpp
M Source/WebCore/Modules/webxr/XRWebGLBinding.cpp
M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
M Source/WebCore/bindings/js/WebAssemblyCachedScriptSourceProvider.h
M Source/WebCore/css/CSSCounterStyleDescriptors.cpp
M Source/WebCore/css/typedom/CSSNumericValue.cpp
M Source/WebCore/editing/Editing.cpp
M Source/WebCore/html/OffscreenCanvas.cpp
M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
M Source/WebCore/html/track/WebVTTParser.cpp
M Source/WebCore/loader/cache/CachedFont.cpp
M Source/WebCore/page/EventHandler.cpp
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm
M
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
M Source/WebCore/platform/graphics/coordinated/GraphicsLayerCoordinated.cpp
M
Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp
M Source/WebCore/style/StyleExtractorCustom.h
M Source/WebCore/style/UserAgentStyle.cpp
M Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm
M
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
M Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp
Log Message:
-----------
Ref and RefPtr casts should return a smart pointer only for an rvalue
https://bugs.webkit.org/show_bug.cgi?id=326795
rdar://189503108
Reviewed by Ryosuke Niwa and Chris Dumez.
Since 267923@main, downcast(), dynamicDowncast() and uncheckedDowncast() take a
Ref or RefPtr by
value, so casting an lvalue copies it: a ref and a deref, even when the caller
already holds the
object. As WeakPtr and WeakRef do since 322963@main, return a raw pointer or
reference for an
lvalue, and move the reference into the returned Ref or RefPtr for an rvalue.
dynamicDowncast()
now leaves the source alone if the type does not match.
Most callers store the result in a Ref or RefPtr already. Where a Ref was cast,
use . instead of
->, and where a RefPtr was cast, drop the .get() or .releaseNonNull() that
followed. Spell auto*
where a local now holds a raw pointer. Where a function returned the raw
pointer with unsafeGet()
or unsafePtr(), call it on the argument instead. Keep a Ref or RefPtr where a
local or a call
relied on the copy for protection, in CachedFont, CSSNumericValue,
GraphicsLayerCoordinated,
SourceBufferPrivateAVFObjC, UserAgentStyle,
WebAssemblyCachedScriptSourceProvider, WebVTTParser,
and WKFileUploadPanel, and move the Ref in WebGLRenderingContextBase.
Test: Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp
Canonical link: https://commits.webkit.org/323226@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications