Public API for parsing CSS.
More...
#include "donner/css/CSS.h"
Public API for parsing CSS.
◆ ParseSelector()
| std::optional< Selector > donner::css::CSS::ParseSelector |
( |
std::string_view | str | ) |
|
|
static |
Parse a CSS selector string into a Selector object, which can be used to implement querySelector and similar APIs.
- Parameters
-
| str | Input selector string, e.g. "svg > rect". |
- Returns
- Parsed selector, or std::nullopt if the selector is invalid.
- Examples
- custom_css_parser.cc.
◆ ParseStyleAttribute()
| std::vector< Declaration > donner::css::CSS::ParseStyleAttribute |
( |
std::string_view | str | ) |
|
|
static |
Parse a style="" attribute into a list of Declaration.
For example:
style="fill:red; stroke:blue"
Returns two declarations, one for fill and one for stroke.
- Parameters
-
| str | Input style attribute string. |
- Returns
- Parsed declarations.
- Examples
- custom_css_parser.cc.
◆ ParseStylesheet()
| Stylesheet donner::css::CSS::ParseStylesheet |
( |
std::string_view | str | ) |
|
|
static |
Parse a CSS stylesheet into a list of selectors and their associated declarations, which is wrapped into a Stylesheet object.
- Parameters
-
| str | Input stylesheet string. |
- Returns
- Parsed stylesheet.
- Examples
- custom_css_parser.cc.
The documentation for this class was generated from the following files:
- donner/css/CSS.h
- donner/css/CSS.cc