| Index: pkg/polymer/lib/src/css_analyzer.dart
|
| diff --git a/pkg/polymer/lib/src/css_analyzer.dart b/pkg/polymer/lib/src/css_analyzer.dart
|
| index 270af5d5ba0c6a4485298097a3e67c948cd70c94..a6c197b558794755d3e31cc477f0c1ce9da756e3 100644
|
| --- a/pkg/polymer/lib/src/css_analyzer.dart
|
| +++ b/pkg/polymer/lib/src/css_analyzer.dart
|
| @@ -15,17 +15,16 @@ import 'files.dart' show SourceFile;
|
| import 'messages.dart';
|
| import 'compiler_options.dart';
|
|
|
| -void analyzeCss(String packageRoot, List<SourceFile> files,
|
| +void analyzeCss(List<SourceFile> files,
|
| Map<String, FileInfo> info, Map<String, String> pseudoElements,
|
| Messages messages, {warningsAsErrors: false}) {
|
| - var analyzer = new _AnalyzerCss(packageRoot, info, pseudoElements, messages,
|
| + var analyzer = new _AnalyzerCss(info, pseudoElements, messages,
|
| warningsAsErrors);
|
| for (var file in files) analyzer.process(file);
|
| analyzer.normalize();
|
| }
|
|
|
| class _AnalyzerCss {
|
| - final String packageRoot;
|
| final Map<String, FileInfo> info;
|
| final Map<String, String> _pseudoElements;
|
| final Messages _messages;
|
| @@ -38,7 +37,7 @@ class _AnalyzerCss {
|
| * CSS pseudo-elements 'name::custom-element' is mapped to the manged name
|
| * associated with the pseudo-element key.
|
| */
|
| - _AnalyzerCss(this.packageRoot, this.info, this._pseudoElements,
|
| + _AnalyzerCss(this.info, this._pseudoElements,
|
| this._messages, this._warningsAsErrors);
|
|
|
| /**
|
| @@ -137,8 +136,7 @@ class _AnalyzerCss {
|
| seen.add(styleSheet);
|
|
|
| // Any other imports in this stylesheet?
|
| - var urlInfos = findImportsInStyleSheet(styleSheet, packageRoot,
|
| - inputUrl, _messages);
|
| + var urlInfos = findImportsInStyleSheet(styleSheet, inputUrl, _messages);
|
|
|
| // Process other imports in this stylesheets.
|
| for (var importSS in urlInfos) {
|
| @@ -149,8 +147,7 @@ class _AnalyzerCss {
|
| // Find dependencies for stylesheet referenced with a
|
| // @import
|
| for (var ss in importInfo.styleSheets) {
|
| - var urls = findImportsInStyleSheet(ss, packageRoot, inputUrl,
|
| - _messages);
|
| + var urls = findImportsInStyleSheet(ss, inputUrl, _messages);
|
| for (var url in urls) {
|
| _dependencies(info[url.resolvedPath], seen: seen);
|
| }
|
| @@ -359,8 +356,8 @@ class _PseudoElementExpander extends Visitor {
|
| }
|
|
|
| List<UrlInfo> findImportsInStyleSheet(StyleSheet styleSheet,
|
| - String packageRoot, UrlInfo inputUrl, Messages messages) {
|
| - var visitor = new _CssImports(packageRoot, inputUrl, messages);
|
| + UrlInfo inputUrl, Messages messages) {
|
| + var visitor = new _CssImports(inputUrl, messages);
|
| visitor.visitTree(styleSheet);
|
| return visitor.urlInfos;
|
| }
|
| @@ -370,8 +367,6 @@ List<UrlInfo> findImportsInStyleSheet(StyleSheet styleSheet,
|
| * return a list of all fully qualified CSS files.
|
| */
|
| class _CssImports extends Visitor {
|
| - final String packageRoot;
|
| -
|
| /** Input url of the css file, used to normalize relative import urls. */
|
| final UrlInfo inputUrl;
|
|
|
| @@ -380,7 +375,7 @@ class _CssImports extends Visitor {
|
|
|
| final Messages _messages;
|
|
|
| - _CssImports(this.packageRoot, this.inputUrl, this._messages);
|
| + _CssImports(this.inputUrl, this._messages);
|
|
|
| void visitTree(StyleSheet tree) {
|
| visitStyleSheet(tree);
|
| @@ -388,7 +383,7 @@ class _CssImports extends Visitor {
|
|
|
| void visitImportDirective(ImportDirective node) {
|
| var urlInfo = UrlInfo.resolve(node.import, inputUrl,
|
| - node.span, packageRoot, _messages, ignoreAbsolute: true);
|
| + node.span, _messages, ignoreAbsolute: true);
|
| if (urlInfo == null) return;
|
| urlInfos.add(urlInfo);
|
| }
|
| @@ -456,18 +451,16 @@ VarDefinition _findTerminalVarDefinition(Map<String, VarDefinition> varDefs,
|
| * component's element tag.
|
| */
|
| List<UrlInfo> findUrlsImported(LibraryInfo info, UrlInfo inputUrl,
|
| - String packageRoot, Node node, Messages messages, CompilerOptions options) {
|
| + Node node, Messages messages, CompilerOptions options) {
|
| // Process any @imports inside of the <style> tag.
|
| var styleProcessor =
|
| - new _CssStyleTag(packageRoot, info, inputUrl, messages, options);
|
| + new _CssStyleTag(info, inputUrl, messages, options);
|
| styleProcessor.visit(node);
|
| return styleProcessor.imports;
|
| }
|
|
|
| /* Process CSS inside of a style tag. */
|
| class _CssStyleTag extends TreeVisitor {
|
| - final String _packageRoot;
|
| -
|
| /** Either a FileInfo or ComponentInfo. */
|
| final LibraryInfo _info;
|
| final Messages _messages;
|
| @@ -482,7 +475,7 @@ class _CssStyleTag extends TreeVisitor {
|
| /** List of @imports found. */
|
| List<UrlInfo> imports = [];
|
|
|
| - _CssStyleTag(this._packageRoot, this._info, this._inputUrl, this._messages,
|
| + _CssStyleTag(this._info, this._inputUrl, this._messages,
|
| this._options);
|
|
|
| void visitElement(Element node) {
|
| @@ -497,7 +490,7 @@ class _CssStyleTag extends TreeVisitor {
|
| _info.styleSheets.add(styleSheet);
|
|
|
| // Find all imports return list of @imports in this style tag.
|
| - var urlInfos = findImportsInStyleSheet(styleSheet, _packageRoot,
|
| + var urlInfos = findImportsInStyleSheet(styleSheet,
|
| _inputUrl, _messages);
|
| imports.addAll(urlInfos);
|
| }
|
|
|