Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
Stylesheet.h File Reference
#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <ostream>
#include <span>
#include <vector>
#include "donner/base/Utils.h"
#include "donner/css/Declaration.h"
#include "donner/css/FontFace.h"
#include "donner/css/Selector.h"
Include dependency graph for Stylesheet.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::css::LayerNode
 A layer name segment, scoped to its parent in the same sheet. More...
struct  donner::css::LayerEvent
 Source-order layer declarations and retained import positions. More...
struct  donner::css::StylesheetLayers
 Immutable sheet-local layer syntax, allocated only for a sheet that uses layers. More...
struct  donner::css::EditedRuleWindow
 Qualified rule indices replaced by a verified text splice. The two counts refer to the previous and updated stylesheet respectively; unaffected suffix rules may shift. More...
struct  donner::css::SelectorRule
 A rule in a stylesheet, which consists of a selector and a list of declarations. More...
struct  donner::css::ImportRule
 An unconditional @import rule retained by the stylesheet parser, such as @import url("theme.css");. More...
class  donner::css::Stylesheet
 A CSS stylesheet, which is a list of rules. More...
struct  donner::css::Stylesheet::SecurityStats
 Resource-limit accounting produced while parsing an untrusted stylesheet. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::css
 Donner CSS library, a standalone composable CSS parser.

Typedefs

using donner::css::LayerId = std::uint16_t
 One layer segment in the sheet's local layer tree.

Variables

constexpr LayerId donner::css::kUnlayered = std::numeric_limits<LayerId>::max()
 The implicit sheet root and layer identity of unlayered rules.

Class Documentation

◆ donner::css::LayerNode

struct donner::css::LayerNode

A layer name segment, scoped to its parent in the same sheet.

Class Members
RcString name Exact decoded identifier. Empty denotes a new anonymous layer.
LayerId parent Sheet-local parent, or the implicit root.

◆ donner::css::StylesheetLayers

struct donner::css::StylesheetLayers

Immutable sheet-local layer syntax, allocated only for a sheet that uses layers.

Class Members
vector< LayerEvent > events
vector< LayerId > fontFaceLayers Sheet-local layer of each font face, populated only when a face is layered.
vector< LayerNode > nodes

◆ donner::css::EditedRuleWindow

struct donner::css::EditedRuleWindow

Qualified rule indices replaced by a verified text splice. The two counts refer to the previous and updated stylesheet respectively; unaffected suffix rules may shift.

Class Members
size_t newBegin
size_t newCount
size_t oldBegin
size_t oldCount

◆ donner::css::ImportRule

struct donner::css::ImportRule

An unconditional @import rule retained by the stylesheet parser, such as @import url("theme.css");.

Only imports that apply unconditionally are retained. Imports with supports() or media conditions other than all, and imports that appear after another rule, are diagnosed and dropped by the parser. The parser never resolves or fetches the URL; loading is the responsibility of the document that owns the stylesheet.

Class Members
LayerId layer = kUnlayered Optional named or anonymous import layer.
FileOffset sourceOffset = FileOffset::EndOfString() Source position of the @ token in the local CSS source.
RcString url URL of the imported stylesheet, exactly as authored (unresolved).

◆ 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