Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::CSS Namespace Reference

Classes

struct  BlockAtStatement
 A decomposed block -statement, consisting of the statement and the contents of the associated block. More...
 
struct  RuleStatement
 A decomposed CSS rule statement, consisting of a selector (which can be complex), and the associated set of rules. More...
 
class  SyntacticDecomposition
 A partial syntactic decomposition of a CSS stylesheet into syntactic elements. More...
 

Concepts

concept  SyntacticElementHandler
 A SyntacticElementHandler is a callable which can accept all possible variant types of a syntactic element, assuming that they are passed by const &.
 

Typedefs

using OtherStatement = std::string
 Another CSS statement, currently not handled in a special way; for example @charset.
 
using SyntacticElement = std::variant< RuleStatement, BlockAtStatement, OtherStatement >
 A syntactic element of a CSS stylesheet is either a rule set statement, a block -statement, or some other, "generic" statement.
 

Functions

std::string selector_to_validated_string (CRSelector const &croco_selector)
 Convert a CSS selector to a string, performing a fix-up if needed.
 

Typedef Documentation

◆ OtherStatement

using Inkscape::CSS::OtherStatement = typedef std::string

Another CSS statement, currently not handled in a special way; for example @charset.

Todo:
Add support for comments and @font-face statements.

Definition at line 62 of file syntactic-decomposition.h.

◆ SyntacticElement

A syntactic element of a CSS stylesheet is either a rule set statement, a block -statement, or some other, "generic" statement.

Definition at line 66 of file syntactic-decomposition.h.

Function Documentation

◆ selector_to_validated_string()

std::string Inkscape::CSS::selector_to_validated_string ( CRSelector const &  croco_selector)

Convert a CSS selector to a string, performing a fix-up if needed.

Fixup: If there is only a single, simple type-like selector which doesn't correspond to an SVG element, the function fixes it up by converting to a class selector. For example the CSS " p { color: red; } " has a selector "p" which is not a valid SVG element, so we convert it to a class and return ".p".

Definition at line 164 of file syntactic-decomposition.cpp.

References cr_selector_to_string(), SPAttributeRelSVG::isSVGElement(), TYPE_SELECTOR, and UNIVERSAL_SELECTOR.

Referenced by Inkscape::UI::Dialog::SelectorsDialog::_addSelector().