65 |
|
|
66 |
## TODO: Implement other methods and attributes |
## TODO: Implement other methods and attributes |
67 |
|
|
68 |
|
package Message::DOM::CSSComputedStyleDeclaration; |
69 |
|
push our @ISA, 'Message::IF::CSSStyleDeclaration'; |
70 |
|
|
71 |
|
sub ____new ($$$) { |
72 |
|
my $self = bless \{}, shift; |
73 |
|
$$self->{cascade} = shift; # Whatpm::CSS::Cascade object. |
74 |
|
$$self->{element} = shift; ## TODO: This link should be weaken? |
75 |
|
return $self; |
76 |
|
} # ____new |
77 |
|
|
78 |
|
sub css_text ($;$) { |
79 |
|
## TODO: error if modified |
80 |
|
|
81 |
|
my $self = shift; |
82 |
|
require Whatpm::CSS::Parser; |
83 |
|
|
84 |
|
## TODO: ordering |
85 |
|
## TODO: any spec? |
86 |
|
my $r = ''; |
87 |
|
for my $prop_def (grep {$_->{compute}} values %$Whatpm::CSS::Parser::Prop) { |
88 |
|
my $prop_value = $$self->{cascade}->get_computed_value |
89 |
|
($$self->{element}, $prop_def->{css}); |
90 |
|
my $s = $prop_def->{serialize}->($self, $prop_def->{css}, $prop_value); |
91 |
|
if (defined $s) { |
92 |
|
$r .= ' ' . $prop_def->{css} . ': ' . $s; |
93 |
|
$r .= ";\n"; |
94 |
|
} |
95 |
|
} |
96 |
|
return $r; |
97 |
|
} # css_text |
98 |
|
|
99 |
|
## TODO: members |
100 |
|
|
101 |
package Message::IF::CSSStyleDeclaration; |
package Message::IF::CSSStyleDeclaration; |
102 |
|
|
103 |
1; |
1; |