Skip to content

Commit

Permalink
REGRESSION: fix compilation if !ENABLE(VIDEO)
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271881

Reviewed by Mike Wyrzykowski.

[WebCore]: FullscreenManager: add missing include

HTMLMediaElement normally includes HTMLMediaElementEnums,
but only if VIDEO is enabled.

[WebCore]: FullscreenManager: fix undefined reference to HTMLMediaElement

HTMLMediaElement is not compiled if VIDEO is not enabled.

[WebCore]: css: fix fix undefined reference to HTMLMediaElement

HTMLMediaElement is not compiled if VIDEO is not enabled.

[WebCore]: InspectorDOMAgent: fix fix undefined reference to HTMLMediaElement

HTMLMediaElement is not compiled if VIDEO is not enabled.

[WebKit]: WebGPU: drop duplicate directive in RemoteDevice

The #if PLATFORM(COCOA) && ENABLE(VIDEO) directive is already defined
outside the function scope, so drop the inner ones.

[WebCore]: GPUDevice: fix undefined reference to HTMLMediaElement

HTMLMediaElement is not compiled if VIDEO is not enabled.

[WebKit]: WebFullScreenManagerProxy: add missing include

HTMLMediaElement normally includes HTMLMediaElementEnums,
but only if VIDEO is enabled.

[WebKit]: WebFullScreenManager: add missing include

HTMLMediaElement normally includes HTMLMediaElementEnums,
but only if VIDEO is enabled.

[WebKit]: InjectedBundlePageFullScreenClient: add missing include

HTMLMediaElement normally includes HTMLMediaElementEnums,
but only if VIDEO is enabled.

[WebKit]: WebCoreArgumentCoders.serialization.in: fix undefined reference

CaptionUserPreferencesDisplayMode and SerializedPlatformDataCueValue
are only compiled if VIDEO is enabled.

Signed-off-by: Thomas Devoogdt <[email protected]>
Canonical link: https://commits.webkit.org/276977@main
  • Loading branch information
ThomasDevoogdt authored and mcatanzaro committed Apr 2, 2024
1 parent c514a13 commit ea2be40
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Source/WebCore/Modules/WebGPU/GPUDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ ExceptionOr<Ref<GPUSampler>> GPUDevice::createSampler(const std::optional<GPUSam
return GPUSampler::create(sampler.releaseNonNull());
}

#if ENABLE(VIDEO)
GPUExternalTexture* GPUDevice::externalTextureForDescriptor(const GPUExternalTextureDescriptor& descriptor)
{
m_videoElementToExternalTextureMap.removeNullReferences();
Expand Down Expand Up @@ -333,9 +334,11 @@ class GPUDeviceVideoFrameRequestCallback final : public VideoFrameRequestCallbac
WeakPtr<HTMLVideoElement> m_videoElement;
WeakPtr<GPUDevice, WeakPtrImplWithEventTargetData> m_gpuDevice;
};
#endif

