CSSPropertyParser.h [plain text]
#pragma once
#include "CSSParserTokenRange.h"
#include "StyleRule.h"
#include <wtf/text/StringView.h>
namespace WebCore {
class CSSProperty;
class CSSValue;
class StylePropertyShorthand;
class StyleSheetContents;
class CSSPropertyParser {
WTF_MAKE_NONCOPYABLE(CSSPropertyParser);
public:
static bool parseValue(CSSPropertyID, bool important,
const CSSParserTokenRange&, const CSSParserContext&,
Vector<CSSProperty, 256>&, StyleRule::Type);
static RefPtr<CSSValue> parseSingleValue(CSSPropertyID, const CSSParserTokenRange&, const CSSParserContext&);
private:
CSSPropertyParser(const CSSParserTokenRange&, const CSSParserContext&, Vector<CSSProperty, 256>*);
bool parseValueStart(CSSPropertyID, bool important);
bool consumeCSSWideKeyword(CSSPropertyID, bool important);
RefPtr<CSSValue> parseSingleValue(CSSPropertyID, CSSPropertyID = CSSPropertyInvalid);
bool inQuirksMode() const { return m_context.mode == HTMLQuirksMode; }
bool parseViewportDescriptor(CSSPropertyID propId, bool important);
bool parseFontFaceDescriptor(CSSPropertyID);
void addProperty(CSSPropertyID, CSSPropertyID, Ref<CSSValue>&&, bool important, bool implicit = false);
void addExpandedPropertyForValue(CSSPropertyID propId, Ref<CSSValue>&&, bool);
bool consumeBorder(bool important);
bool parseShorthand(CSSPropertyID, bool important);
bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important);
bool consume4Values(const StylePropertyShorthand&, bool important);
bool consumeAnimationShorthand(const StylePropertyShorthand&, bool important);
bool consumeBackgroundShorthand(const StylePropertyShorthand&, bool important);
bool consumeColumns(bool important);
bool consumeGridItemPositionShorthand(CSSPropertyID, bool important);
bool consumeGridTemplateRowsAndAreasAndColumns(CSSPropertyID, bool important);
bool consumeGridTemplateShorthand(CSSPropertyID, bool important);
bool consumeGridShorthand(bool important);
bool consumeGridAreaShorthand(bool important);
bool consumePlaceContentShorthand(bool important);
bool consumePlaceItemsShorthand(bool important);
bool consumePlaceSelfShorthand(bool important);
bool consumeFont(bool important);
bool consumeFontVariantShorthand(bool important);
bool consumeSystemFont(bool important);
bool consumeBorderSpacing(bool important);
bool consumeBorderImage(CSSPropertyID, bool important);
bool consumeFlex(bool important);
bool consumeLegacyBreakProperty(CSSPropertyID, bool important);
bool consumeTransformOrigin(bool important);
bool consumePerspectiveOrigin(bool important);
private:
CSSParserTokenRange m_range;
const CSSParserContext& m_context;
Vector<CSSProperty, 256>* m_parsedProperties;
};
CSSPropertyID cssPropertyID(StringView);
CSSValueID cssValueKeywordID(StringView);
bool isCustomPropertyName(const String&);
#if PLATFORM(IOS)
void cssPropertyNameIOSAliasing(const char* propertyName, const char*& propertyNameAlias, unsigned& newLength);
#endif
}