StyleSupportedColorSchemes.h [plain text]
#pragma once
#if ENABLE(DARK_MODE_CSS)
#include "RenderStyleConstants.h"
#include <wtf/OptionSet.h>
namespace WebCore {
class StyleSupportedColorSchemes {
public:
StyleSupportedColorSchemes() { }
StyleSupportedColorSchemes(const StyleSupportedColorSchemes& other)
: m_colorSchemes(other.m_colorSchemes)
, m_allowsTransformations(other.m_allowsTransformations)
{ }
StyleSupportedColorSchemes(OptionSet<ColorSchemes> colorSchemes, bool allowsTransformations)
: m_colorSchemes(colorSchemes)
, m_allowsTransformations(allowsTransformations)
{ }
bool operator==(const StyleSupportedColorSchemes& other) const
{
return m_colorSchemes == other.m_colorSchemes && m_allowsTransformations == other.m_allowsTransformations;
}
bool operator!=(const StyleSupportedColorSchemes& other) const { return !(*this == other); }
bool isAuto() const { return m_colorSchemes.isEmpty() && m_allowsTransformations; }
bool isOnly() const { return m_colorSchemes.isEmpty() && !m_allowsTransformations; }
OptionSet<ColorSchemes> colorSchemes() const { return m_colorSchemes; }
void add(ColorSchemes colorScheme) { m_colorSchemes.add(colorScheme); }
bool contains(ColorSchemes colorScheme) const { return m_colorSchemes.contains(colorScheme); }
void setAllowsTransformations(bool allow) { m_allowsTransformations = allow; }
bool allowsTransformations() const { return m_allowsTransformations; }
private:
OptionSet<ColorSchemes> m_colorSchemes;
bool m_allowsTransformations { true };
};
}
#endif // ENABLE(DARK_MODE_CSS)