Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
SVGStyleQuery.h File Reference
#include <cstddef>
#include <functional>
#include <optional>
#include <span>
#include <string_view>
#include <vector>
#include "donner/base/EcsRegistry.h"
#include "donner/base/FileOffset.h"
#include "donner/css/Declaration.h"
#include "donner/css/Specificity.h"
#include "donner/svg/SVGStyleElement.h"
Include dependency graph for SVGStyleQuery.h:

Classes

struct  donner::svg::SVGMatchedStyleRule
 Diagnostic record for one stylesheet rule that matched an element. More...
struct  donner::svg::SVGStylesheetDeclaration
 Parsed declaration within a stylesheet rule, with an optional document source range. More...
struct  donner::svg::SVGStylesheetRule
 Stylesheet rule in a document; built-in rules have no document source ranges. More...
struct  donner::svg::SVGStyleRuleAtSourceOffset
 Stylesheet rule found at a document source offset. More...
struct  donner::svg::SVGCustomPropertyDeclarationBatch
 Source ranges returned by one bounded, read-only custom-property provenance query. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::svg
 Donner SVG library, which can load, manipulate and render SVG files.

Functions

bool donner::svg::VisitAuthoredStylesheetDeclarations (const SVGStyleElement &stylesheet, std::size_t ruleIndex, const SourceRange &expectedRuleRange, const std::function< void(std::string_view, std::span< const css::Declaration >)> &visit)
 Borrow the declaration tokens of one exact authored stylesheet rule during the call.
std::optional< bool > donner::svg::HasPreparedCustomPropertyValue (const SVGElement &element, std::string_view name)
 Whether the element's prepared cascade supplies a usable value for the case-sensitive name. A disjoint or unprepared document state has no answer. A valid imported value can be present even when it has no source range in this document.
std::vector< SVGMatchedStyleRule > donner::svg::CollectMatchedStyleRules (const SVGElement &element, bool includeDeclarations=true)
 Collect stylesheet rules that match element.
std::vector< SVGStylesheetRule > donner::svg::CollectStylesheetRules (const SVGDocument &document, bool includeUserAgent=false)
 Collect source-backed author stylesheet rules in document, optionally with the built-in user agent stylesheet rules.
std::optional< SVGStylesheetRule > donner::svg::CollectStylesheetRuleAtSourceOffset (const SVGDocument &document, std::size_t documentSourceOffset, bool includeDeclarations=true)
 Collect one document-local author rule and its declarations at a source byte offset.
bool donner::svg::AuthorStyleDependsOnTreePosition (const SVGDocument &document)
 Return true when an author stylesheet rule in document matches on tree position.
std::optional< SourceRange > donner::svg::MapStylesheetSourceRange (const SVGStyleElement &stylesheet, const SourceRange &cssRange)
 Map a contiguous stylesheet-local CSS byte range into the original SVG source.
SVGCustomPropertyDeclarationBatch donner::svg::FindCustomPropertyDeclarations (const SVGElement &element, std::span< const std::string_view > names, std::size_t maxWork)
 Find the source declarations supplying several custom properties to one element.
std::optional< SourceRange > donner::svg::FindCustomPropertyDeclaration (const SVGElement &element, std::string_view name)
 Find the source span of the declaration supplying a custom property to this element.
std::optional< SVGStyleRuleAtSourceOffset > donner::svg::FindStyleRuleAtSourceOffset (const SVGDocument &document, std::size_t documentSourceOffset)
 Find the author stylesheet rule at documentSourceOffset.

Class Documentation

◆ donner::svg::SVGStylesheetDeclaration

struct donner::svg::SVGStylesheetDeclaration

Parsed declaration within a stylesheet rule, with an optional document source range.

Class Members
Declaration declaration Parsed CSS declaration.
size_t declarationIndex = 0 Index within the rule.
optional< SourceRange > declarationSourceRange Declaration range in SVG source.

◆ donner::svg::SVGStylesheetRule

struct donner::svg::SVGStylesheetRule

Stylesheet rule in a document; built-in rules have no document source ranges.

Class Members
bool blockClosedAtEof = false No closing brace was authored for the rule block.
vector< SVGStylesheetDeclaration > declarations Rule declarations.
bool isUserAgentStylesheet = false True for a built-in rule without document source ranges.
optional< SourceRange > ruleCssRange Rule range in the parsed CSS text.
size_t ruleIndex = 0 Index within the stylesheet.
optional< SourceRange > ruleSourceRange Rule range in SVG source.
optional< SourceRange > selectorCssRange Selector range in the parsed CSS text.
optional< SourceRange > selectorSourceRange Selector range in SVG source.
optional< SVGStyleElement > stylesheetElement Typed embedded stylesheet owner.
Entity stylesheetEntity = entt::null Owning <style> or <svg> element key.

◆ donner::svg::SVGCustomPropertyDeclarationBatch

struct donner::svg::SVGCustomPropertyDeclarationBatch

Source ranges returned by one bounded, read-only custom-property provenance query.

Class Members
bool budgetExceeded = false True when the query stopped at the aggregate work ceiling.
bool complete = false True when every result is authoritative for the prepared document state.
vector< optional< SourceRange > > declarations One declaration-name range per requested name, in request order.
size_t work = 0 Aggregate query work consumed from the caller's allowance.