Skip to content
Permalink
Browse files
Build fails when video is disabled
https://bugs.webkit.org/show_bug.cgi?id=224198

Patch by Mike Gorse <mgorse@suse.com> on 2021-04-06
Reviewed by Adrian Perez de Castro.

Add #if ENABLE(VIDEO) where needed.

Source/WebCore:

* editing/markup.cpp:
(WebCore::createPageForSanitizingWebContent):
* page/Page.cpp:
* page/Page.h:
* platform/graphics/GraphicsContext.cpp:
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/DisplayListRecorder.cpp:
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/win/GraphicsContextImplDirect2D.cpp:
* platform/graphics/win/GraphicsContextImplDirect2D.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Source/WebKit:

* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
* UIProcess/gtk/ClipboardGtk3.cpp:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::committedLoad):

Canonical link: https://commits.webkit.org/236212@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275557 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mgorse authored and webkit-commit-queue committed Apr 6, 2021
1 parent 5ea7873 commit b0f81a2e4eb60be4874dc02a96baf1b4bb8fef32
Show file tree
Hide file tree
Showing 30 changed files with 129 additions and 2 deletions.
@@ -1,3 +1,47 @@
2021-04-06 Mike Gorse <mgorse@suse.com>

Build fails when video is disabled
https://bugs.webkit.org/show_bug.cgi?id=224198

Reviewed by Adrian Perez de Castro.

Add #if ENABLE(VIDEO) where needed.

* editing/markup.cpp:
(WebCore::createPageForSanitizingWebContent):
* page/Page.cpp:
* page/Page.h:
* platform/graphics/GraphicsContext.cpp:
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
* platform/graphics/cairo/GraphicsContextImplCairo.h:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/DisplayListRecorder.cpp:
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/win/GraphicsContextImplDirect2D.cpp:
* platform/graphics/win/GraphicsContextImplDirect2D.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

2021-04-06 Philippe Normand <pnormand@igalia.com>

REGRESSION(r275275): Broke some build configs lacking openh264
@@ -183,7 +183,9 @@ std::unique_ptr<Page> createPageForSanitizingWebContent()
auto pageConfiguration = pageConfigurationWithEmptyClients(PAL::SessionID::defaultSessionID());

auto page = makeUnique<Page>(WTFMove(pageConfiguration));
#if ENABLE(VIDEO)
page->settings().setMediaEnabled(false);
#endif
page->settings().setScriptEnabled(false);
page->settings().setHTMLParserScriptingFlagPolicy(HTMLParserScriptingFlagPolicy::Enabled);
page->settings().setPluginsEnabled(false);
@@ -2141,13 +2141,13 @@ void Page::playbackControlsManagerUpdateTimerFired()
chrome().client().clearPlaybackControlsManager();
}

#endif

void Page::playbackControlsMediaEngineChanged()
{
chrome().client().playbackControlsMediaEngineChanged();
}

#endif

