.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "CSS::DOM::Value::Primitive 3pm" .TH CSS::DOM::Value::Primitive 3pm "2018-02-12" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CSS::DOM::Value::Primitive \- CSSPrimitiveValue class for CSS::DOM .SH "VERSION" .IX Header "VERSION" Version 0.17 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& # ... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements objects that represent \s-1CSS\s0 primitive property values (as opposed to lists). It implements the \s-1DOM\s0 CSSPrimitiveValue, Rect, and RGBColor interfaces. .SH "METHODS" .IX Header "METHODS" If you need the constructor, it's below the object methods. Normally you would get an object via CSS::DOM::Style's \f(CW\*(C`getPropertyCSSValue\*(C'\fR method. .SS "CSSValue Interface" .IX Subsection "CSSValue Interface" .IP "cssText" 4 .IX Item "cssText" Returns a string representation of the attribute. Pass an argument to set it. .IP "cssValueType" 4 .IX Item "cssValueType" Returns \f(CW\*(C`CSS::DOM::Value::CSS_PRIMITIVE_VALUE\*(C'\fR. .SS "CSSPrimitiveValue Interface" .IX Subsection "CSSPrimitiveValue Interface" .IP "primitiveType" 4 .IX Item "primitiveType" Returns one of the \*(L"\s-1CONSTANTS\*(R"\s0 listed below. .IP "getFloatValue" 4 .IX Item "getFloatValue" Returns a number if the value is numeric. .PP The rest have still to be implemented. .SS "Rect Interface" .IX Subsection "Rect Interface" The four methods \f(CW\*(C`top\*(C'\fR, \f(CW\*(C`right\*(C'\fR, \f(CW\*(C`bottom\*(C'\fR and \f(CW\*(C`left\*(C'\fR each return another value object representing the individual value. .SS "RGBColor Interface" .IX Subsection "RGBColor Interface" The four methods \f(CW\*(C`red\*(C'\fR, \f(CW\*(C`green\*(C'\fR, \f(CW\*(C`blue\*(C'\fR and \f(CW\*(C`alpha\*(C'\fR each return another value object representing the individual value. .SS "Constructor" .IX Subsection "Constructor" You probably don't need to call this, but here it is anyway: .PP .Vb 1 \& $val = new CSS::DOM::Value::Primitive:: %args; .Ve .PP The hash-style arguments are as follows. Only \f(CW\*(C`type\*(C'\fR and \f(CW\*(C`value\*(C'\fR are required. .IP "type" 4 .IX Item "type" One of the constants listed below under \*(L"\s-1CONSTANTS\*(R"\s0 .IP "value" 4 .IX Item "value" The data stored inside the value object. The format expected depends on the type. See below. .IP "css" 4 .IX Item "css" \&\s-1CSS\s0 code used for serialisation. This will make reading \f(CW\*(C`cssText\*(C'\fR faster at least until the value is modified. .IP "owner" 4 .IX Item "owner" The style object that owns this value; if this is omitted, then the value is read-only. The value object holds a weak reference to the owner. .IP "property" 4 .IX Item "property" The name of the \s-1CSS\s0 property to which this value belongs. \f(CW\*(C`cssText\*(C'\fR uses this to determine how to parse text passed to it. This does not apply to the sub-values of colours, counters and rects, but it \fIdoes\fR apply to individual elements of a list value. .IP "index" 4 .IX Item "index" The index of this value within a list value (only applies to elements of a list, of course). .IP "format" 4 .IX Item "format" This is used by sub-values of colours and rects. It determines how assignment to \f(CW\*(C`cssText\*(C'\fR is handled. This uses the same syntax as the formats in CSS::DOM::PropertyParser. .PP Here are the formats for the \f(CW\*(C`value\*(C'\fR argument, which depend on the type: .IP "\s-1CSS_UNKNOWN\s0" 4 .IX Item "CSS_UNKNOWN" A string of \s-1CSS\s0 code. .IP "\s-1CSS_NUMBER, CSS_PERCENTAGE\s0" 4 .IX Item "CSS_NUMBER, CSS_PERCENTAGE" A simple scalar containing a number. .IP "Standard Dimensions" 4 .IX Item "Standard Dimensions" Also a simple scalar containing a number. .Sp This applies to \f(CW\*(C`CSS_EMS\*(C'\fR, \f(CW\*(C`CSS_EXS\*(C'\fR, \f(CW\*(C`CSS_PX\*(C'\fR, \f(CW\*(C`CSS_CM\*(C'\fR, \f(CW\*(C`CSS_MM\*(C'\fR, \f(CW\*(C`CSS_IN\*(C'\fR, \f(CW\*(C`CSS_PT\*(C'\fR, \f(CW\*(C`CSS_PC\*(C'\fR, \f(CW\*(C`CSS_DEG\*(C'\fR, \f(CW\*(C`CSS_RAD\*(C'\fR, \f(CW\*(C`CSS_GRAD\*(C'\fR, \f(CW\*(C`CSS_MS\*(C'\fR, \f(CW\*(C`CSS_S\*(C'\fR, \f(CW\*(C`CSS_HZ\*(C'\fR and \f(CW\*(C`CSS_KHZ\*(C'\fR. .IP "\s-1CSS_DIMENSION\s0" 4 .IX Item "CSS_DIMENSION" An array ref: \f(CW\*(C`[$number, $unit_text]\*(C'\fR .IP "\s-1CSS_STRING\s0" 4 .IX Item "CSS_STRING" A simple scalar containing a string (not a \s-1CSS\s0 string literal; i.e., no quotes or escapes). .IP "\s-1CSS_URI\s0" 4 .IX Item "CSS_URI" The \s-1URL\s0 (not a \s-1CSS\s0 literal) .IP "\s-1CSS_IDENT\s0" 4 .IX Item "CSS_IDENT" A string (no escapes) .IP "\s-1CSS_ATTR\s0" 4 .IX Item "CSS_ATTR" A string containing the name of the attribute. .IP "\s-1CSS_COUNTER\s0" 4 .IX Item "CSS_COUNTER" An array ref: \f(CW\*(C`[$name, $separator, $style]\*(C'\fR .Sp \&\f(CW$separator\fR and \f(CW$style\fR may each be \f(CW\*(C`undef\*(C'\fR. If \f(CW$separator\fR is \&\f(CW\*(C`undef\*(C'\fR, the object represents a \f(CW\*(C`counter(...)\*(C'\fR. Otherwise it represents \&\f(CW\*(C`counters(...)\*(C'\fR. .IP "\s-1CSS_RECT\s0" 4 .IX Item "CSS_RECT" An array ref: \f(CW\*(C`[$top, $right, $bottom, $left]\*(C'\fR .Sp The four elements are either CSSValue objects or array refs of arguments to be passed to the constructor. E.g.: .Sp .Vb 6 \& [ \& [type => CSS_PX, value => 20], \& [type => CSS_PERCENTAGE, value => 50], \& [type => CSS_PERCENTAGE, value => 50], \& [type => CSS_PX, value => 50], \& ] .Ve .Sp When these array refs are converted to objects, the \f(CW\*(C`format\*(C'\fR argument is supplied automatically, so you do not need to include it here. .IP "\s-1CSS_RGBCOLOR\s0" 4 .IX Item "CSS_RGBCOLOR" A string beginning with '#', with no escapes (such as '#fff' or '#c0ffee'), a colour name (like red) or an array ref with three to four elements: .Sp .Vb 2 \& [$r, $g, $b] \& [$r, $g, $b, $alpha] .Ve .Sp The elements are either CSSValue objects or array refs of argument lists, as with \f(CW\*(C`CSS_RECT\*(C'\fR. .SH "CONSTANTS" .IX Header "CONSTANTS" The following constants can be imported with \&\f(CW\*(C`use CSS::DOM::Value::Primitive \*(Aq:all\*(Aq\*(C'\fR. They represent the type of primitive value. .IP "\s-1CSS_UNKNOWN\s0" 4 .IX Item "CSS_UNKNOWN" .PD 0 .IP "\s-1CSS_NUMBER\s0" 4 .IX Item "CSS_NUMBER" .IP "\s-1CSS_PERCENTAGE\s0" 4 .IX Item "CSS_PERCENTAGE" .IP "\s-1CSS_EMS\s0" 4 .IX Item "CSS_EMS" .IP "\s-1CSS_EXS\s0" 4 .IX Item "CSS_EXS" .IP "\s-1CSS_PX\s0" 4 .IX Item "CSS_PX" .IP "\s-1CSS_CM\s0" 4 .IX Item "CSS_CM" .IP "\s-1CSS_MM\s0" 4 .IX Item "CSS_MM" .IP "\s-1CSS_IN\s0" 4 .IX Item "CSS_IN" .IP "\s-1CSS_PT\s0" 4 .IX Item "CSS_PT" .IP "\s-1CSS_PC\s0" 4 .IX Item "CSS_PC" .IP "\s-1CSS_DEG\s0" 4 .IX Item "CSS_DEG" .IP "\s-1CSS_RAD\s0" 4 .IX Item "CSS_RAD" .IP "\s-1CSS_GRAD\s0" 4 .IX Item "CSS_GRAD" .IP "\s-1CSS_MS\s0" 4 .IX Item "CSS_MS" .IP "\s-1CSS_S\s0" 4 .IX Item "CSS_S" .IP "\s-1CSS_HZ\s0" 4 .IX Item "CSS_HZ" .IP "\s-1CSS_KHZ\s0" 4 .IX Item "CSS_KHZ" .IP "\s-1CSS_DIMENSION\s0" 4 .IX Item "CSS_DIMENSION" .IP "\s-1CSS_STRING\s0" 4 .IX Item "CSS_STRING" .IP "\s-1CSS_URI\s0" 4 .IX Item "CSS_URI" .IP "\s-1CSS_IDENT\s0" 4 .IX Item "CSS_IDENT" .IP "\s-1CSS_ATTR\s0" 4 .IX Item "CSS_ATTR" .IP "\s-1CSS_COUNTER\s0" 4 .IX Item "CSS_COUNTER" .IP "\s-1CSS_RECT\s0" 4 .IX Item "CSS_RECT" .IP "\s-1CSS_RGBCOLOR\s0" 4 .IX Item "CSS_RGBCOLOR" .PD .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1CSS::DOM\s0 .PP CSS::DOM::Value .PP CSS::DOM::Value::List .PP CSS::DOM::Style