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 55use Sabberworm \CSS \CSSList \CSSList ;
66use Sabberworm \CSS \CSSList \Document ;
77use Sabberworm \CSS \CSSList \MediaQuery ;
8+ use Sabberworm \CSS \CSSList \Keyframe ;
89use Sabberworm \CSS \Property \Import ;
910use Sabberworm \CSS \Property \Charset ;
1011use Sabberworm \CSS \RuleSet \AtRule ;
@@ -88,7 +89,16 @@ private function parseAtRule() {
8889 $ this ->consume ('@ ' );
8990 $ sIdentifier = $ this ->parseIdentifier ();
9091 $ 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 ' ) {
92102 $ oResult = new MediaQuery ();
93103 $ oResult ->setQuery (trim ($ this ->consumeUntil ('{ ' )));
94104 $ this ->consume ('{ ' );
You can’t perform that action at this time.
0 commit comments