void Page::setMuted(MediaProducer::MutedStateFlags muted)
{
if (m_mutedState == muted)
@@ -701,7 +701,9 @@ class Page : public Supplementable<Page>, public CanMakeWeakPtr<Page> {
bool isAudioMuted() const { return m_mutedState & MediaProducer::AudioIsMuted; }
bool isMediaCaptureMuted() const { return m_mutedState & MediaProducer::MediaStreamCaptureIsMuted; };
void schedulePlaybackControlsManagerUpdate();
#if ENABLE(VIDEO)
void playbackControlsMediaEngineChanged();
#endif
WEBCORE_EXPORT void setMuted(MediaProducer::MutedStateFlags);

WEBCORE_EXPORT void stopMediaCapture(MediaProducer::MediaCaptureKind);
@@ -1300,6 +1300,7 @@ void GraphicsContext::addDestinationAtPoint(const String&, const FloatPoint&)

#endif

#if ENABLE(VIDEO)
void GraphicsContext::paintFrameForMedia(MediaPlayer& player, const FloatRect& destination)
{
if (paintingDisabled())
@@ -1312,5 +1313,6 @@ void GraphicsContext::paintFrameForMedia(MediaPlayer& player, const FloatRect& d

player.playerPrivate()->paintCurrentFrameInContext(*this, destination);
}
#endif

}
@@ -516,7 +516,9 @@ class GraphicsContext {
void setContentfulPaintDetected() { m_contenfulPaintDetected = true; }
bool contenfulPaintDetected() const { return m_contenfulPaintDetected; }

#if ENABLE(VIDEO)
WEBCORE_EXPORT void paintFrameForMedia(MediaPlayer&, const FloatRect& destination);
#endif

#if OS(WINDOWS)
HDC getWindowsContext(const IntRect&, bool supportAlphaBlend); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
@@ -1311,7 +1311,9 @@ class GraphicsContextGL : public RefCounted<GraphicsContextGL> {
// Returns interface for CV interaction if the functionality is present.
virtual GraphicsContextGLCV* asCV() = 0;
#endif
#if ENABLE(VIDEO)
virtual bool copyTextureFromMedia(MediaPlayer&, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) = 0;
#endif

IntSize getInternalFramebufferSize() const { return IntSize(m_currentWidth, m_currentHeight); }

@@ -105,8 +105,10 @@ class GraphicsContextImpl {
virtual IntRect clipBounds() = 0;
virtual void clipToImageBuffer(ImageBuffer&, const FloatRect&) = 0;
virtual void clipToDrawingCommands(const FloatRect& destination, DestinationColorSpace, Function<void(GraphicsContext&)>&& drawingFunction) = 0;
#if ENABLE(VIDEO)
virtual void paintFrameForMedia(MediaPlayer&, const FloatRect& destination) = 0;
virtual bool canPaintFrameForMedia(const MediaPlayer&) const = 0;
#endif

virtual void applyDeviceScaleFactor(float) = 0;

@@ -419,10 +419,12 @@ void GraphicsContextImplCairo::clipToDrawingCommands(const FloatRect&, Destinati
// FIXME: Not implemented.
}

#if ENABLE(VIDEO)
void GraphicsContextImplCairo::paintFrameForMedia(MediaPlayer&, const FloatRect&)
{
// FIXME: Not implemented.
}
#endif

} // namespace WebCore

@@ -105,8 +105,10 @@ class GraphicsContextImplCairo final : public GraphicsContextImpl {
IntRect clipBounds() override;
void clipToImageBuffer(ImageBuffer&, const FloatRect&) override;
void clipToDrawingCommands(const FloatRect& destination, DestinationColorSpace, Function<void(GraphicsContext&)>&&) override;
#if ENABLE(VIDEO)
void paintFrameForMedia(MediaPlayer&, const FloatRect& destination) override;
bool canPaintFrameForMedia(const MediaPlayer&) const override { return false; }
#endif

void applyDeviceScaleFactor(float) override;

@@ -291,8 +291,10 @@ void DisplayList::append(ItemHandle item)
return append<GetImageData>(item.get<GetImageData>());
case ItemType::PutImageData:
return append<PutImageData>(item.get<PutImageData>());
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
return append<PaintFrameForMedia>(item.get<PaintFrameForMedia>());
#endif
case ItemType::StrokeRect:
return append<StrokeRect>(item.get<StrokeRect>());
case ItemType::StrokeLine:
@@ -192,9 +192,11 @@ void ItemHandle::apply(GraphicsContext& context)
// Should already be handled by the delegate.
ASSERT_NOT_REACHED();
return;
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
get<PaintFrameForMedia>().apply(context);
return;
#endif
case ItemType::StrokeRect:
get<StrokeRect>().apply(context);
return;
@@ -374,9 +376,11 @@ void ItemHandle::destroy()
case ItemType::MetaCommandChangeItemBuffer:
static_assert(std::is_trivially_destructible<MetaCommandChangeItemBuffer>::value);
return;
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
static_assert(std::is_trivially_destructible<PaintFrameForMedia>::value);
return;
#endif
case ItemType::Restore:
static_assert(std::is_trivially_destructible<Restore>::value);
return;
@@ -548,8 +552,10 @@ bool ItemHandle::safeCopy(ItemHandle destination) const
return copyInto<MetaCommandChangeDestinationImageBuffer>(*this, itemOffset);
case ItemType::MetaCommandChangeItemBuffer:
return copyInto<MetaCommandChangeItemBuffer>(*this, itemOffset);
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
return copyInto<PaintFrameForMedia>(*this, itemOffset);
#endif
case ItemType::Restore:
return copyInto<Restore>(*this, itemOffset);
case ItemType::Rotate:
@@ -136,8 +136,10 @@ static size_t sizeOfItemInBytes(ItemType type)
return sizeof(GetImageData);
case ItemType::PutImageData:
return sizeof(PutImageData);
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
return sizeof(PaintFrameForMedia);
#endif
case ItemType::StrokeRect:
return sizeof(StrokeRect);
case ItemType::StrokeLine:
@@ -235,7 +237,9 @@ bool isDrawingItem(ItemType type)
case ItemType::FillRectWithGradient:
case ItemType::FillRectWithRoundedHole:
case ItemType::FillRoundedRect:
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
#endif
case ItemType::PutImageData:
case ItemType::StrokeEllipse:
#if ENABLE(INLINE_PATH_DATA)
@@ -310,7 +314,9 @@ bool isInlineItem(ItemType type)
case ItemType::FlushContext:
case ItemType::MetaCommandChangeDestinationImageBuffer:
case ItemType::MetaCommandChangeItemBuffer:
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
#endif
case ItemType::Restore:
case ItemType::Rotate:
case ItemType::Save:
@@ -81,7 +81,9 @@ enum class ItemType : uint8_t {
MetaCommandChangeItemBuffer,
GetImageData,
PutImageData,
#if ENABLE(VIDEO)
PaintFrameForMedia,
#endif
StrokeRect,
StrokeLine,
#if ENABLE(INLINE_PATH_DATA)
@@ -804,6 +804,7 @@ static TextStream& operator<<(TextStream& ts, const PutImageData& item)
return ts;
}

#if ENABLE(VIDEO)
PaintFrameForMedia::PaintFrameForMedia(MediaPlayer& player, const FloatRect& destination)
: m_identifier(player.identifier())
, m_destination(destination)
@@ -821,6 +822,7 @@ static TextStream& operator<<(TextStream& ts, const PaintFrameForMedia& item)
ts.dumpProperty("destination", item.destination());
return ts;
}
#endif

Optional<FloatRect> StrokeRect::localBounds(const GraphicsContext&) const
{
@@ -1064,7 +1066,9 @@ static TextStream& operator<<(TextStream& ts, ItemType type)
case ItemType::MetaCommandChangeItemBuffer: ts << "meta-command-change-item-buffer"; break;
case ItemType::GetImageData: ts << "get-image-data"; break;
case ItemType::PutImageData: ts << "put-image-data"; break;
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia: ts << "paint-frame-for-media"; break;
#endif
case ItemType::StrokeRect: ts << "stroke-rect"; break;
case ItemType::StrokeLine: ts << "stroke-line"; break;
#if ENABLE(INLINE_PATH_DATA)
@@ -1233,9 +1237,11 @@ TextStream& operator<<(TextStream& ts, ItemHandle item)
case ItemType::PutImageData:
ts << item.get<PutImageData>();
break;
#if ENABLE(VIDEO)
case ItemType::PaintFrameForMedia:
ts << item.get<PaintFrameForMedia>();
break;
#endif
case ItemType::StrokeRect:
ts << item.get<StrokeRect>();
break;
@@ -1985,6 +1985,7 @@ Optional<PutImageData> PutImageData::decode(Decoder& decoder)
return {{ *inputFormat, WTFMove(*imageData), *srcRect, *destPoint, *destFormat }};
}

#if ENABLE(VIDEO)
class PaintFrameForMedia {
public:
static constexpr ItemType itemType = ItemType::PaintFrameForMedia;
@@ -2007,6 +2008,7 @@ class PaintFrameForMedia {
MediaPlayerIdentifier m_identifier;
FloatRect m_destination;
};
#endif

class StrokeRect {
public:
@@ -2336,7 +2338,9 @@ template<> struct EnumTraits<WebCore::DisplayList::ItemType> {
WebCore::DisplayList::ItemType::MetaCommandChangeItemBuffer,
WebCore::DisplayList::ItemType::GetImageData,
WebCore::DisplayList::ItemType::PutImageData,
#if ENABLE(VIDEO)
WebCore::DisplayList::ItemType::PaintFrameForMedia,
#endif
WebCore::DisplayList::ItemType::StrokeRect,
WebCore::DisplayList::ItemType::StrokeLine,
#if ENABLE(INLINE_PATH_DATA)
@@ -458,6 +458,7 @@ void Recorder::clipToDrawingCommands(const FloatRect& destination, DestinationCo
append<EndClipToDrawingCommands>(destination);
}

#if ENABLE(VIDEO)
bool Recorder::canPaintFrameForMedia(const MediaPlayer& player) const
{
return !!player.identifier();
@@ -468,6 +469,7 @@ void Recorder::paintFrameForMedia(MediaPlayer& player, const FloatRect& destinat
ASSERT(player.identifier());
append<PaintFrameForMedia>(player, destination);
}
#endif

void Recorder::applyDeviceScaleFactor(float deviceScaleFactor)
{
@@ -145,8 +145,10 @@ class Recorder : public GraphicsContextImpl {
IntRect clipBounds() override;
void clipToImageBuffer(WebCore::ImageBuffer&, const FloatRect&) override;
void clipToDrawingCommands(const FloatRect& destination, DestinationColorSpace, Function<void(GraphicsContext&)>&&) override;
#if ENABLE(VIDEO)
void paintFrameForMedia(MediaPlayer&, const FloatRect& destination) override;
bool canPaintFrameForMedia(const MediaPlayer&) const override;
#endif

void applyDeviceScaleFactor(float) override;

@@ -1081,9 +1081,11 @@ void CairoOperationRecorder::clipToDrawingCommands(const FloatRect&, Destination
// FIXME: Not implemented.
}

#if ENABLE(VIDEO)
void CairoOperationRecorder::paintFrameForMedia(MediaPlayer&, const FloatRect&)
{
// FIXME: Not implemented.
}
#endif

} // namespace Nicosia
@@ -98,8 +98,10 @@ class CairoOperationRecorder final : public WebCore::GraphicsContextImpl {
WebCore::IntRect clipBounds() override;
void clipToImageBuffer(WebCore::ImageBuffer&, const WebCore::FloatRect&) override;
void clipToDrawingCommands(const WebCore::FloatRect& destination, WebCore::DestinationColorSpace, Function<void(WebCore::GraphicsContext&)>&&) override;
#if ENABLE(VIDEO)
void paintFrameForMedia(WebCore::MediaPlayer&, const WebCore::FloatRect& destination) override;
bool canPaintFrameForMedia(const WebCore::MediaPlayer&) const override { return false; }
#endif

void applyDeviceScaleFactor(float) override;

@@ -260,6 +260,7 @@ RefPtr<ImageData> GraphicsContextGLOpenGL::readCompositedResults()
}
#endif

#if ENABLE(VIDEO)
bool GraphicsContextGLOpenGL::copyTextureFromMedia(MediaPlayer& player, PlatformGLObject outputTexture, GCGLenum outputTarget, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY)
{
#if USE(AVFOUNDATION)
@@ -278,6 +279,7 @@ bool GraphicsContextGLOpenGL::copyTextureFromMedia(MediaPlayer& player, Platform
return player.copyVideoTextureToPlatformTexture(this, outputTexture, outputTarget, level, internalFormat, format, type, premultiplyAlpha, flipY);
#endif
}
#endif

} // namespace WebCore

@@ -470,7 +470,9 @@ class WEBCORE_EXPORT GraphicsContextGLOpenGL final : public GraphicsContextGL
RefPtr<ImageData> readRenderingResultsForPainting();
RefPtr<ImageData> readCompositedResultsForPainting();

#if ENABLE(VIDEO)
bool copyTextureFromMedia(MediaPlayer&, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) final;
#endif

#if USE(OPENGL) && ENABLE(WEBGL2)
void primitiveRestartIndex(GCGLuint);
@@ -425,10 +425,12 @@ void GraphicsContextImplDirect2D::clipToDrawingCommands(const FloatRect&, Destin
// FIXME: Not implemented.
}

#if ENABLE(VIDEO)
void GraphicsContextImplDirect2D::paintFrameForMedia(MediaPlayer&, const FloatRect&)
{
// FIXME: Not implemented.
}
#endif

} // namespace WebCore

0 comments on commit b0f81a2

Please sign in to comment.