line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CSS::DOM::Rule::Page; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.16'; |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
917
|
use warnings; no warnings qw 'utf8 parenthesis'; |
|
3
|
|
|
3
|
|
6
|
|
|
3
|
|
|
|
|
113
|
|
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
117
|
|
6
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
77
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
534
|
use CSS::DOM::Exception qw/ SYNTAX_ERR /; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
166
|
|
9
|
3
|
|
|
3
|
|
576
|
use CSS::DOM::Rule; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
232
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = 'CSS::DOM::Rule'; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
215
|
use constant 1.03 our $_const = { |
14
|
|
|
|
|
|
|
# Don't let this conflict with the superclass. |
15
|
|
|
|
|
|
|
styl => 2, |
16
|
|
|
|
|
|
|
selc => 3, |
17
|
3
|
|
|
3
|
|
15
|
}; |
|
3
|
|
|
|
|
76
|
|
18
|
3
|
|
|
3
|
|
16
|
{ no strict; delete @{__PACKAGE__.'::'}{_const => keys %{our $_const}} } |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1156
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# overrides: |
21
|
|
|
|
|
|
|
|
22
|
8
|
|
|
8
|
1
|
34
|
sub type { CSS::DOM::Rule::PAGE_RULE } |
23
|
|
|
|
|
|
|
sub cssText { |
24
|
11
|
|
|
11
|
1
|
27
|
my $self = shift; |
25
|
11
|
|
|
|
|
14
|
my $old; |
26
|
11
|
100
|
|
|
|
37
|
if(defined wantarray) { |
27
|
10
|
|
|
|
|
49
|
$old = "$self->[selc] { " |
28
|
|
|
|
|
|
|
. $self->[styl]->cssText ." }\n"; |
29
|
|
|
|
|
|
|
} |
30
|
11
|
100
|
|
|
|
38
|
if (@_) { |
31
|
2
|
|
|
|
|
19
|
require CSS::DOM::Parser; |
32
|
2
|
|
|
|
|
15
|
my $new_rule = $self->_parse(shift); |
33
|
1
|
|
|
|
|
13
|
@$self[styl,selc] = @$new_rule[styl,selc]; |
34
|
|
|
|
|
|
|
} |
35
|
10
|
|
|
|
|
51
|
$old; |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# CSSPageRule interface: |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub selectorText { |
42
|
16
|
|
|
16
|
1
|
41
|
my $old = (my $self = shift)->[selc]; |
43
|
16
|
100
|
|
|
|
45
|
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
|
|
|
|
87
|
(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
|
|
|
|
|
33
|
$self->[selc] = $sel ; |
52
|
|
|
|
|
|
|
} |
53
|
15
|
|
|
|
|
40
|
$old; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# ~~~ Do we need this? |
57
|
|
|
|
|
|
|
#sub _set_selector_tokens { |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
#} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub style { |
62
|
16
|
|
66
|
16
|
1
|
505
|
$_[0]->[styl] ||= do { |
63
|
14
|
|
|
|
|
71
|
require CSS::DOM::Style; |
64
|
14
|
|
|
|
|
63
|
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.16 |
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 |