ExceptionOr<Ref<GPUExternalTexture>> GPUDevice::importExternalTexture(const GPUExternalTextureDescriptor& externalTextureDescriptor)
{
#if ENABLE(VIDEO)
if (RefPtr externalTexture = externalTextureForDescriptor(externalTextureDescriptor)) {
externalTexture->undestroy();
#if ENABLE(WEB_CODECS)
Expand All @@ -346,6 +349,7 @@ ExceptionOr<Ref<GPUExternalTexture>> GPUDevice::importExternalTexture(const GPUE
m_videoElementToExternalTextureMap.remove(*videoElement.get());
return externalTexture.releaseNonNull();
}
#endif
RefPtr texture = m_backing->importExternalTexture(externalTextureDescriptor.convertToBacking());
if (!texture)
return Exception { ExceptionCode::InvalidStateError, "GPUDevice.importExternalTexture: Unable to import texture."_s };
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/Modules/WebGPU/GPUDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ class GPUDevice : public RefCounted<GPUDevice>, public ActiveDOMObject, public E
Ref<GPUQueue> m_queue;
RefPtr<GPUPipelineLayout> m_autoPipelineLayout;
WeakHashSet<GPUBuffer> m_buffersToUnmap;

#if ENABLE(VIDEO)
GPUExternalTexture* externalTextureForDescriptor(const GPUExternalTextureDescriptor&);
#endif

WeakHashMap<HTMLVideoElement, WeakPtr<GPUExternalTexture>> m_videoElementToExternalTextureMap;
bool m_waitingForDeviceLostPromise { false };
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/css/SelectorChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,9 +1075,11 @@ bool SelectorChecker::checkOne(CheckingContext& checkingContext, const LocalCont
return matchesAnimatingFullscreenTransitionPseudoClass(element);
case CSSSelector::PseudoClass::InternalFullscreenDocument:
return matchesFullscreenDocumentPseudoClass(element);
#if ENABLE(VIDEO)
case CSSSelector::PseudoClass::InternalInWindowFullScreen:
return matchesInWindowFullScreenPseudoClass(element);
#endif
#endif
#if ENABLE(PICTURE_IN_PICTURE_API)
case CSSSelector::PseudoClass::PictureInPicture:
return matchesPictureInPicturePseudoClass(element);
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/css/SelectorCheckerTestFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ ALWAYS_INLINE bool matchesFullscreenDocumentPseudoClass(const Element& element)
return fullscreenManager && fullscreenManager->fullscreenElement();
}

#if ENABLE(VIDEO)
ALWAYS_INLINE bool matchesInWindowFullScreenPseudoClass(const Element& element)
{
if (&element != element.document().fullscreenManager().currentFullscreenElement())
Expand All @@ -436,6 +437,7 @@ ALWAYS_INLINE bool matchesInWindowFullScreenPseudoClass(const Element& element)
auto* mediaElement = dynamicDowncast<HTMLMediaElement>(element);
return mediaElement && mediaElement->fullscreenMode() == HTMLMediaElementEnums::VideoFullscreenModeInWindow;
}
#endif

#endif

Expand Down
8 changes: 8 additions & 0 deletions Source/WebCore/cssjit/SelectorCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesLangPseudo
static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesFullscreenPseudoClass, bool, (const Element&));
static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesFullscreenDocumentPseudoClass, bool, (const Element&));
static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesAnimatingFullscreenTransitionPseudoClass, bool, (const Element&));
#if ENABLE(VIDEO)
static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesInWindowFullScreenPseudoClass, bool, (const Element&));
#endif
#endif
#if ENABLE(PICTURE_IN_PICTURE_API)
static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesPictureInPicturePseudoClass, bool, (const Element&));
#endif
Expand Down Expand Up @@ -909,13 +911,17 @@ JSC_DEFINE_JIT_OPERATION(operationMatchesAnimatingFullscreenTransitionPseudoClas
COUNT_SELECTOR_OPERATION(operationMatchesAnimatingFullscreenTransitionPseudoClass);
return matchesAnimatingFullscreenTransitionPseudoClass(element);
}

#if ENABLE(VIDEO)
JSC_DEFINE_JIT_OPERATION(operationMatchesInWindowFullScreenPseudoClass, bool, (const Element& element))
{
COUNT_SELECTOR_OPERATION(operationMatchesInWindowFullScreenPseudoClass);
return matchesInWindowFullScreenPseudoClass(element);
}
#endif

#endif

