[librsvg: 2/8] Add features doc for other supported pseudo-classes




commit 8dc7906675afbb3c7e3101a577594ca9a6ef7540
Author: Michael Howell <michael notriddle com>
Date:   Wed Oct 13 13:11:46 2021 -0700

    Add features doc for other supported pseudo-classes
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/606>

 FEATURES.md                                        |  25 +++++++++
 .../reftests/structural-pseudo-classes-ref.png     | Bin 0 -> 1363 bytes
 .../reftests/structural-pseudo-classes.svg         |  59 +++++++++++++++++++++
 3 files changed, 84 insertions(+)
---
diff --git a/FEATURES.md b/FEATURES.md
index b398a660..d8286c96 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -394,6 +394,29 @@ attributes:
 
 # CSS features
 
+## Pseudo-classes
+
+| Pseudo-class        | Notes                                                                                
|
+| ---                 | ---                                                                                  
|
+| :link               |                                                                                      
|
+| :visited            | Because librsvg does not maintain browser history, this is parsed, but never matches 
|
+| :lang()             |                                                                                      
|
+| :not()              | [^1]                                                                                 
|
+| :first-child        | [^1]                                                                                 
|
+| :last-child         | [^1]                                                                                 
|
+| :only-child         | [^1]                                                                                 
|
+| :root               | [^1]                                                                                 
|
+| :empty              | [^1]                                                                                 
|
+| :nth-child()        | [^1]                                                                                 
|
+| :nth-last-child()   | [^1]                                                                                 
|
+| :nth-of-type()      | [^1]                                                                                 
|
+| :nth-last-of-type() | [^1]                                                                                 
|
+| :first-of-type      | [^1]                                                                                 
|
+| :last-of-type       | [^1]                                                                                 
|
+| :only-of-type       | [^1]                                                                                 
|
+
+[^1]: These structural pseudo-classes are implemented in rust-selectors, which librsvg uses.
+
 FIXME: which selectors, combinators, at-rules.
 
 # XML features
@@ -411,3 +434,5 @@ FIXME: `xml:space` attribute
 * `flowRoot` element and its children - Inkscape, SVG 1.2 only., #13
 
 * `glyph-orientation-horizontal` property - SVG1.1 only, removed in SVG2
+
+* The pseudo-classes `:is()` and `:where()` are part of Selectors Level 4, which is still a working draft.
\ No newline at end of file
diff --git a/tests/fixtures/reftests/structural-pseudo-classes-ref.png 
b/tests/fixtures/reftests/structural-pseudo-classes-ref.png
new file mode 100644
index 00000000..f3e59551
Binary files /dev/null and b/tests/fixtures/reftests/structural-pseudo-classes-ref.png differ
diff --git a/tests/fixtures/reftests/structural-pseudo-classes.svg 
b/tests/fixtures/reftests/structural-pseudo-classes.svg
new file mode 100644
index 00000000..c9494098
--- /dev/null
+++ b/tests/fixtures/reftests/structural-pseudo-classes.svg
@@ -0,0 +1,59 @@
+<svg xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink"; width="50" height="50">
+  <style type="text/css">
+    g {
+      display: none;
+    }
+    svg:root g {
+      display: block;
+    }
+    rect {
+      display: none;
+      fill: red;
+    }
+    svg rect {
+     fill: red;
+    }
+    svg rect:not(:last-child) {
+      fill: red;
+    }
+    svg rect:last-child {
+     fill: black;
+    }
+    g path {
+      stroke: red;
+    }
+    g:only-of-type path:nth-child(2n+1) {
+      stroke: black;
+    }
+    svg:not(.missing-class) g > rect {
+      display: block;
+    }
+    circle:first-of-type:not(.evil-class) {
+      fill: yellow;
+      stroke: black;
+      stroke-width: 1px;
+    }
+    line {
+      stroke: red;
+    }
+    line:not(:root) {
+      stroke: black;
+    }
+    line:last-of-type {
+      stroke: blue;
+      stroke-width: 1px;
+    }
+    svg > path:empty {
+      stroke: blue;
+      stroke-width: 1px;
+    }
+  </style>
+  <circle class="present-class" cx="25" cy="25" r="25"/>
+  <g>
+    <path d="M 9,30 L 18,35"/>
+    <rect x="18" y="35" width="15" height="1"/>
+  </g>
+  <line x1="33" x2="42" y1="35" y2="30"/>
+  <line x1="18" x2="18" y1="9" y2="20"/>
+  <path d="M 32,9 L 32,20"/>
+</svg>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]