DOM/Rule/FontFace.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 95.1% 59 / 62 CC 4 SCAR 4.8
CC
4
Cov
98%
cssText
3.0
style
2.0
BEGIN
1.0
CRAP 1.6
« DOM/Rule/Page.pm ↑ Summary DOM/Rule/Charset.pm »
1 package CSS::DOM::Rule::FontFace;
2  
3 3 $VERSION = '0.16';
4  
5 3 ▶use warnings; no warnings qw 'utf8 parenthesis';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use CSS::DOM::Exception qw/ SYNTAX_ERR /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶ use CSS::DOM::Rule;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 our @ISA = 'CSS::DOM::Rule';
12  
13 use constant # Don't let this conflict with the superclass.
14 3 ▶ styl => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶{ no strict 'refs'; delete ${__PACKAGE__.'::'}{styl} }
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # overrides:
18  
19 6 ▶sub type { CSS::DOM::Rule::FONT_FACE_RULE }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
20 sub cssText {
21 8 ▶ my $self = shift;
Subroutine cssText: called CC=3 SCAR=11.0
Pod documented
22 8 my $old;
23 8 ▶ if(defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray) 7 1 8
24 7 $old = "\@font-face { "
25 . $self->[styl]->cssText ." }\n";
26 }
27 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 6 8
28 2 require CSS::DOM::Parser;
29 2 my $new_rule = $self->_parse(shift);
30 1 @$self[styl] = @$new_rule[styl];
31 }
32 7 $old;
33 };
34  
35  
36 # CSSFontFaceRule interface:
37  
38 sub style {
39 10 ▶ $_[0]->[styl] ||= do {
Subroutine style: called CC=2 SCAR=7.0
Pod documented
Condition66%2/3
$_[0][2] ||= do { require CSS::DOM::Style; "CSS::DOM::Style"->new(shift()) }
l!l&&r!l&&!r
280
MC/DC0%0/2
$_[0][2] ||= do { require CSS::DOM::Style; "CSS::DOM::Style"->new(shift()) }
$_[0][2] do { require CSS::DOM::Style; "CSS::DOM::Style"->new(shift()) }
Truth table66%2/3
A ||= B
A= $_[0][2]B= do { require CSS::DOM::Style; "CSS::DOM::Style"->new(shift()) }
ABresult
1X1
011
000
40 8 require CSS::DOM::Style;
41 8 new CSS::DOM::Style shift
42 };
43 }
44  
45 3 !()__END__()!
46  
47 =head1 NAME
48  
49 CSS::DOM::Rule::FontFace - CSS @font-face rule class for CSS::DOM
50  
51 =head1 VERSION
52  
53 Version 0.16
54  
55 =head1 SYNOPSIS
56  
57 use CSS::DOM;
58 my $font_face_rule = CSS::DOM->parse(
59 '@font-face { font-family: "bm"; src: url(blackmoor.ttf) }'
60 )->cssRules->[0];
61  
62 $page_rule->style; # a CSS::DOM::Style object
63 $page_rule->style->src; # 'url(blackmoor.ttf)'
64  
65 =head1 DESCRIPTION
66  
67 This module implements CSS @font-face rules for L<CSS::DOM>. It inherits
68 from
69 L<CSS::DOM::Rule> and implements
70 the CSSFontFaceRule DOM interface.
71  
72 =head1 THE METHOD
73  
74 =over 4
75  
76 =item style
77  
78 Returns the CSS::DOM::Style object representing the declaration block
79 of this rule.
80  
81 =back
82  
83 =head1 SEE ALSO
84  
85 L<CSS::DOM>
86  
87 L<CSS::DOM::Style>
88  
89 L<CSS::DOM::Rule>
« DOM/Rule/Page.pm ↑ Summary DOM/Rule/Charset.pm »