File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Sabberworm \CSS \CSSList ;
4
+
5
+
6
+ class KeyFrame extends CSSList {
7
+
8
+ private $ vendorKeyFrame ;
9
+ private $ animationName ;
10
+
11
+ public function __construct () {
12
+ parent ::__construct ();
13
+ $ this ->vendorKeyFrame = null ;
14
+ $ this ->animationName = null ;
15
+ }
16
+
17
+ public function setVendorKeyFrame ($ vendorKeyFrame ) {
18
+ $ this ->vendorKeyFrame = $ vendorKeyFrame ;
19
+ }
20
+
21
+ public function getVendorKeyFrame () {
22
+ return $ this ->vendorKeyFrame ;
23
+ }
24
+
25
+ public function setAnimationName ($ animationName ) {
26
+ $ this ->animationName = $ animationName ;
27
+ }
28
+
29
+ public function getAnimationName () {
30
+ return $ this ->animationName ;
31
+ }
32
+
33
+ public function __toString () {
34
+ $ sResult = "@ {$ this ->vendorKeyFrame } {$ this ->animationName } { " ;
35
+ $ sResult .= parent ::__toString ();
36
+ $ sResult .= '} ' ;
37
+ return $ sResult ;
38
+ }
39
+
40
+ }
Original file line number Diff line number Diff line change 5
5
use Sabberworm \CSS \CSSList \CSSList ;
6
6
use Sabberworm \CSS \CSSList \Document ;
7
7
use Sabberworm \CSS \CSSList \MediaQuery ;
8
+ use Sabberworm \CSS \CSSList \Keyframe ;
8
9
use Sabberworm \CSS \Property \Import ;
9
10
use Sabberworm \CSS \Property \Charset ;
10
11
use Sabberworm \CSS \RuleSet \AtRule ;
@@ -88,7 +89,16 @@ private function parseAtRule() {
88
89
$ this ->consume ('@ ' );
89
90
$ sIdentifier = $ this ->parseIdentifier ();
90
91
$ this ->consumeWhiteSpace ();
91
- if ($ sIdentifier === 'media ' ) {
92
+ if ($ sIdentifier == 'keyframes ' || $ sIdentifier == '-webkit-keyframes ' || $ sIdentifier == '-moz-keyframes ' || $ sIdentifier == '-o-keyframes ' ) {
93
+ $ oResult = new KeyFrame ();
94
+ $ oResult ->setVendorKeyFrame ($ sIdentifier );
95
+ $ oResult ->setAnimationName (trim ($ this ->consumeUntil ('{ ' )));
96
+ $ this ->consume ('{ ' );
97
+ $ this ->consumeWhiteSpace ();
98
+ $ this ->parseList ($ oResult );
99
+ return $ oResult ;
100
+
101
+ } else if ($ sIdentifier === 'media ' ) {
92
102
$ oResult = new MediaQuery ();
93
103
$ oResult ->setQuery (trim ($ this ->consumeUntil ('{ ' )));
94
104
$ this ->consume ('{ ' );
You can’t perform that action at this time.
0 commit comments