LEFT | RIGHT |
1 // Copyright (C) 2006 Google Inc. | 1 // Copyright (C) 2006 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 * {@code font: "Times New Roman"} to avoid any possible ambiguity between | 112 * {@code font: "Times New Roman"} to avoid any possible ambiguity between |
113 * the individual terms and special values such as {@code serif}. | 113 * the individual terms and special values such as {@code serif}. |
114 * | 114 * |
115 * @see CssPropertyPartType#LOOSE_WORD | 115 * @see CssPropertyPartType#LOOSE_WORD |
116 */ | 116 */ |
117 private void quoteLooseWords(AncestorChain<? extends CssTree> t) { | 117 private void quoteLooseWords(AncestorChain<? extends CssTree> t) { |
118 if (t.node instanceof CssTree.Expr) { | 118 if (t.node instanceof CssTree.Expr) { |
119 combineLooseWords(t.cast(CssTree.Expr.class).node); | 119 combineLooseWords(t.cast(CssTree.Expr.class).node); |
120 } | 120 } |
121 for (CssTree child : t.node.children()) { | 121 for (CssTree child : t.node.children()) { |
122 quoteLooseWords(new AncestorChain<CssTree>(t, child)); | 122 quoteLooseWords(AncestorChain.instance(t, child)); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 private void combineLooseWords(CssTree.Expr e) { | 126 private void combineLooseWords(CssTree.Expr e) { |
127 for (int i = 0, n = e.getNTerms(); i < n; ++i) { | 127 for (int i = 0, n = e.getNTerms(); i < n; ++i) { |
128 CssTree.Term t = e.getNthTerm(i); | 128 CssTree.Term t = e.getNthTerm(i); |
129 if (!isLooseWord(t)) { continue; } | 129 if (!isLooseWord(t)) { continue; } |
130 | 130 |
131 Name propertyPart = t.getAttributes().get(CssValidator.CSS_PROPERTY_PART); | 131 Name propertyPart = t.getAttributes().get(CssValidator.CSS_PROPERTY_PART); |
132 StringBuilder sb = new StringBuilder(); | 132 StringBuilder sb = new StringBuilder(); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 * of escape sequences. | 656 * of escape sequences. |
657 */ | 657 */ |
658 private static boolean isSafeSelectorPart(String s) { | 658 private static boolean isSafeSelectorPart(String s) { |
659 return SAFE_SELECTOR_PART.matcher(s).matches(); | 659 return SAFE_SELECTOR_PART.matcher(s).matches(); |
660 } | 660 } |
661 | 661 |
662 private static CssPropertyPartType propertyPartType(ParseTreeNode node) { | 662 private static CssPropertyPartType propertyPartType(ParseTreeNode node) { |
663 return node.getAttributes().get(CssValidator.CSS_PROPERTY_PART_TYPE); | 663 return node.getAttributes().get(CssValidator.CSS_PROPERTY_PART_TYPE); |
664 } | 664 } |
665 } | 665 } |
LEFT | RIGHT |