@Override public TermRect createRect(TermFunction function) { if (function.getFunctionName().equalsIgnoreCase("rect")) { List<Term<?>> args = function.getValues(true); //try the rect(0 0 0 0) syntax if (args == null || args.size() != 4) args = function.getSeparatedValues(CSSFactory.getTermFactory().createOperator(','), true); //try the rect(0, 0, 0, 0) syntax if (args.size() == 4) { //check the argument count and types for (int i = 0; i < 4; i++) { Term<?> val = args.get(i); if (val instanceof TermIdent) { if (((TermIdent) val).getValue().equalsIgnoreCase("auto")) //replace 'auto' with null args.set(i, null); } else if (!(val instanceof TermLength)) { return null; } } return createRect((TermLength) args.get(0), (TermLength) args.get(1), (TermLength) args.get(2), (TermLength) args.get(3)); } else { return null; } } else { return null; } }
@Override public TermRect createRect(TermFunction function) { if (function.getFunctionName().equalsIgnoreCase("rect")) { List<Term<?>> args = function.getValues(true); //try the rect(0 0 0 0) syntax if (args == null || args.size() != 4) args = function.getSeparatedValues(CSSFactory.getTermFactory().createOperator(','), true); //try the rect(0, 0, 0, 0) syntax if (args.size() == 4) { //check the argument count and types for (int i = 0; i < 4; i++) { Term<?> val = args.get(i); if (val instanceof TermIdent) { if (((TermIdent) val).getValue().equalsIgnoreCase("auto")) //replace 'auto' with null args.set(i, null); } else if (!(val instanceof TermLength)) { return null; } } return createRect((TermLength) args.get(0), (TermLength) args.get(1), (TermLength) args.get(2), (TermLength) args.get(3)); } else { return null; } } else { return null; } }
if (t instanceof TermFunction && validFuncNames.contains(((TermFunction) t) .getFunctionName().toLowerCase())) list.add(t); else
private String checkForFormat(Term<?> term) { if (term instanceof TermFunction && term.getOperator() == Operator.SPACE) { final TermFunction fn = (TermFunction) term; if (fn.getFunctionName().equalsIgnoreCase("format") && fn.size() == 1 && fn.get(0) instanceof TermString) { return ((TermString) fn.get(0)).getValue(); } else return null; } else return null; }
@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; }
if (args != null) if ((COLOR_RGB_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT) || COLOR_RGBA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) { else if ((COLOR_HSL_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT) || COLOR_HSLA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) {
private String checkForFormat(Term<?> term) { if (term instanceof TermFunction && term.getOperator() == Operator.SPACE) { final TermFunction fn = (TermFunction) term; if (fn.getFunctionName().equalsIgnoreCase("format") && fn.size() == 1 && fn.get(0) instanceof TermString) { return ((TermString) fn.get(0)).getValue(); } else return null; } else return null; }
else if (t instanceof TermFunction && validFuncNames.contains(((TermFunction) t) .getFunctionName().toLowerCase())) list.add(t); else
else if (t instanceof TermFunction && validFuncNames.contains(((TermFunction) t) .getFunctionName().toLowerCase())) list.add(t); else
if (args != null) if ((COLOR_RGB_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT) || COLOR_RGBA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) { else if ((COLOR_HSL_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT) || COLOR_HSLA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) {
else if (t instanceof TermFunction && validFuncNames.contains(((TermFunction) t) .getFunctionName().toLowerCase())) list.add(t); else
function.setFunctionName(fname); if (terms_stack.peek().unary == -1) //if started with minus, add the minus to the function name function.setFunctionName('-' + function.getFunctionName()); if (t != null) function.setValue(t);
Term<?> counterStyle = s.getValue(TermFunction.class, "-dotify-counter-style"); if (counterStyle instanceof TermFunction && ((TermFunction)counterStyle).getFunctionName().equals("symbols")) { String system = null; List<String> symbols = new ArrayList<String>();
protected boolean prependMinus(Term<?> term) { boolean merged = false; if (term instanceof TermFloatValue) { // includes TermAngle, TermLength, etc. TermFloatValue floatT = (TermFloatValue) term; floatT.setValue(-1 * floatT.getValue()); merged = true; } else if (term instanceof TermIdent) { TermIdent ident = (TermIdent) term; ident.setValue("-" + ident.getValue()); merged = true; } else if (term instanceof TermFunction) { TermFunction func = (TermFunction) term; func.setFunctionName("-" + func.getFunctionName()); merged = true; } return merged; }
if ((COLOR_RGB_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT) || COLOR_RGBA_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT + 1) { else if ((COLOR_HSL_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT) || COLOR_HSLA_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT + 1) {
if ((COLOR_RGB_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT) || COLOR_RGBA_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT + 1) { else if ((COLOR_HSL_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT) || COLOR_HSLA_NAME.equals(func.getFunctionName()) && func.size() == COLOR_PARAMS_COUNT + 1) {
if (fnterm instanceof TermFunction) { ((TermFunction) fnterm).setFunctionName('-' + ((TermFunction) fnterm).getFunctionName()); terms_stack.peek().term = fnterm; } else {
if (fn.getFunctionName().equalsIgnoreCase("local") && fn.size() == 1 && fn.get(0) instanceof TermString)
if (fn.getFunctionName().equalsIgnoreCase("local") && fn.size() == 1 && fn.get(0) instanceof TermString)
function.setFunctionName(extractText(f)); if (terms_stack.peek().unary == -1) //if started with minus, add the minus to the function name function.setFunctionName('-' + function.getFunctionName()); if (t != null) function.setValue(t);