diff --git a/nel/include/nel/gui/css_parser.h b/nel/include/nel/gui/css_parser.h index c3a426ee7..360e70a8d 100644 --- a/nel/include/nel/gui/css_parser.h +++ b/nel/include/nel/gui/css_parser.h @@ -73,7 +73,7 @@ namespace NLGUI void preprocess(); // parse selectors + combinators - std::vector parse_selector(const std::string &sel, std::string &pseudoElement) const; + std::vector parse_selector(const std::string &sel, std::string &pseudoElement, std::string::size_type &pos) const; // parse selector and style void parseRule(const std::string &selectorString, const std::string &styleString); diff --git a/nel/src/gui/css_parser.cpp b/nel/src/gui/css_parser.cpp index e59e67156..b3e3861bb 100644 --- a/nel/src/gui/css_parser.cpp +++ b/nel/src/gui/css_parser.cpp @@ -98,25 +98,22 @@ namespace NLGUI // @internal void CCssParser::parseRule(const std::string &selectorString, const std::string &styleString) { - std::vector selectors; - NLMISC::explode(selectorString, std::string(","), selectors); - TStyleVec props; props = parseDecls(styleString); // duplicate props to each selector in selector list, // example 'div > p, h1' creates 'div>p' and 'h1' - for(uint i=0; i CCssParser::parse_selector(const std::string &sel, std::string &pseudoElement) const + std::vector CCssParser::parse_selector(const std::string &sel, std::string &pseudoElement, std::string::size_type &pos) const { std::vector result; CCssSelector current; @@ -353,8 +350,8 @@ namespace NLGUI pseudoElement.clear(); bool failed = false; - std::string::size_type start = 0, pos = 0; - while(pos < sel.size()) + std::string::size_type start = pos; + while(pos < sel.size() && sel[pos] != ',') { std::string uc; uc = sel[pos]; @@ -624,7 +621,8 @@ namespace NLGUI } else if (isSpace) { - current.Combinator = ' '; + if (sel[pos] != ',' && sel[pos] != '\0') + current.Combinator = ' '; } else {