Top Inners Fields Constructors Methods
com.openhtmltopdf.css.newmatch

public Class Matcher

extends Object
Class Inheritance
Imports
java.util.ArrayDeque, .ArrayList, .Collection, .Collections, .Comparator, .Deque, .HashMap, .HashSet, .List, .Map, .Set, .TreeMap, java.util.logging.Level, com.openhtmltopdf.css.constants.MarginBoxName, com.openhtmltopdf.css.extend.AttributeResolver, .StylesheetFactory, .TreeResolver, com.openhtmltopdf.css.sheet.*, com.openhtmltopdf.util.LogMessageId, .XRLog

Author
Torbjoern Gannholm

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
pack-priv class
Matcher.Mapper

Mapper represents a local CSS for a Node that is used to match the Node's children.

Field Summary

Modifier and TypeField and Description
private final Set<Object>
private final AttributeResolver
private final Set<Object>
private final List<FontFaceRule>
private final Set<Object>
private final Map<Object, Matcher.Mapper>
private final List<PageRule>
private final StylesheetFactory
private final TreeResolver
private final Set<Object>
private final Matcher.Mapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addAllStylesheets(List<Stylesheet> stylesheets, TreeMap<String, Selector> sorter, String medium)

pack-priv Matcher.Mapper
public CascadedStyle
getCascadedStyle(Object e, boolean restyle)

public String
getCSSForAllDescendants(Object e)

Returns CSS rulesets for descendants of e.

private Ruleset
public List<FontFaceRule>
private Matcher.Mapper
private Ruleset
public PageInfo
getPageCascadedStyle(String pageName, String pseudoPage)

public CascadedStyle
getPECascadedStyle(Object e, String pseudoElement)

May return null.

public boolean
public boolean
public boolean
private static boolean
public boolean
protected Matcher.Mapper
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_activeElementsback to summary
private final Set<Object> _activeElements
_attResback to summary
private final AttributeResolver _attRes
_focusElementsback to summary
private final Set<Object> _focusElements
_fontFaceRulesback to summary
private final List<FontFaceRule> _fontFaceRules
_hoverElementsback to summary
private final Set<Object> _hoverElements
_mapback to summary
private final Map<Object, Matcher.Mapper> _map
_pageRulesback to summary
private final List<PageRule> _pageRules
_styleFactoryback to summary
private final StylesheetFactory _styleFactory
_treeResback to summary
private final TreeResolver _treeRes
_visitElementsback to summary
private final Set<Object> _visitElements
docMapperback to summary
private final Matcher.Mapper docMapper

Constructor Detail

Matcherback to summary
public Matcher(TreeResolver tr, AttributeResolver ar, StylesheetFactory factory, List<Stylesheet> stylesheets, String medium)

Method Detail

addAllStylesheetsback to summary
private void addAllStylesheets(List<Stylesheet> stylesheets, TreeMap<String, Selector> sorter, String medium)
createDocumentMapperback to summary
pack-priv Matcher.Mapper createDocumentMapper(List<Stylesheet> stylesheets, String medium)
getCascadedStyleback to summary
public CascadedStyle getCascadedStyle(Object e, boolean restyle)
getCSSForAllDescendantsback to summary
public String getCSSForAllDescendants(Object e)

Returns CSS rulesets for descendants of e. For example, if e is an svg element and we have the ruleset 'svg rect { .. }' then the string returned will be 'rect { .. }'. FIXME: Does not correctly handle sibling selectors.

getElementStyleback to summary
private Ruleset getElementStyle(Object e)
getFontFaceRulesback to summary
public List<FontFaceRule> getFontFaceRules()
getMapperback to summary
private Matcher.Mapper getMapper(Object e)
getNonCssStyleback to summary
private Ruleset getNonCssStyle(Object e)
getPageCascadedStyleback to summary
public PageInfo getPageCascadedStyle(String pageName, String pseudoPage)
getPECascadedStyleback to summary
public CascadedStyle getPECascadedStyle(Object e, String pseudoElement)

May return null. We assume that restyle has already been done by a getCascadedStyle if necessary.

isActiveStyledback to summary
public boolean isActiveStyled(Object e)
isFocusStyledback to summary
public boolean isFocusStyled(Object e)
isHoverStyledback to summary
public boolean isHoverStyled(Object e)
isNullOrEmptyback to summary
private static boolean isNullOrEmpty(String str)
isVisitedStyledback to summary
public boolean isVisitedStyled(Object e)
matchElementback to summary
protected Matcher.Mapper matchElement(Object e)
com.openhtmltopdf.css.newmatch back to summary

public Class Matcher.AllDescendantMapper

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final AttributeResolver
private final List<Selector>
private final List<Selector>
private final Set<Selector>
private final TreeResolver

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attResback to summary
private final AttributeResolver attRes
axesback to summary
private final List<Selector> axes
mappedSelectorsback to summary
private final List<Selector> mappedSelectors
topSelectorsback to summary
private final Set<Selector> topSelectors
treeResback to summary
private final TreeResolver treeRes

Constructor Detail

AllDescendantMapperback to summary
pack-priv AllDescendantMapper(List<Selector> axes, AttributeResolver attRes, TreeResolver treeRes)

Method Detail

mapback to summary
pack-priv void map(Object e)
toCSSback to summary
pack-priv String toCSS()
com.openhtmltopdf.css.newmatch back to summary

pack-priv Class Matcher.Mapper

extends Object
Class Inheritance

Mapper represents a local CSS for a Node that is used to match the Node's children.
Author
Torbjoern Gannholm

Field Summary

Modifier and TypeField and Description
private final List<Selector>
private Map<String, Matcher.Mapper>
private final List<Selector>
private final Map<String, List<Selector>>

Constructor Summary

AccessConstructor and Description
pack-priv
private
Mapper(List<Selector> axes, List<Selector> mappedSelectors, Map<String, List<Selector>> pseudoSelectors)

Method Summary

Modifier and TypeMethod and Description
pack-priv CascadedStyle
public CascadedStyle
getPECascadedStyle(Object e, String pseudoElement)

May return null.

pack-priv Matcher.Mapper

Returns:

The selectors that matched, sorted according to specificity (more correct: preserves the sort order from Matcher creation)
mapChild
(Object e)

Side effect: creates and stores a Mapper for the element

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

axesback to summary
private final List<Selector> axes
childrenback to summary
private Map<String, Matcher.Mapper> children
mappedSelectorsback to summary
private final List<Selector> mappedSelectors
pseudoSelectorsback to summary
private final Map<String, List<Selector>> pseudoSelectors

Constructor Detail

Mapperback to summary
pack-priv Mapper(Collection<Selector> selectors)
Mapperback to summary
private Mapper(List<Selector> axes, List<Selector> mappedSelectors, Map<String, List<Selector>> pseudoSelectors)

Method Detail

getCascadedStyleback to summary
pack-priv CascadedStyle getCascadedStyle(Object e)
getPECascadedStyleback to summary
public CascadedStyle getPECascadedStyle(Object e, String pseudoElement)

May return null. We assume that restyle has already been done by a getCascadedStyle if necessary.

mapChildback to summary
pack-priv Matcher.Mapper mapChild(Object e)

Side effect: creates and stores a Mapper for the element

Returns:Matcher.Mapper

The selectors that matched, sorted according to specificity (more correct: preserves the sort order from Matcher creation)