#if ENABLE(PICTURE_IN_PICTURE_API)
JSC_DEFINE_JIT_OPERATION(operationMatchesPictureInPicturePseudoClass, bool, (const Element& element))
{
Expand Down Expand Up @@ -1112,10 +1118,12 @@ static inline FunctionType addPseudoClassType(const CSSSelector& selector, Selec
case CSSSelector::PseudoClass::InternalAnimatingFullscreenTransition:
fragment.unoptimizedPseudoClasses.append(CodePtr<JSC::OperationPtrTag>(operationMatchesAnimatingFullscreenTransitionPseudoClass));
return FunctionType::SimpleSelectorChecker;
#if ENABLE(VIDEO)
case CSSSelector::PseudoClass::InternalInWindowFullScreen:
fragment.unoptimizedPseudoClasses.append(CodePtr<JSC::OperationPtrTag>(operationMatchesInWindowFullScreenPseudoClass));
return FunctionType::SimpleSelectorChecker;
#endif
#endif

#if ENABLE(PICTURE_IN_PICTURE_API)
case CSSSelector::PseudoClass::PictureInPicture:
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/dom/FullscreenManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,11 @@ bool FullscreenManager::willEnterFullscreen(Element& element, HTMLMediaElementEn
INFO_LOG(LOGIDENTIFIER);
ASSERT(page()->settings().fullScreenEnabled());

#if ENABLE(VIDEO)
if (RefPtr mediaElement = dynamicDowncast<HTMLMediaElement>(element))
mediaElement->willBecomeFullscreenElement(mode);
else
#endif
element.willBecomeFullscreenElement();

ASSERT(&element == m_pendingFullscreenElement);
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/dom/FullscreenManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "FrameDestructionObserverInlines.h"
#include "GCReachableRef.h"
#include "HTMLMediaElement.h"
#include "HTMLMediaElementEnums.h"
#include "LayoutRect.h"
#include "Page.h"
#include <wtf/Deque.h>
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3100,6 +3100,7 @@ Inspector::Protocol::ErrorStringOr<void> InspectorDOMAgent::setAllowEditingUserA

Inspector::Protocol::ErrorStringOr<Ref<Inspector::Protocol::DOM::MediaStats>> InspectorDOMAgent::getMediaStats(Inspector::Protocol::DOM::NodeId nodeId)
{
#if ENABLE(VIDEO)
Inspector::Protocol::ErrorString errorString;

auto* element = assertElement(errorString, nodeId);
Expand Down Expand Up @@ -3176,6 +3177,10 @@ Inspector::Protocol::ErrorStringOr<Ref<Inspector::Protocol::DOM::MediaStats>> In
}

return stats;
#else
UNUSED_PARAM(nodeId);
return makeUnexpected("no media support"_s);
#endif
}

} // namespace WebCore
4 changes: 0 additions & 4 deletions Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ void RemoteDevice::setSharedVideoFrameMemory(WebCore::SharedMemory::Handle&& han
#if PLATFORM(COCOA) && ENABLE(VIDEO)
void RemoteDevice::importExternalTextureFromVideoFrame(const WebGPU::ExternalTextureDescriptor& descriptor, WebGPUIdentifier identifier)
{
#if PLATFORM(COCOA) && ENABLE(VIDEO)
std::optional<WebKit::SharedVideoFrame> sharedVideoFrame = descriptor.sharedFrame;
RetainPtr<CVPixelBufferRef> pixelBuffer { nullptr };
if (sharedVideoFrame) {
Expand All @@ -193,9 +192,6 @@ void RemoteDevice::importExternalTextureFromVideoFrame(const WebGPU::ExternalTex
RELEASE_ASSERT(externalTexture);
auto remoteExternalTexture = RemoteExternalTexture::create(*externalTexture, m_objectHeap, m_streamConnection.copyRef(), identifier);
m_objectHeap->addObject(identifier, remoteExternalTexture);
#else
UNUSED_PARAM(identifier);
#endif
}
#endif // PLATFORM(COCOA) && ENABLE(VIDEO)

Expand Down
4 changes: 4 additions & 0 deletions Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Original file line number Diff line number Diff line change
Expand Up @@ -7265,13 +7265,15 @@ header: <WebCore/Font.h>
[Nested] enum class WebCore::FontVisibility : bool;
[Nested] enum class WebCore::FontIsOrientationFallback : bool;

#if ENABLE(VIDEO)
header: <WebCore/CaptionUserPreferences.h>
enum class WebCore::CaptionUserPreferencesDisplayMode : uint8_t {
Automatic,
ForcedOnly,
AlwaysOn,
Manual,
};
#endif

header: <WebCore/InspectorClient.h>
enum class WebCore::InspectorClientDeveloperPreference : uint8_t {
Expand Down Expand Up @@ -7918,6 +7920,7 @@ header: <WebCore/FilterFunction.h>
SourceGraphic
};

#if ENABLE(VIDEO)
class WebCore::SerializedPlatformDataCueValue {
std::optional<WebCore::SerializedPlatformDataCueValue::Data> data()
}
Expand All @@ -7930,6 +7933,7 @@ class WebCore::SerializedPlatformDataCueValue {
RetainPtr<NSLocale> locale;
std::variant<std::nullptr_t, RetainPtr<NSString>, RetainPtr<NSDate>, RetainPtr<NSNumber>, RetainPtr<NSData>> value;
#endif
#endif
};

header: <WebCore/SharedBuffer.h>
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/WebFullScreenManagerProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "FullScreenMediaDetails.h"
#include "MessageReceiver.h"
#include <WebCore/HTMLMediaElement.h>
#include <WebCore/HTMLMediaElementEnums.h>
#include <wtf/CompletionHandler.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "WebCoreArgumentCoders.h"
#include <WebCore/EventListener.h>
#include <WebCore/HTMLMediaElement.h>
#include <WebCore/HTMLMediaElementEnums.h>
#include <WebCore/IntRect.h>
#include <WebCore/LengthBox.h>
#include <wtf/RefCounted.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "FullScreenMediaDetails.h"
#include "WKBundlePageFullScreenClient.h"
#include <WebCore/HTMLMediaElement.h>
#include <WebCore/HTMLMediaElementEnums.h>
#include <WebCore/MediaPlayerEnums.h>
#include <wtf/Forward.h>

Expand Down

0 comments on commit ea2be40

Please sign in to comment.