line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CSS::DOM::Rule::Page; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.17'; |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
1209
|
use warnings; no warnings qw 'utf8 parenthesis'; |
|
3
|
|
|
3
|
|
7
|
|
|
3
|
|
|
|
|
101
|
|
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
156
|
|
6
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
108
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
603
|
use CSS::DOM::Exception qw/ SYNTAX_ERR /; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
131
|
|
9
|
3
|
|
|
3
|
|
342
|
use CSS::DOM::Rule; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
165
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = 'CSS::DOM::Rule'; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
170
|
use constant 1.03 our $_const = { |
14
|
|
|
|
|
|
|
# Don't let this conflict with the superclass. |
15
|
|
|
|
|
|
|
styl => 2, |
16
|
|
|
|
|
|
|
selc => 3, |
17
|
3
|
|
|
3
|
|
14
|
}; |
|
3
|
|
|
|
|
43
|
|
18
|
3
|
|
|
3
|
|
13
|
{ no strict; delete @{__PACKAGE__.'::'}{_const => keys %{our $_const}} } |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
857
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# overrides: |
21
|
|
|
|
|
|
|
|
22
|
8
|
|
|
8
|
1
|
29
|
sub type { CSS::DOM::Rule::PAGE_RULE } |
23
|
|
|
|
|
|
|
sub cssText { |
24
|
11
|
|
|
11
|
1
|
22
|
my $self = shift; |
25
|
11
|
|
|
|
|
12
|
my $old; |
26
|
11
|
100
|
|
|
|
22
|
if(defined wantarray) { |
27
|
10
|
|
|
|
|
33
|
$old = "$self->[selc] { " |
28
|
|
|
|
|
|
|
. $self->[styl]->cssText ." }\n"; |
29
|
|
|
|
|
|
|
} |
30
|
11
|
100
|
|
|
|
23
|
if (@_) { |
31
|
2
|
|
|
|
|
9
|
require CSS::DOM::Parser; |
32
|
2
|
|
|
|
|
9
|
my $new_rule = $self->_parse(shift); |
33
|
1
|
|
|
|
|
8
|
@$self[styl,selc] = @$new_rule[styl,selc]; |
34
|
|
|
|
|
|
|
} |
35
|
10
|
|
|
|
|
35
|
$old; |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# CSSPageRule interface: |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub selectorText { |
42
|
16
|
|
|
16
|
1
|
27
|
my $old = (my $self = shift)->[selc]; |
43
|
16
|
100
|
|
|
|
32
|
if(@_){ |
44
|
|
|
|
|
|
|
# ~~~ I need to make this use the parser’s tokenise func. |
45
|
|
|
|
|
|
|
# need tests as well; this shouldn’t accept anything |
46
|
|
|
|
|
|
|
# that would make it technically an unknown rule. |
47
|
14
|
100
|
|
|
|
56
|
(my $sel = shift) =~ |
48
|
|
|
|
|
|
|
/^[ \t\r\n\f]*\@page(?![_a-z\200-\377]|\\[^\r\n\f])/ |
49
|
|
|
|
|
|
|
or die CSS::DOM::Exception->new(SYNTAX_ERR, |
50
|
|
|
|
|
|
|
'@page selectors must begin with "@page"'); |
51
|
13
|
|
|
|
|
25
|
$self->[selc] = $sel ; |
52
|
|
|
|
|
|
|
} |
53
|
15
|
|
|
|
|
24
|
$old; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# ~~~ Do we need this? |
57
|
|
|
|
|
|
|
#sub _set_selector_tokens { |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
#} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub style { |
62
|
16
|
|
66
|
16
|
1
|
355
|
$_[0]->[styl] ||= do { |
63
|
14
|
|
|
|
|
54
|
require CSS::DOM::Style; |
64
|
14
|
|
|
|
|
36
|
new CSS::DOM::Style shift |
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
!()__END__()! |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
CSS::DOM::Rule::Page - CSS @page rule class for CSS::DOM |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Version 0.17 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
use CSS::DOM; |
81
|
|
|
|
|
|
|
my $page_rule = CSS::DOM->parse( |
82
|
|
|
|
|
|
|
'@page :first { stuff: other stuff }' |
83
|
|
|
|
|
|
|
)->cssRules->[0]; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$page_rule->selectorText; # '@page :first' |
86
|
|
|
|
|
|
|
$page_rule->style; # a CSS::DOM::Style object |
87
|
|
|
|
|
|
|
$page_rule->style->stuff; # 'other stuff' |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 DESCRIPTION |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This module implements CSS @page rules for L. It inherits |
92
|
|
|
|
|
|
|
from |
93
|
|
|
|
|
|
|
L and implements |
94
|
|
|
|
|
|
|
the CSSPageRule DOM interface. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 METHODS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item selectorText |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns a string representing the selector(s). Pass an argument to set it. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item style |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns the CSS::DOM::Style object representing the declaration block |
107
|
|
|
|
|
|
|
of this rule. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |