Ejemplo n.º 1
0
    def _countCanBeCombined(self, rules, forFix = False):
        counter = {}
        for rule in rules:
            name = rule.name
            if rule.name != rule.strippedName:
                continue
            # do not do any hack combine
            if containsHack(rule):
                continue
            # -moz-border-radius, -o-border-radius is not for me
            if isCss3PrefixProp(name):
                continue

            bigger = canBeCombined(name)
            if bigger is not None:
                if counter.has_key(bigger):
                    if forFix:
                        counter[bigger].append([name, rule.fixedName, rule.fixedValue])
                    else:
                        counter[bigger].append(name)
                else:
                    if forFix:
                        counter[bigger] = [[name, rule.fixedName, rule.fixedValue]]
                    else:
                        counter[bigger] = [name]
        return counter
Ejemplo n.º 2
0
    def check(self, ruleSet):
        rules = ruleSet.getRules()

        counter = {}
        for rule in rules:
            name = rule.name
            # -moz-border-radius, -o-border-radius is not for me
            if isCss3PrefixProp(name):
                continue

            bigger = canBeCombined(name)
            if bigger is not None:
                if counter.has_key(bigger):
                    counter[bigger].append(name)
                else:
                    counter[bigger] = [name]

        for name, value in counter.items():
            if len(value) > 1:
                self.errorMsg = self.errorMsg_rough.replace('${small}', ','.join(value)).replace('${big}', name)
                return False
        return True 
Ejemplo n.º 3
0
    def _countCanBeCombined(self, rules, forFix=False):
        counter = {}
        for rule in rules:
            name = rule.name
            # -moz-border-radius, -o-border-radius is not for me
            if isCss3PrefixProp(name):
                continue

            bigger = canBeCombined(name)
            if bigger is not None:
                if counter.has_key(bigger):
                    if forFix:
                        counter[bigger].append(
                            [name, rule.fixedName, rule.fixedValue])
                    else:
                        counter[bigger].append(name)
                else:
                    if forFix:
                        counter[bigger] = [[
                            name, rule.fixedName, rule.fixedValue
                        ]]
                    else:
                        counter[bigger] = [name]
        return counter