void skip_spaces(const char **pp) { const char *p; p = *pp; while (css_is_space(*p)) p++; *pp = p; }
static void bskip_spaces(CSSParseState *b, int *ch_ptr) { int c; c = *ch_ptr; while (css_is_space(c)) c = bgetc(b); *ch_ptr = c; }
void skip_non_spaces(const char **pp) { const char *p; p = *pp; while ((0 != *p) && !css_is_space(*p)) p++; *pp = p; }
/* Read a token from a string, stop a set of characters. * Skip spaces before and after token. */ void get_str(const char **pp, char *buf, int buf_size, const char *stop) { char *q; const char *p; int c; skip_spaces(pp); p = *pp; q = buf; for (;;) { c = *p; /* Should stop on spaces and eat them */ if (c == '\0' || css_is_space(c) || strchr(stop, c)) break; if ((q - buf) < buf_size - 1) *q++ = c; p++; } *q = '\0'; *pp = p; skip_spaces(pp); }
OP_STATUS Counters::AddCounterValues(OpString& counter_str, HTML_Element* element, short counter_type, const uni_char* counter_value) { if (counter_value) { const uni_char* name = counter_value; unsigned int name_length = 0; // The css parser should have stripped off the leading whitespaces. OP_ASSERT(!css_is_space(*name)); const uni_char* style = name; unsigned int style_length = 0; /* 'delimiter' corresponds to the 'string' argument of the counters function in the CSS 2.1. */ const uni_char* delimiter = NULL; unsigned int delimiter_length = 0; if (counter_type == CSS_FUNCTION_COUNTERS) { delimiter = name; while (*delimiter && !css_is_space(*delimiter) && *delimiter != ',') delimiter++; BOOL comma_found = (*delimiter == ','); name_length = delimiter++ - name; while (css_is_space(*delimiter)) delimiter++; if (!comma_found) { if (*delimiter && *delimiter != ',') return OpStatus::OK; while (css_is_space(*++delimiter)) ; } uni_char quote_char = *delimiter++; if (quote_char != '"' && quote_char != '\'') return OpStatus::OK; style = delimiter; while (*style && (*style != quote_char || *(style-1) == '\\')) style++; if (*style != quote_char) return OpStatus::OK; delimiter_length = style++ - delimiter; } else { while (*style && !css_is_space(*style) && *style != ',') style++; name_length = style - name; } while (*style && (css_is_space(*style) || *style == ',')) style++; const uni_char* end = style; while (*end && !css_is_space(*end) && *end != ',') end++; OP_ASSERT(*end == 0); style_length = end - style; short style_type = CSS_VALUE_decimal; if (*style) { short keyword = CSS_GetKeyword(style, style_length); if (CSS_is_list_style_type_val(keyword) || keyword == CSS_VALUE_none) style_type = keyword; } Counter* counter = GetCounter(name, name_length); if (counter) return counter->AddCounterValues(counter_str, element, delimiter, delimiter_length, style_type, add_only); else { uni_char number_buf[TMPSTRING_SIZE]; /* ARRAY OK 2009-05-11 davve */ MakeListNumberStr(0, style_type, NULL, number_buf, TMPSTRING_SIZE-1); //FIXME rtl?? return counter_str.Append(number_buf); } } return OpStatus::OK; }