A CSS stylesheet, which is a list of rules.
More...
#include "donner/css/Stylesheet.h"
|
| struct | SecurityStats |
| | Resource-limit accounting produced while parsing an untrusted stylesheet. More...
|
|
|
| Stylesheet ()=default |
| | Default constructor.
|
| | Stylesheet (std::vector< SelectorRule > &&rules, std::vector< FontFace > &&fontFaces={}) |
| | Construct a stylesheet from a list of rules.
|
|
| Stylesheet (std::vector< SelectorRule > &&rules, std::vector< FontFace > &&fontFaces, SecurityStats securityStats) |
| | Construct a stylesheet with parser resource-limit accounting.
|
|
| Stylesheet (std::vector< SelectorRule > &&rules, std::vector< FontFace > &&fontFaces, std::vector< ImportRule > &&imports, SecurityStats securityStats, std::shared_ptr< const StylesheetLayers > layers=nullptr) |
| | Construct a stylesheet with retained @import rules and parser accounting.
|
|
| Stylesheet (const Stylesheet &)=default |
| | Copy constructor.
|
|
Stylesheet & | operator= (const Stylesheet &)=default |
| | Copy assignment operator.
|
|
| Stylesheet (Stylesheet &&) noexcept=default |
| | Move constructor.
|
|
Stylesheet & | operator= (Stylesheet &&) noexcept=default |
| | Move assignment operator.
|
|
| ~Stylesheet ()=default |
| | Destructor.
|
|
std::span< const SelectorRule > | rules () const |
| | Get the list of rules in this stylesheet.
|
|
std::span< const FontFace > | fontFaces () const |
| | Get the list of @font-face rules in this stylesheet.
|
|
std::span< FontFace > | mutableFontFaces () |
| | Get mutable access to the @font-face rules, for example to resolve their relative source URLs against the URL a stylesheet was loaded from.
|
| std::span< const ImportRule > | imports () const |
| | Get the unconditional @import rules of this stylesheet, in source order.
|
|
const StylesheetLayers * | layers () const |
| | Layer syntax in source order. A null value leaves ordinary imports in imports() order.
|
|
LayerId | fontFaceLayer (std::size_t position) const |
| | Local layer of the font face at this position, or the implicit sheet layer.
|
|
const SecurityStats & | securityStats () const |
| | Return resource-limit accounting from parsing this stylesheet.
|
|
|
static constexpr std::size_t | kMaximumDeclarations = 16 * 1024 |
| | Maximum declarations retained across one stylesheet.
|
|
static constexpr std::size_t | kMaximumLayers = 4096 |
| | Maximum distinct layer nodes and path depth in one sheet.
|
|
static constexpr std::size_t | kMaximumLayerDepth = 32 |
|
| std::ostream & | operator<< (std::ostream &os, const Stylesheet &stylesheet) |
| | Output a human-readable representation of the stylesheet to a stream.
|
A CSS stylesheet, which is a list of rules.
This is created by the parser, from the CSS::ParseStylesheet() API.
- Examples
- custom_css_parser.cc.
◆ donner::css::Stylesheet::SecurityStats
| struct donner::css::Stylesheet::SecurityStats |
Resource-limit accounting produced while parsing an untrusted stylesheet.
| Class Members |
|
size_t |
componentValues = 0 |
|
|
size_t |
declarations = 0 |
|
|
bool |
hasImportRule = false |
An import directive appeared, including one rejected by its position or conditions. |
|
size_t |
rawRules = 0 |
Raw top-level entries charged by RuleParser, including ignored rules. |
|
bool |
rejected = false |
|
|
size_t |
rules = 0 |
|
◆ Stylesheet()
| donner::css::Stylesheet::Stylesheet |
( |
std::vector< SelectorRule > && | rules, |
|
|
std::vector< FontFace > && | fontFaces = {} ) |
|
inlineexplicit |
Construct a stylesheet from a list of rules.
- Parameters
-
| rules | List of rules, ownership is taken. |
| fontFaces | Optional list of @font-face declarations, ownership is taken. |
◆ imports()
| std::span< const ImportRule > donner::css::Stylesheet::imports |
( |
| ) |
const |
|
inline |
Get the unconditional @import rules of this stylesheet, in source order.
Imported rules precede this stylesheet's own rules in the cascade.
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
const Stylesheet & | stylesheet ) |
|
friend |
Output a human-readable representation of the stylesheet to a stream.
- Parameters
-
The documentation for this class was generated from the following file: