Dillo v3.1.1-111-gd4f56d0d
|
#include <cssparser.hh>
Static Public Member Functions | |
static void | parseDeclarationBlock (const DilloUrl *baseUrl, const char *buf, int buflen, CssPropertyList *props, CssPropertyList *propsImortant) |
static void | parse (DilloHtml *html, const DilloUrl *baseUrl, CssContext *context, const char *buf, int buflen, CssOrigin origin) |
static const char * | propertyNameString (CssPropertyName name) |
Private Types | |
enum | CssTokenType { CSS_TK_DECINT , CSS_TK_FLOAT , CSS_TK_COLOR , CSS_TK_SYMBOL , CSS_TK_STRING , CSS_TK_CHAR , CSS_TK_END } |
Private Member Functions | |
CssParser (CssContext *context, CssOrigin origin, const DilloUrl *baseUrl, const char *buf, int buflen) | |
int | getChar () |
Gets the next character from the buffer, or EOF. | |
void | ungetChar () |
Undoes the last getChar(). | |
void | nextToken () |
bool | skipString (int c, const char *string) |
Skip string str if it is found in the input buffer. | |
bool | tokenMatchesProperty (CssPropertyName prop, CssValueType *type) |
bool | parseValue (CssPropertyName prop, CssValueType type, CssPropertyValue *val) |
bool | parseWeight () |
bool | parseRgbColorComponent (int32_t *cc, int *percentage) |
bool | parseRgbColor (int32_t *c) |
void | parseDeclaration (CssPropertyList *props, CssPropertyList *importantProps) |
bool | parseSimpleSelector (CssSimpleSelector *selector) |
char * | parseUrl () |
void | parseImport (DilloHtml *html) |
void | parseMedia () |
CssSelector * | parseSelector () |
void | parseRuleset () |
void | ignoreBlock () |
void | ignoreStatement () |
Private Attributes | |
CssContext * | context |
CssOrigin | origin |
const DilloUrl * | baseUrl |
const char * | buf |
int | buflen |
int | bufptr |
CssTokenType | ttype |
char | tval [maxStrLen] |
bool | withinBlock |
bool | spaceSeparated |
Static Private Attributes | |
static const int | maxStrLen = 256 |
Definition at line 8 of file cssparser.hh.
|
private |
Enumerator | |
---|---|
CSS_TK_DECINT | |
CSS_TK_FLOAT | |
CSS_TK_COLOR | |
CSS_TK_SYMBOL | |
CSS_TK_STRING | |
CSS_TK_CHAR | |
CSS_TK_END |
Definition at line 10 of file cssparser.hh.
|
private |
Definition at line 458 of file cssparser.cc.
References baseUrl, buf, buflen, bufptr, context, nextToken(), origin, spaceSeparated, and withinBlock.
|
private |
Gets the next character from the buffer, or EOF.
Definition at line 477 of file cssparser.cc.
References buf, buflen, and bufptr.
Referenced by nextToken(), and skipString().
|
private |
Definition at line 1734 of file cssparser.cc.
References CSS_TK_CHAR, CSS_TK_END, nextToken(), ttype, and tval.
Referenced by ignoreStatement(), and parseMedia().
|
private |
Definition at line 1754 of file cssparser.cc.
References CSS_TK_CHAR, CSS_TK_END, ignoreBlock(), nextToken(), ttype, and tval.
Referenced by parse(), parseImport(), and parseMedia().
|
private |
Definition at line 522 of file cssparser.cc.
References CSS_TK_CHAR, CSS_TK_COLOR, CSS_TK_DECINT, CSS_TK_END, CSS_TK_FLOAT, CSS_TK_STRING, CSS_TK_SYMBOL, DEBUG_MSG, DEBUG_TOKEN_LEVEL, getChar(), maxStrLen, skipString(), spaceSeparated, ttype, tval, ungetChar(), and withinBlock.
Referenced by CssParser(), ignoreBlock(), ignoreStatement(), parse(), parseDeclaration(), parseImport(), parseMedia(), parseRgbColor(), parseRgbColorComponent(), parseRuleset(), parseSelector(), parseSimpleSelector(), parseUrl(), parseValue(), and parseWeight().
|
static |
Definition at line 1770 of file cssparser.cc.
References baseUrl, buf, buflen, context, CSS_TK_CHAR, CSS_TK_END, CSS_TK_SYMBOL, dStrAsciiCasecmp(), ignoreStatement(), nextToken(), origin, parseImport(), parseMedia(), parseRuleset(), ttype, and tval.
Referenced by StyleEngine::buildUserStyle(), StyleEngine::init(), and StyleEngine::parse().
|
private |
Definition at line 1251 of file cssparser.cc.
References CSS_NUM_PARSED_PROPERTIES, CSS_PROPERTY_END, Css_property_info, Css_property_info_cmp(), Css_shorthand_info, Css_shorthand_info_cmp(), CSS_SHORTHAND_NUM, CSS_TK_CHAR, CSS_TK_END, CSS_TK_SYMBOL, CSS_TYPE_UNUSED, DEBUG_MSG, DEBUG_PARSE_LEVEL, MSG_CSS, nextToken(), parseValue(), parseWeight(), CssPropertyList::set(), tokenMatchesProperty(), ttype, and tval.
Referenced by parseDeclarationBlock(), and parseRuleset().
|
static |
Definition at line 1802 of file cssparser.cc.
References baseUrl, buf, buflen, CSS_ORIGIN_AUTHOR, CSS_TK_CHAR, CSS_TK_END, parseDeclaration(), ttype, tval, and withinBlock.
Referenced by StyleEngine::setStyle().
|
private |
Definition at line 1631 of file cssparser.cc.
References a_Html_load_stylesheet(), a_Html_url_new(), a_Url_free(), a_Url_str(), baseUrl, CSS_TK_CHAR, CSS_TK_STRING, CSS_TK_SYMBOL, dFree(), dStrAsciiCasecmp(), dStrdup(), ignoreStatement(), MSG, nextToken(), parseUrl(), ttype, and tval.
Referenced by parse().
|
private |
Definition at line 1686 of file cssparser.cc.
References CSS_TK_CHAR, CSS_TK_END, CSS_TK_SYMBOL, dStrAsciiCasecmp(), ignoreBlock(), ignoreStatement(), nextToken(), parseRuleset(), ttype, and tval.
Referenced by parse().
|
private |
Definition at line 846 of file cssparser.cc.
References CSS_TK_CHAR, MSG_CSS, nextToken(), parseRgbColorComponent(), ttype, and tval.
Referenced by parseValue().
|
private |
Definition at line 813 of file cssparser.cc.
References CSS_TK_CHAR, CSS_TK_DECINT, MSG_CSS, nextToken(), ttype, and tval.
Referenced by parseRgbColor().
|
private |
Definition at line 1516 of file cssparser.cc.
References CssContext::addRule(), context, CSS_ORIGIN_AUTHOR, CSS_ORIGIN_USER, CSS_ORIGIN_USER_AGENT, CSS_PRIMARY_AUTHOR, CSS_PRIMARY_AUTHOR_IMPORTANT, CSS_PRIMARY_USER, CSS_PRIMARY_USER_AGENT, CSS_PRIMARY_USER_IMPORTANT, CSS_TK_CHAR, CSS_TK_END, DEBUG_MSG, DEBUG_PARSE_LEVEL, lout::misc::SimpleVector< T >::get(), lout::misc::SimpleVector< T >::increase(), nextToken(), origin, parseDeclaration(), parseSelector(), CssPropertyList::ref(), CssSelector::ref(), lout::misc::SimpleVector< T >::set(), lout::misc::SimpleVector< T >::size(), ttype, tval, CssPropertyList::unref(), CssSelector::unref(), and withinBlock.
Referenced by parse(), and parseMedia().
|
private |
Definition at line 1479 of file cssparser.cc.
References CssSelector::addSimpleSelector(), CssSelector::COMB_ADJACENT_SIBLING, CssSelector::COMB_CHILD, CssSelector::COMB_DESCENDANT, CSS_TK_CHAR, CSS_TK_END, nextToken(), parseSimpleSelector(), spaceSeparated, CssSelector::top(), ttype, and tval.
Referenced by parseRuleset().
|
private |
Definition at line 1410 of file cssparser.cc.
References a_Html_tag_index(), CSS_TK_CHAR, CSS_TK_SYMBOL, DEBUG_MSG, DEBUG_PARSE_LEVEL, CssSimpleSelector::element, CssSimpleSelector::ELEMENT_ANY, CssSimpleSelector::getPseudoClass(), CssSimpleSelector::id, CssSimpleSelector::klass, nextToken(), CssSimpleSelector::pseudo, CssSimpleSelector::SELECT_CLASS, CssSimpleSelector::SELECT_ID, CssSimpleSelector::SELECT_NONE, CssSimpleSelector::SELECT_PSEUDO_CLASS, CssSimpleSelector::setElement(), CssSimpleSelector::setSelect(), spaceSeparated, ttype, and tval.
Referenced by parseSelector().
|
private |
Definition at line 1588 of file cssparser.cc.
References a_Url_free(), a_Url_new(), a_Url_str(), baseUrl, CSS_TK_CHAR, CSS_TK_END, CSS_TK_STRING, CSS_TK_SYMBOL, dStr_append(), dStr_free(), dStr_new(), dStrAsciiCasecmp(), dStrdup(), nextToken(), Dstr::str, ttype, and tval.
Referenced by parseImport(), and parseValue().
|
private |
Definition at line 890 of file cssparser.cc.
References a_Color_parse(), lout::misc::assertNotReached(), CSS_CREATE_LENGTH(), CSS_LENGTH_TYPE_AUTO, CSS_LENGTH_TYPE_CH, CSS_LENGTH_TYPE_EM, CSS_LENGTH_TYPE_EX, CSS_LENGTH_TYPE_MM, CSS_LENGTH_TYPE_NONE, CSS_LENGTH_TYPE_PERCENTAGE, CSS_LENGTH_TYPE_PX, CSS_LENGTH_TYPE_REM, CSS_LENGTH_TYPE_VH, CSS_LENGTH_TYPE_VMAX, CSS_LENGTH_TYPE_VMIN, CSS_LENGTH_TYPE_VW, CSS_PROPERTY_BACKGROUND_POSITION, Css_property_info, CSS_TK_CHAR, CSS_TK_COLOR, CSS_TK_DECINT, CSS_TK_FLOAT, CSS_TK_STRING, CSS_TK_SYMBOL, CSS_TYPE_AUTO, CSS_TYPE_BACKGROUND_POSITION, CSS_TYPE_COLOR, CSS_TYPE_ENUM, CSS_TYPE_FONT_WEIGHT, CSS_TYPE_INTEGER, CSS_TYPE_LENGTH, CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_LENGTH_PERCENTAGE_NUMBER, CSS_TYPE_MULTI_ENUM, CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_STRING, CSS_TYPE_SYMBOL, CSS_TYPE_UNUSED, CSS_TYPE_URI, dNew, dStr_append(), dStr_append_c(), dStr_free(), dStr_new(), dStrAsciiCasecmp(), dStrdup(), dStrstrip(), CssPropertyValue::intVal, CssPropertyValue::lenVal, MSG_CSS, nextToken(), parseRgbColor(), parseUrl(), parseValue(), CssPropertyValue::posVal, CssBackgroundPosition::posX, CssBackgroundPosition::posY, spaceSeparated, Dstr::str, CssPropertyValue::strVal, tokenMatchesProperty(), ttype, and tval.
Referenced by parseDeclaration(), and parseValue().
|
private |
Definition at line 1218 of file cssparser.cc.
References CSS_TK_CHAR, CSS_TK_SYMBOL, dStrAsciiCasecmp(), nextToken(), ttype, and tval.
Referenced by parseDeclaration().
|
static |
Definition at line 1729 of file cssparser.cc.
References Css_property_info.
Referenced by CssProperty::print().
|
inlineprivate |
Skip string str if it is found in the input buffer.
If string is found leave bufptr pointing to last matched char. If not wind back. The first char is passed as parameter c to avoid unnecessary getChar() / ungetChar() calls.
Definition at line 506 of file cssparser.cc.
References getChar(), and ungetChar().
Referenced by nextToken().
|
private |
Definition at line 703 of file cssparser.cc.
References a_Color_parse(), Css_property_info, CSS_TK_COLOR, CSS_TK_DECINT, CSS_TK_FLOAT, CSS_TK_STRING, CSS_TK_SYMBOL, CSS_TYPE_AUTO, CSS_TYPE_BACKGROUND_POSITION, CSS_TYPE_COLOR, CSS_TYPE_ENUM, CSS_TYPE_FONT_WEIGHT, CSS_TYPE_INTEGER, CSS_TYPE_LENGTH, CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_LENGTH_PERCENTAGE_NUMBER, CSS_TYPE_MULTI_ENUM, CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_STRING, CSS_TYPE_SYMBOL, CSS_TYPE_UNUSED, CSS_TYPE_URI, dStrAsciiCasecmp(), ttype, and tval.
Referenced by parseDeclaration(), and parseValue().
|
private |
Undoes the last getChar().
Definition at line 495 of file cssparser.cc.
References bufptr.
Referenced by nextToken(), and skipString().
|
private |
Definition at line 18 of file cssparser.hh.
Referenced by CssParser(), parse(), parseDeclarationBlock(), parseImport(), and parseUrl().
|
private |
Definition at line 20 of file cssparser.hh.
Referenced by CssParser(), getChar(), parse(), and parseDeclarationBlock().
|
private |
Definition at line 21 of file cssparser.hh.
Referenced by CssParser(), getChar(), parse(), and parseDeclarationBlock().
|
private |
Definition at line 21 of file cssparser.hh.
Referenced by CssParser(), getChar(), and ungetChar().
|
private |
Definition at line 16 of file cssparser.hh.
Referenced by CssParser(), parse(), and parseRuleset().
|
staticprivate |
Definition at line 15 of file cssparser.hh.
Referenced by nextToken().
|
private |
Definition at line 17 of file cssparser.hh.
Referenced by CssParser(), parse(), and parseRuleset().
|
private |
Definition at line 26 of file cssparser.hh.
Referenced by CssParser(), nextToken(), parseSelector(), parseSimpleSelector(), and parseValue().
|
private |
Definition at line 23 of file cssparser.hh.
Referenced by ignoreBlock(), ignoreStatement(), nextToken(), parse(), parseDeclaration(), parseDeclarationBlock(), parseImport(), parseMedia(), parseRgbColor(), parseRgbColorComponent(), parseRuleset(), parseSelector(), parseSimpleSelector(), parseUrl(), parseValue(), parseWeight(), and tokenMatchesProperty().
|
private |
Definition at line 24 of file cssparser.hh.
Referenced by ignoreBlock(), ignoreStatement(), nextToken(), parse(), parseDeclaration(), parseDeclarationBlock(), parseImport(), parseMedia(), parseRgbColor(), parseRgbColorComponent(), parseRuleset(), parseSelector(), parseSimpleSelector(), parseUrl(), parseValue(), parseWeight(), and tokenMatchesProperty().
|
private |
Definition at line 25 of file cssparser.hh.
Referenced by CssParser(), nextToken(), parseDeclarationBlock(), and parseRuleset().