CSSPropertySourceData.h [plain text]
#ifndef CSSPropertySourceData_h
#define CSSPropertySourceData_h
#include <utility>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class StyleRuleBase;
struct SourceRange {
SourceRange();
SourceRange(unsigned start, unsigned end);
unsigned length() const;
unsigned start;
unsigned end;
};
struct CSSPropertySourceData {
CSSPropertySourceData(const String& name, const String& value, bool important, bool parsedOk, const SourceRange& range);
CSSPropertySourceData(const CSSPropertySourceData& other);
CSSPropertySourceData();
String toString() const;
unsigned hash() const;
String name;
String value;
bool important;
bool parsedOk;
SourceRange range;
};
struct CSSStyleSourceData : public RefCounted<CSSStyleSourceData> {
static PassRefPtr<CSSStyleSourceData> create()
{
return adoptRef(new CSSStyleSourceData());
}
Vector<CSSPropertySourceData> propertyData;
};
struct CSSRuleSourceData;
typedef Vector<RefPtr<CSSRuleSourceData> > RuleSourceDataList;
typedef Vector<SourceRange> SelectorRangeList;
struct CSSRuleSourceData : public RefCounted<CSSRuleSourceData> {
enum Type {
UNKNOWN_RULE,
STYLE_RULE,
CHARSET_RULE,
IMPORT_RULE,
MEDIA_RULE,
FONT_FACE_RULE,
PAGE_RULE,
KEYFRAMES_RULE,
REGION_RULE,
HOST_RULE,
VIEWPORT_RULE,
SUPPORTS_RULE,
#if ENABLE(CSS_SHADERS)
FILTER_RULE
#endif
};
static PassRefPtr<CSSRuleSourceData> create(Type type)
{
return adoptRef(new CSSRuleSourceData(type));
}
static PassRefPtr<CSSRuleSourceData> createUnknown()
{
return adoptRef(new CSSRuleSourceData(UNKNOWN_RULE));
}
CSSRuleSourceData(Type type)
: type(type)
{
if (type == STYLE_RULE || type == FONT_FACE_RULE || type == PAGE_RULE)
styleSourceData = CSSStyleSourceData::create();
}
Type type;
SourceRange ruleHeaderRange;
SourceRange ruleBodyRange;
SelectorRangeList selectorRanges;
RefPtr<CSSStyleSourceData> styleSourceData;
RuleSourceDataList childRules;
};
}
#endif // CSSPropertySourceData_h