MediaControlTextTrackContainerElement.h [plain text]
#pragma once
#if ENABLE(VIDEO)
#include "GenericTaskQueue.h"
#include "HTMLDivElement.h"
#include "MediaControllerInterface.h"
#include "TextTrackRepresentation.h"
#include <wtf/LoggerHelper.h>
#include <wtf/WeakPtr.h>
namespace WebCore {
class HTMLMediaElement;
class VTTCue;
class MediaControlTextTrackContainerElement final
: public HTMLDivElement
, public TextTrackRepresentationClient
#if !RELEASE_LOG_DISABLED
, private LoggerHelper
#endif
{
WTF_MAKE_ISO_ALLOCATED(MediaControlTextTrackContainerElement);
public:
static Ref<MediaControlTextTrackContainerElement> create(Document&, HTMLMediaElement&);
enum class ForceUpdate { Yes, No };
void updateSizes(ForceUpdate force = ForceUpdate::No);
void updateDisplay();
void updateTextTrackRepresentationImageIfNeeded();
void enteredFullscreen();
void exitedFullscreen();
private:
explicit MediaControlTextTrackContainerElement(Document&, HTMLMediaElement&);
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
RefPtr<Image> createTextTrackRepresentationImage() override;
void textTrackRepresentationBoundsChanged(const IntRect&) override;
void updateTextTrackRepresentationIfNeeded();
void clearTextTrackRepresentation();
bool updateVideoDisplaySize();
void updateActiveCuesFontSize();
void updateTextStrokeStyle();
void processActiveVTTCue(VTTCue&);
void updateTextTrackStyle();
void hide();
void show();
bool isShowing() const;
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final;
const void* logIdentifier() const final;
WTFLogChannel& logChannel() const final;
const char* logClassName() const final { return "MediaControlTextTrackContainerElement"; }
mutable RefPtr<Logger> m_logger;
mutable const void* m_logIdentifier { nullptr };
#endif
std::unique_ptr<TextTrackRepresentation> m_textTrackRepresentation;
GenericTaskQueue<Timer> m_taskQueue;
WeakPtr<HTMLMediaElement> m_mediaElement;
IntRect m_videoDisplaySize;
int m_fontSize { 0 };
bool m_fontSizeIsImportant { false };
bool m_needsGenerateTextTrackRepresentation { false };
};
}
#endif // ENABLE(VIDEO)