Dompdf\Css\Style
Represents CSS properties.
The Style class is responsible for handling and storing CSS properties.
It includes methods to resolve colors and lengths, as well as getters &
setters for many CSS properites.
Actual CSS parsing is performed in the class.
Synopsis
class Style
{
- // constants
- const CSS_IDENTIFIER = "-?[_a-zA-Z]+[_a-zA-Z0-9-]*";
- const CSS_INTEGER = "-?\d+";
- // members
- public static integer $default_font_size = 12;
- public static float $default_line_height = 1.2;
- public static array<float> $font_size_keywords = ;
- public static array $vertical_align_keywords = ;
- public static array $INLINE_TYPES = ;
- public static array $BLOCK_TYPES = ;
- public static array $POSITIONNED_TYPES = ;
- public static array; $TABLE_TYPES = ;
- public static array $BORDER_STYLES = ;
- protected static $_defaults = NULL;
- protected static $_inherited = NULL;
- protected static array<bool> $_methods_cache = ;
- protected Stylesheet $_stylesheet;
- protected $_media_queries;
- protected $_props;
- protected $_important_props;
- protected $_prop_cache;
- protected $_parent_font_size;
- protected $_font_family;
- protected Frame $_frame;
- protected int $_origin = Stylesheet::ORIG_AUTHOR;
- private bool $__font_size_calculated;
- private $_computed_bottom_spacing = NULL;
- private $_computed_border_radius = NULL;
- public bool $_has_border_radius = false;
- private FontMetrics $fontMetrics;
- // methods
- public void __construct()
- public void dispose()
- public void set_media_queries()
- public array|int get_media_queries()
- public void set_frame()
- public Frame get_frame()
- public void set_origin()
- public int get_origin()
- public Stylesheet get_stylesheet()
- public float|string length_in_pt()
- public Style inherit()
- public void merge()
- public array munge_color()
- public void important_set()
- public bool important_get()
- public void __set()
- public mixed __get()
- public string get_prop()
- public float|null|string computed_bottom_spacing()
- public string get_font_family_raw()
- public string get_font_family()
- public float get_font_size()
- public float get_word_spacing()
- public float get_letter_spacing()
- public float get_line_height()
- public array get_color()
- public array get_background_color()
- public array get_background_position()
- public string get_background_attachment()
- public string get_background_repeat()
- public string get_background()
- public void get_border_top_color()
- public array get_border_right_color()
- public array get_border_bottom_color()
- public array get_border_left_color()
- public void get_border_top_width()
- public float|int|string get_border_right_width()
- public float|int|string get_border_bottom_width()
- public float|int|string get_border_left_width()
- public array get_border_properties()
- protected mixed _get_border()
- public void get_border_top()
- public mixed get_border_right()
- public mixed get_border_bottom()
- public mixed get_border_left()
- public array|null get_computed_border_radius()
- public array get_outline_color()
- public void get_outline_width()
- public void get_outline()
- public array get_border_spacing()
- protected void _set_style_side_type()
- protected void _set_style_sides_type()
- protected void _set_style_type()
- protected void _set_style_type_important()
- protected void _set_style_side_width_important()
- protected void _set_style()
- protected string _image()
- public void set_color()
- public void set_background_color()
- public void set_background_image()
- public void set_background_repeat()
- public void set_background_attachment()
- public void set_background_position()
- public void set_background()
- public void set_font_size()
- public void set_font()
- public void set_page_break_before()
- public void set_page_break_after()
- public void set_margin_top()
- public void set_margin_right()
- public void set_margin_bottom()
- public void set_margin_left()
- public void set_margin()
- public void set_padding_top()
- public void set_padding_right()
- public void set_padding_bottom()
- public void set_padding_left()
- public void set_padding()
- protected void _set_border()
- public void set_border_top()
- public void set_border_right()
- public void set_border_bottom()
- public void set_border_left()
- public void set_border()
- public void set_border_width()
- public void set_border_color()
- public void set_border_style()
- public void set_border_top_left_radius()
- public void set_border_top_right_radius()
- public void set_border_bottom_left_radius()
- public void set_border_bottom_right_radius()
- public void set_border_radius()
- protected void _set_border_radii()
- protected void _set_border_radius_corner()
- public float|int|string get_border_top_left_radius()
- public float|int|string get_border_top_right_radius()
- public float|int|string get_border_bottom_left_radius()
- public float|int|string get_border_bottom_right_radius()
- protected float|int|string _get_border_radius_corner()
- public void set_outline()
- public void set_outline_width()
- public void set_outline_color()
- public void set_outline_style()
- public void set_border_spacing()
- public void set_list_style_image()
- public void set_list_style()
- public void set_size()
- public array|null get_transform()
- public void set_transform()
- public void set__webkit_transform()
- public void set__webkit_transform_origin()
- public void set_transform_origin()
- public array get_transform_origin()
- protected null parse_image_resolution()
- public void set_background_image_resolution()
- public void set_image_resolution()
- public void set__dompdf_background_image_resolution()
- public void set__dompdf_image_resolution()
- public void set_z_index()
- public void set_counter_increment()
- public $this setFontMetrics()
- public FontMetrics getFontMetrics()
- public void __toString()
- public void debug_print()
Constants
Name | Value |
---|---|
CSS_IDENTIFIER | "-?[_a-zA-Z]+[_a-zA-Z0-9-]*" |
CSS_INTEGER | "-?\d+" |
Members
private
- $__font_size_calculated
—
Dompdf\Css\bool
True once the font size is resolved absolutely -
$_computed_border_radius
The computed border radius -
$_computed_bottom_spacing
The computed bottom spacing - $fontMetrics — Dompdf\FontMetrics
protected
- $_defaults
—
array
Default style values. - $_font_family
- $_frame — Dompdf\Frame
- $_important_props
- $_inherited
—
array
List of inherited properties - $_media_queries
—
int
Media queries attached to the style - $_methods_cache
—
Dompdf\Css\array<bool>
Caches method_exists result - $_origin
—
int
The origin of the style - $_parent_font_size
—
float
Font size of parent element in document tree. Used for relative font size resolution. - $_prop_cache
—
array
Cached property values - $_props
—
array
Main array of all CSS properties & values - $_stylesheet
—
Dompdf\Css\Stylesheet
The stylesheet this style belongs to
public
- $BLOCK_TYPES
—
array
List of all block types. Should really be a constant. - $BORDER_STYLES
—
array
List of valid border styles. Should also really be a constant. - $INLINE_TYPES
—
array
List of all inline types. Should really be a constant. - $POSITIONNED_TYPES
—
array
List of all positionned types. Should really be a constant. - $TABLE_TYPES
—
Dompdf\Css\array;
List of all table types. Should really be a constant. - $_has_border_radius — Dompdf\Css\bool
- $default_font_size
—
float
Default font size, in points. - $default_line_height
—
float
Default line height, as a fraction of the font size. - $font_size_keywords
—
Dompdf\Css\array<float>
Default "absolute" font sizes relative to the default font-size http://www.w3.org/TR/css3-fonts/#font-size-the-font-size-property - $vertical_align_keywords
—
array
List of valid vertical-align keywords. Should also really be a constant.
Methods
protected
- _get_border() — Return a single border property
- _get_border_radius_corner()
- _image()
- _set_border() — Sets a single border
- _set_border_radii()
- _set_border_radius_corner()
- _set_style()
- _set_style_side_type() — Generalized set function for individual attribute of combined style.
- _set_style_side_width_important() — Anyway only called if _important matches and is assigned E.g. _set_style_side_type($style,$side,'',str_replace("none", "0px", $val),isset($this->_important_props[$style.'_'.$side]));
- _set_style_sides_type()
- _set_style_type()
- _set_style_type_important()
- parse_image_resolution()
public
- __construct() — Class constructor
- __get() — PHP5 overloaded getter Along with {@link Style::__set()} __get() provides access to all CSS properties directly. Typically __get() is not called directly outside of this class.
- __set() — PHP5 overloaded setter
- __toString()
- computed_bottom_spacing()
- debug_print()
- dispose() — "Destructor": forcibly free all references held by this object
- getFontMetrics()
- get_background() — Returns the background as it is currently stored
- get_background_attachment() — Returns the background as it is currently stored
- get_background_color() — Returns the background color as an array
- get_background_position() — Returns the background position as an array
- get_background_repeat() — Returns the background_repeat as it is currently stored
- get_border_bottom()
- get_border_bottom_color()
- get_border_bottom_left_radius()
- get_border_bottom_right_radius()
- get_border_bottom_width()
- get_border_left()
- get_border_left_color()
- get_border_left_width()
- get_border_properties() — Return an array of all border properties.
- get_border_right()
- get_border_right_color()
- get_border_right_width()
- get_border_spacing() — Returns border spacing as an array
- get_border_top()
- get_border_top_color()
- get_border_top_left_radius()
- get_border_top_right_radius()
- get_border_top_width()
- get_color() — Returns the color as an array
- get_computed_border_radius()
- get_font_family() — Getter for the 'font-family' CSS property.
- get_font_family_raw()
- get_font_size() — Returns the resolved font size, in points
- get_frame()
- get_letter_spacing()
- get_line_height()
- get_media_queries()
- get_origin()
- get_outline()
- get_outline_color() — Returns the outline color as an array
- get_outline_width()
- get_prop() — Similar to __get() without storing the result. Useful for accessing properties while loading stylesheets.
- get_stylesheet() — returns the {@link Stylesheet} this Style is associated with.
- get_transform() — Gets the CSS3 transform property
- get_transform_origin() — Gets the CSS3 transform-origin property
- get_word_spacing()
- important_get()
- important_set()
- inherit() — Set inherited properties in this style using values in $parent
- length_in_pt() — Converts any CSS length value into an absolute length in points.
- merge() — Override properties in this style with those in $style
- munge_color() — Returns an array(r, g, b, "r"=> r, "g"=>g, "b"=>b, "hex"=>"#rrggbb") based on the provided CSS color value.
- setFontMetrics()
- set__dompdf_background_image_resolution()
- set__dompdf_image_resolution()
- set__webkit_transform()
- set__webkit_transform_origin()
- set_background() — Sets the background - combined options
- set_background_attachment() — Sets the background attachment
- set_background_color() — Sets the background color
- set_background_image() — Set the background image url
- set_background_image_resolution() — auto | normal | dpi
- set_background_position() — Sets the background position
- set_background_repeat() — Sets the background repeat
- set_border()
- set_border_bottom()
- set_border_bottom_left_radius()
- set_border_bottom_right_radius()
- set_border_color()
- set_border_left()
- set_border_radius()
- set_border_right()
- set_border_spacing() — Sets the border spacing
- set_border_style()
- set_border_top() — Sets the border styles
- set_border_top_left_radius() — Sets the border radius size
- set_border_top_right_radius()
- set_border_width()
- set_color() — Sets color
- set_counter_increment()
- set_font() — Sets the font style
- set_font_size() — Sets the font size
- set_frame()
- set_image_resolution() — auto | normal | dpi
- set_list_style() — Sets the list style
- set_list_style_image() — Sets the list style image
- set_margin()
- set_margin_bottom()
- set_margin_left()
- set_margin_right()
- set_margin_top() — Sets the margin size
- set_media_queries()
- set_origin()
- set_outline() — Sets the outline styles
- set_outline_color()
- set_outline_style()
- set_outline_width()
- set_padding()
- set_padding_bottom()
- set_padding_left()
- set_padding_right()
- set_padding_top() — Sets the padding size
- set_page_break_after()
- set_page_break_before() — Sets page break properties
- set_size()
- set_transform()
- set_transform_origin() — Sets the CSS3 transform-origin property
- set_z_index()