/[suikacvs]/messaging/manakai/lib/Message/DOM/CSSRule.pm
Suika

Contents of /messaging/manakai/lib/Message/DOM/CSSRule.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Sat Dec 22 06:29:32 2007 UTC (16 years, 11 months ago) by wakaba
Branch: MAIN
++ manakai/lib/Message/DOM/ChangeLog	22 Dec 2007 06:29:10 -0000
2007-12-22  Wakaba  <wakaba@suika.fam.cx>

	* CSSStyleSheet.pm, CSSRule.pm, CSSRuleList.pm, CSSStyleDeclaration.pm:
	First version of CSSOM implementation.

++ manakai/lib/Message/Charset/ChangeLog	23 Nov 2007 04:23:29 -0000
2007-11-23  Wakaba  <wakaba@suika.fam.cx>

	* Info.pm (is_syntactically_valid_iana_charset_name): Function
	name was misspelled.

1 wakaba 1.1 package Message::DOM::CSSRule;
2     use strict;
3     our $VERSION=do{my @r=(q$Revision: 1.12 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4     push our @ISA, 'Message::IF::CSSRule';
5    
6     ## |CSSRule| constants
7    
8     sub STYLE_RULE () { 1 }
9     sub CHARSET_RULE () { 2 }
10     sub IMPORT_RULE () { 3 }
11     sub MEDIA_RULE () { 4 }
12     sub FONT_FACE_RULE () { 5 }
13     sub PAGE_RULE () { 6 }
14     sub NAMESPACE_RULE () { 7 }
15    
16     sub AUTOLOAD {
17     my $method_name = our $AUTOLOAD;
18     $method_name =~ s/.*:://;
19     return if $method_name eq 'DESTROY';
20    
21     if ({
22     ## Read-only attributes (trivial accessors)
23     parent_rule => 1,
24     parent_style_sheet => 1,
25     }->{$method_name}) {
26     no strict 'refs';
27     eval qq{
28     sub $method_name (\$) {
29     return \${\$_[0]}->{$method_name};
30     }
31     };
32     goto &{ $AUTOLOAD };
33     } else {
34     require Carp;
35     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
36     }
37     } # AUTOLOAD
38    
39     ## |CSSRule| attributes
40    
41     sub css_text ($) {
42     die "$0: ".(ref $self)."->css_text: Not implemented";
43     } # css_text
44    
45     sub parent_rule ($);
46    
47     sub parent_style_sheet ($);
48    
49     sub type ($) {
50     die "$0: ".(ref $self)."->type: Not implemented";
51     } # type
52    
53     package Message::DOM::CSSStyleRule;
54     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSStyleRule';
55    
56     sub ____new ($$$) {
57     my $self = bless \{_selector => $_[1], style => $_[2]}, $_[0];
58     ## TODO: style -> owner
59     return $self;
60     } # ____new
61    
62     ## |CSSRule| attributes
63    
64     ## TODO: |css_text|
65    
66     sub type ($) { Message::DOM::CSSRule::STYLE_RULE }
67    
68     ## |CSSStyleRule| attributes
69    
70     ## TODO: |selector_text|
71    
72     sub style ($) {
73     return ${$_[0]}->{style};
74     } # style
75    
76     package Message::DOM::CSSCharsetRule;
77     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSCharsetRule';
78    
79     sub ____new ($$) {
80     return bless \{encoding => $_[1]}, $_[0];
81     } # ____new
82    
83     ## |CSSRule| attributes
84    
85     ## TODO: |css_text|
86    
87     sub type ($) { Message::DOM::CSSRule::CHARSET_RULE }
88    
89     ## |CSSCharsetRule| attribute
90    
91     sub encoding ($) {
92     return ${$_[0]}->{encoding};
93     } # encoding
94    
95     package Message::DOM::CSSImportRule;
96     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSImportRule';
97    
98     sub ____new ($$$$) {
99     my $self = bless \{href => $_[1], media => $_[2], style_sheet => $_[3]}, $_[0];
100     ## TODO: $_[3] owner_style_sheet
101     return $self;
102     } # ____new
103    
104     ## |CSSRule| attributes
105    
106     ## TODO: |css_text|
107    
108     sub type ($) { Message::DOM::CSSRule::IMPORT_RULE }
109    
110     ## |CSSImportRule| attributes
111    
112     sub href ($) {
113     return ${$_[0]}->{href};
114     } # href
115    
116     sub media ($) {
117     return ${$_[0]}->{media};
118     } # media
119    
120     sub style_sheet ($) {
121     return ${$_[0]}->{style_sheet};
122     } # style_sheet
123    
124     package Message::DOM::CSSMediaRule;
125     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSMediaRule';
126    
127     sub ____new ($$$) {
128     my $self = bless \{media => $_[1], css_rules => $_[2]}, $_[0];
129     for (@{$_[2]}) {
130     ## TODO: owner_rule
131     }
132     return $self;
133     } # ____new
134    
135     ## |CSSRule| attributes
136    
137     ## TODO: |css_text|
138    
139     sub type ($) { Message::DOM::CSSRule::MEDIA_RULE }
140    
141     ## |CSSMediaRule| attributes
142    
143     sub css_rules ($) {
144     require Message::DOM::CSSRuleList;
145     return bless \\($_[0]), 'Message::DOM::CSSRuleList';
146     } # css_rules
147    
148     sub media ($) {
149     return ${$_[0]}->{media};
150     } # media
151    
152     package Message::DOM::CSSFontFaceRule;
153     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSFontFaceRule';
154    
155     sub ____new ($$) {
156     my $self = bless \{style => $_[1]}, $_[0];
157     } # ____new
158    
159     ## |CSSRule| attributes
160    
161     ## TODO: |css_text|
162    
163     sub type ($) { Message::DOM::CSSRule::FONT_FACE_RULE }
164    
165     ## |CSSFontFaceRule| attribute
166    
167     sub style ($) {
168     return ${$_[0]}->{style};
169     } # style
170    
171     package Message::DOM::CSSPageRule;
172     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSPageRule';
173    
174     sub ____new ($$$) {
175     my $self = bless \{_selector => $_[1], style => $_[2]}, $_[0];
176     ## TODO: style -> owner
177     return $self;
178     } # ____new
179    
180     ## |CSSRule| attributes
181    
182     ## TODO: |css_text|
183    
184     sub type ($) { Message::DOM::CSSRule::PAGE_RULE }
185    
186     ## |CSSPageRule| attributes
187    
188     ## TODO: |selector_text|
189    
190     sub style ($) {
191     return ${$_[0]}->{style};
192     } # style
193    
194     package Message::DOM::CSSNamespaceRule;
195     push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSNamespaceRule';
196    
197     sub ____new ($$$) {
198     return bless \{namespace_uri => $_[2], prefix => $_[1]}, $_[0];
199     } # ___new
200    
201     ## |CSSRule| attributes
202    
203     ## TODO: |css_text|
204    
205     sub type ($) { Message::DOM::CSSRule::NAMESPACE_RULE }
206    
207     ## |CSSNamespaceRule| attributes
208    
209     sub namespace_uri ($) {
210     return ${$_[0]}->{namespace_uri};
211     } # namespace_uri
212    
213     sub prefix ($) {
214     return ${$_[0]}->{prefix};
215     } # prefix
216    
217     package Message::IF::CSSRule;
218     package Message::IF::CSSStyleRule;
219     package Message::IF::CSSCharsetRule;
220     package Message::IF::CSSImportRule;
221     package Message::IF::CSSMediaRule;
222     package Message::IF::CSSFontFaceRule;
223     package Message::IF::CSSPageRule;
224    
225     1;
226     ## $Date:$

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24