@Override public List<PropertyDeclarationTree> propertyDeclarations() { return block.propertyDeclarations(); }
@Override public List<PropertyDeclarationTree> propertyDeclarations() { return block.propertyDeclarations(); }
@Override public void visitStatementBlock(StatementBlockTree tree) { PropertyTree firstUnsortedProperty = firstUnsortedProperty( tree.propertyDeclarations() .stream() .map(PropertyDeclarationTree::property) .collect(Collectors.toList())); if (firstUnsortedProperty != null) { addIssue(tree, firstUnsortedProperty); } super.visitStatementBlock(tree); }
@Override public void visitStatementBlock(StatementBlockTree tree) { PropertyTree firstUnsortedProperty = firstUnsortedProperty( tree.propertyDeclarations() .stream() .map(PropertyDeclarationTree::property) .collect(Collectors.toList())); if (firstUnsortedProperty != null) { addIssue(tree, firstUnsortedProperty); } super.visitStatementBlock(tree); }
private List<String> missingGradients(RulesetTree tree) { List<String> missingGradients = new ArrayList<>(GRADIENTS); for (PropertyDeclarationTree propertyDeclaration : tree.block().propertyDeclarations()) { for (FunctionTree function : propertyDeclaration.value().valueElementsOfType(FunctionTree.class)) { String functionName = function.function().text().toLowerCase(); if (functionName.matches(GRADIENT_MATCHER)) { missingGradients.removeIf(functionName::matches); } } } return missingGradients; }
private List<String> missingGradients(RulesetTree tree) { List<String> missingGradients = new ArrayList<>(GRADIENTS); for (PropertyDeclarationTree propertyDeclaration : tree.block().propertyDeclarations()) { for (FunctionTree function : propertyDeclaration.value().valueElementsOfType(FunctionTree.class)) { String functionName = function.function().text().toLowerCase(); if (functionName.matches(GRADIENT_MATCHER)) { missingGradients.removeIf(functionName::matches); } } } return missingGradients; }
@Override public void visitStatementBlock(StatementBlockTree tree) { List<PropertyDeclarationTree> declarations = tree.propertyDeclarations(); for (int i = 0; i < declarations.size(); i++) { PropertyTree currentProperty = declarations.get(i).property(); PropertyDeclarationTree nextDeclaration = i + 1 < declarations.size() ? declarations.get(i + 1) : null; if (!(currentProperty.standardProperty() instanceof UnknownProperty) && currentProperty.isVendorPrefixed() && !isNextPropertyValid(nextDeclaration, currentProperty)) { addPreciseIssue(currentProperty, "Define the standard property right after this vendor-prefixed property."); } } super.visitStatementBlock(tree); }
@Override public void visitStatementBlock(StatementBlockTree tree) { List<PropertyDeclarationTree> propertyDeclarations = tree.propertyDeclarations(); setPropertiesToNotUse(propertyDeclarations); if (propertiesToNotUse != null) { addIssues(propertyDeclarations, propertiesToNotUse); } super.visitStatementBlock(tree); }
@Override public void visitStatementBlock(StatementBlockTree tree) { List<PropertyDeclarationTree> declarations = tree.propertyDeclarations(); for (int i = 0; i < declarations.size(); i++) { PropertyTree currentProperty = declarations.get(i).property(); PropertyDeclarationTree nextDeclaration = i + 1 < declarations.size() ? declarations.get(i + 1) : null; if (!(currentProperty.standardProperty() instanceof UnknownProperty) && currentProperty.isVendorPrefixed() && !isNextPropertyValid(nextDeclaration, currentProperty)) { addPreciseIssue(currentProperty, "Define the standard property right after this vendor-prefixed property."); } } super.visitStatementBlock(tree); }
@Override public void visitStatementBlock(StatementBlockTree tree) { List<PropertyDeclarationTree> propertyDeclarations = tree.propertyDeclarations(); setPropertiesToNotUse(propertyDeclarations); if (propertiesToNotUse != null) { addIssues(propertyDeclarations, propertiesToNotUse); } super.visitStatementBlock(tree); }
@Override public void visitRuleset(RulesetTree tree) { Set<Combinations> combinations = EnumSet.noneOf(Combinations.class); for (PropertyDeclarationTree propertyDeclarationTree : tree.block().propertyDeclarations()) { PropertyTree propertyTree = propertyDeclarationTree.property(); if (isBoxSizing(propertyTree)) { combinations.clear(); combinations.add(Combinations.IS_BOX_SIZING); } if (!combinations.contains(Combinations.IS_BOX_SIZING)) { if (!combinations.contains(Combinations.WIDTH_FOUND) && isWidth(propertyTree)) { combinations.add(Combinations.WIDTH_FOUND); } else if (!combinations.contains(Combinations.HEIGHT_FOUND) && isHeight(propertyTree)) { combinations.add(Combinations.HEIGHT_FOUND); } if (isWidthSizing(propertyDeclarationTree)) { combinations.add(Combinations.WIDTH_SIZING); } if (isHeightSizing(propertyDeclarationTree)) { combinations.add(Combinations.HEIGHT_SIZING); } } } if (combinations.containsAll(Arrays.asList(Combinations.WIDTH_FOUND, Combinations.WIDTH_SIZING)) || combinations.containsAll(Arrays.asList(Combinations.HEIGHT_FOUND, Combinations.HEIGHT_SIZING))) { addPreciseIssue(CheckUtils.rulesetIssueLocation(tree), "Check this potential box model size issue."); } super.visitRuleset(tree); }
@Override public void visitRuleset(RulesetTree tree) { Set<Combinations> combinations = EnumSet.noneOf(Combinations.class); for (PropertyDeclarationTree propertyDeclarationTree : tree.block().propertyDeclarations()) { PropertyTree propertyTree = propertyDeclarationTree.property(); if (isBoxSizing(propertyTree)) { combinations.clear(); combinations.add(Combinations.IS_BOX_SIZING); } if (!combinations.contains(Combinations.IS_BOX_SIZING)) { if (!combinations.contains(Combinations.WIDTH_FOUND) && isWidth(propertyTree)) { combinations.add(Combinations.WIDTH_FOUND); } else if (!combinations.contains(Combinations.HEIGHT_FOUND) && isHeight(propertyTree)) { combinations.add(Combinations.HEIGHT_FOUND); } if (isWidthSizing(propertyDeclarationTree)) { combinations.add(Combinations.WIDTH_SIZING); } if (isHeightSizing(propertyDeclarationTree)) { combinations.add(Combinations.HEIGHT_SIZING); } } } if (combinations.containsAll(Arrays.asList(Combinations.WIDTH_FOUND, Combinations.WIDTH_SIZING)) || combinations.containsAll(Arrays.asList(Combinations.HEIGHT_FOUND, Combinations.HEIGHT_SIZING))) { addPreciseIssue(CheckUtils.rulesetIssueLocation(tree), "Check this potential box model size issue."); } super.visitRuleset(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof FontFace && tree.block() != null) { getAllUriTrees(tree.block().propertyDeclarations()) .forEach(this::checkUriTreeForInliningFont); } super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof FontFace && tree.block() != null) { getAllUriTrees(tree.block().propertyDeclarations()) .forEach(this::checkUriTreeForInliningFont); } super.visitAtRule(tree); }
private boolean isFontFaceRuleToBeChecked(AtRuleTree tree) { return "font-face".equalsIgnoreCase(tree.atKeyword().keyword().text()) && tree.block() != null && definesScrPropertyWithUrl(tree.block().propertyDeclarations()); }
private boolean isFontFaceRuleToBeChecked(AtRuleTree tree) { return "font-face".equalsIgnoreCase(tree.atKeyword().keyword().text()) && tree.block() != null && definesScrPropertyWithUrl(tree.block().propertyDeclarations()); }
private void setActualPropertiesForNestedProperties() { for (PropertyDeclarationTree propertyDeclaration : block.propertyDeclarations()) { propertyDeclaration.property().setProperty(namespace.property().text() + "-" + propertyDeclaration.property().property().text()); } }
private void setActualPropertiesForNestedProperties() { for (PropertyDeclarationTree propertyDeclaration : block.propertyDeclarations()) { propertyDeclaration.property().setProperty(namespace.property().text() + "-" + propertyDeclaration.property().property().text()); } }
@Override public void visitAtRule(AtRuleTree tree) { if (!isFontFaceRuleToBeChecked(tree)) { return; } List<PropertyDeclarationTree> declarations = tree.block().propertyDeclarations(); if (DEEPEST_LEVEL.equals(browserSupportLevel)) { if (getSecondToLastSrcPropertyDeclaration(declarations) == null) { addPreciseIssue(tree.atKeyword(), "Add an \"src\" property setting the URL for the \".eot\" font file (to support IE9 Compatibility Modes)."); } else { checkSecondToLastSrcPropertyDeclaration(getSecondToLastSrcPropertyDeclaration(declarations)); } } checkLastSrcProperty(getLastSrcPropertyDeclaration(declarations)); super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (!isFontFaceRuleToBeChecked(tree)) { return; } List<PropertyDeclarationTree> declarations = tree.block().propertyDeclarations(); if (DEEPEST_LEVEL.equals(browserSupportLevel)) { if (getSecondToLastSrcPropertyDeclaration(declarations) == null) { addPreciseIssue(tree.atKeyword(), "Add an \"src\" property setting the URL for the \".eot\" font file (to support IE9 Compatibility Modes)."); } else { checkSecondToLastSrcPropertyDeclaration(getSecondToLastSrcPropertyDeclaration(declarations)); } } checkLastSrcProperty(getLastSrcPropertyDeclaration(declarations)); super.visitAtRule(tree); }