@Override protected boolean operation(int i, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { final Set<Clip> allowedClips = EnumSet.of(Clip.AUTO); Clip clip = null; if (terms.get(i) instanceof TermIdent && (clip = genericPropertyRaw(Clip.class, allowedClips, (TermIdent) terms.get(i))) != null) { properties.put(names.get(i), clip); return true; } else return genericTermLength(terms.get(i), names.get(i), Clip.rect, false, properties, values); } }
/** * Converts TermIdent into value of enum of given class and stores it into * properties map under key property * * @param <T> * Enum & CSSProperty limitation * @param enumType * Type of enum which instance is retrieved * @param term * Term with value to be converted * @param avoidInherit * If <code>true</code> inherit value is not considered valid * @param properties * Properties map where to store value * @param propertyName * Name under which property is stored in map * @return <code>true</code> in case of success, <code>false</code> * otherwise */ protected <T extends CSSProperty> boolean genericProperty(Class<T> type, TermIdent term, boolean avoidInherit, Map<String, CSSProperty> properties, String propertyName) { T property = genericPropertyRaw(type, null, term); if (property == null || (avoidInherit && property.equalsInherit())) return false; properties.put(propertyName, property); return true; }
/** * Converts TermIdent into value of enum of given class and stores it into * properties map under key property * * @param <T> * Enum & CSSProperty limitation * @param type * Type of enum which instance is retrieved * @param term * Term with value to be converted * @param avoidInherit * If <code>true</code> inherit value is not considered valid * @param properties * Properties map where to store value * @param propertyName * Name under which property is stored in map * @return <code>true</code> in case of success, <code>false</code> * otherwise */ protected <T extends CSSProperty> boolean genericProperty(Class<T> type, TermIdent term, boolean avoidInherit, Map<String, CSSProperty> properties, String propertyName) { T property = genericPropertyRaw(type, null, term); if (property == null || (avoidInherit && property.equalsInherit())) return false; properties.put(propertyName, property); return true; }
@SuppressWarnings("unused") private boolean processClip(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { if (d.size() != 1) return false; Term<?> term = d.get(0); if (term instanceof TermIdent) { final Set<Clip> allowedClips = EnumSet.allOf(Clip.class); Clip clip = genericPropertyRaw(Clip.class, allowedClips, (TermIdent) term); if (clip != null) { properties.put("clip", clip); return true; } return false; } else if (term instanceof TermFunction) { return genericTerm(TermFunction.class, term, "clip", Clip.shape, false, properties, values); } return false; }
@SuppressWarnings("unused") private boolean processClip(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values) { if (d.size() != 1) return false; Term<?> term = d.get(0); if (term instanceof TermIdent) { final Set<Clip> allowedClips = EnumSet.allOf(Clip.class); Clip clip = genericPropertyRaw(Clip.class, allowedClips, (TermIdent) term); if (clip != null) { properties.put("clip-top", clip); properties.put("clip-right", clip); properties.put("clip-bottom", clip); properties.put("clip-left", clip); return true; } return false; } else if (term instanceof TermFunction) { TermFunction termf = (TermFunction) term; // this is possibly valid rect() function if ("rect".equals(termf.getFunctionName()) && termf.size() == 4) { Repeater clip = new ClipRepeater(); clip.assignTerms(termf.getValue().toArray(new Term<?>[0])); return clip.repeat(properties, values); } } return false; }
for (Term<?> term : d.asList()) { if (term instanceof TermIdent && (dec = genericPropertyRaw(TextDecoration.class, availableDecorations, (TermIdent) term)) != null) {
bp = genericPropertyRaw(BackgroundPosition.class, allowedBackground, (TermIdent) term); if (bp != null) Term<?> term = terms.get(i); if (term instanceof TermIdent) { bs = genericPropertyRaw(BackgroundSize.class, allowedSize, (TermIdent) term); if (bs != null) {
Term<?> term = terms.get(i); if (term instanceof TermIdent) { bp = genericPropertyRaw(BackgroundPosition.class, allowedBackground, (TermIdent) term); if (bp != null)
for (Term<?> term : d.asList()) { if (term instanceof TermIdent && (dec = genericPropertyRaw(TextDecoration.class, availableDecorations, (TermIdent) term)) != null) {
list.add(term); } else if (term instanceof TermIdent && (cur = genericPropertyRaw(Cursor.class, allowedCursors, (TermIdent) term)) != null) {
list.add(term); } else if (term instanceof TermIdent && (cur = genericPropertyRaw(Cursor.class, allowedCursors, (TermIdent) term)) != null) {
FontFamily generic = genericPropertyRaw(FontFamily.class, allowedFamilies, tf.createIdent(name));
FontFamily generic = genericPropertyRaw(FontFamily.class, allowedFamilies, tf.createIdent(name));