Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::css::Stylesheet Class Reference

A CSS stylesheet, which is a list of rules. More...

#include "donner/css/Stylesheet.h"

Classes

struct  SecurityStats
 Resource-limit accounting produced while parsing an untrusted stylesheet. More...

Public Member Functions

 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 (const Stylesheet &)=default
 Copy constructor.
Stylesheetoperator= (const Stylesheet &)=default
 Copy assignment operator.
 Stylesheet (Stylesheet &&) noexcept=default
 Move constructor.
Stylesheetoperator= (Stylesheet &&) noexcept=default
 Move assignment operator.
 ~Stylesheet ()=default
 Destructor.
std::span< const SelectorRulerules () const UTILS_LIFETIME_BOUND
 Get the list of rules in this stylesheet.
std::span< const FontFacefontFaces () const UTILS_LIFETIME_BOUND
 Get the list of @font-face rules in this stylesheet.
const SecurityStatssecurityStats () const
 Return resource-limit accounting from parsing this stylesheet.

Static Public Attributes

static constexpr std::size_t kMaximumDeclarations = 16 * 1024
 Maximum declarations retained across one stylesheet.

Friends

std::ostream & operator<< (std::ostream &os, const Stylesheet &stylesheet)
 Output a human-readable representation of the stylesheet to a stream.

Detailed Description

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.

Class Documentation

◆ 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 rejected = false
size_t rules = 0

Constructor & Destructor Documentation

◆ Stylesheet()

donner::css::Stylesheet::Stylesheet ( std::vector< SelectorRule > && rules,
std::vector< FontFace > && fontFaces = {} )
inlineexplicit

Construct a stylesheet from a list of rules.

Parameters
rulesList of rules, ownership is taken.
fontFacesOptional list of @font-face declarations, ownership is taken.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Stylesheet & stylesheet )
friend

Output a human-readable representation of the stylesheet to a stream.

Parameters
osOutput stream.
stylesheetStylesheet to output.

The documentation for this class was generated from the following file: