TextTrackCueGeneric.h [plain text]
#pragma once
#if ENABLE(VIDEO_TRACK)
#include "Color.h"
#include "VTTCue.h"
namespace WebCore {
class GenericCueData;
class TextTrackCueGeneric final : public VTTCue {
public:
static Ref<TextTrackCueGeneric> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, const String& content)
{
return adoptRef(*new TextTrackCueGeneric(context, start, end, content));
}
ExceptionOr<void> setLine(double) final;
ExceptionOr<void> setPosition(double) final;
bool useDefaultPosition() const { return m_useDefaultPosition; }
double baseFontSizeRelativeToVideoHeight() const { return m_baseFontSizeRelativeToVideoHeight; }
void setBaseFontSizeRelativeToVideoHeight(double size) { m_baseFontSizeRelativeToVideoHeight = size; }
double fontSizeMultiplier() const { return m_fontSizeMultiplier; }
void setFontSizeMultiplier(double size) { m_fontSizeMultiplier = size; }
const String& fontName() const { return m_fontName; }
void setFontName(const String& name) { m_fontName = name; }
const Color& foregroundColor() const { return m_foregroundColor; }
void setForegroundColor(const Color& color) { m_foregroundColor = color; }
const Color& backgroundColor() const { return m_backgroundColor; }
void setBackgroundColor(const Color& color) { m_backgroundColor = color; }
const Color& highlightColor() const { return m_highlightColor; }
void setHighlightColor(const Color& color) { m_highlightColor = color; }
void setFontSize(int, const IntSize&, bool important) final;
String toJSONString() const;
private:
TextTrackCueGeneric(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, const String&);
bool isOrderedBefore(const TextTrackCue*) const final;
bool isPositionedAbove(const TextTrackCue*) const final;
Ref<VTTCueBox> createDisplayTree() final;
bool isEqual(const TextTrackCue&, CueMatchRules) const final;
bool cueContentsMatch(const TextTrackCue&) const final;
bool doesExtendCue(const TextTrackCue&) const final;
CueType cueType() const final { return Generic; }
Color m_foregroundColor;
Color m_backgroundColor;
Color m_highlightColor;
double m_baseFontSizeRelativeToVideoHeight { 0 };
double m_fontSizeMultiplier { 0 };
String m_fontName;
bool m_useDefaultPosition { true };
};
}
namespace WTF {
template<typename Type>
struct LogArgument;
template <>
struct LogArgument<WebCore::TextTrackCueGeneric> {
static String toString(const WebCore::TextTrackCueGeneric& cue)
{
return cue.toJSONString();
}
};
}
#endif