1   package org.daisy.pipeline.css;
2   
3   import java.util.Optional;
4   
5   import org.daisy.common.xpath.saxon.ExtensionFunctionProvider;
6   import org.daisy.common.xpath.saxon.ReflexiveExtensionFunctionProvider;
7   
8   import org.osgi.service.component.annotations.Component;
9   
10  import org.w3c.dom.Element;
11  
12  public interface StyleAccessor {
13  
14  	@Component(
15  		name = "StyleAccesor",
16  		service = { ExtensionFunctionProvider.class }
17  	)
18  	public static class Provider extends ReflexiveExtensionFunctionProvider {
19  		public Provider() {
20  			super(StyleAccessor.class);
21  		}
22  	}
23  
24  	/**
25  	 * Get the <a
26  	 * href="https://www.w3.org/TR/2013/CR-css-cascade-3-20131003/#specified">specified
27  	 * value</a> of a CSS property and element.
28  	 */
29  	public Optional<String> get(Element element, String property);
30  
31  	/**
32  	 * Test whether an element matches a CSS selector.
33  	 *
34  	 * @throws IllegalArgumentException if the selector can not be compiled
35  	 */
36  	public boolean matches(Element element, String selector);
37  
38  }