Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: pkg/csslib/lib/src/validate.dart

Issue 426053003: Use source_span rather than source_maps in csslib. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add CHANGELOG Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/csslib/lib/src/tree_base.dart ('k') | pkg/csslib/lib/visitor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library csslib.src.validate; 5 library csslib.src.validate;
6 6
7 import 'package:csslib/visitor.dart'; 7 import 'package:csslib/visitor.dart';
8 import 'package:source_maps/span.dart' show Span; 8 import 'package:source_span/source_span.dart';
9 9
10 /** Can be thrown on any Css runtime problem includes source location. */ 10 /** Can be thrown on any Css runtime problem includes source location. */
11 class CssSelectorException implements Exception { 11 class CssSelectorException extends SourceSpanException {
12 final String _message; 12 CssSelectorException(String message, [SourceSpan span])
13 final Span _span; 13 : super(message, span);
14
15 CssSelectorException(this._message, [this._span]);
16
17 String toString() {
18 var msg = _span == null ? _message : _span.getLocationMessage(_message);
19 return 'CssSelectorException: $msg';
20 }
21 } 14 }
22 15
23 List<String> classes = []; 16 List<String> classes = [];
24 List<String> ids = []; 17 List<String> ids = [];
25 18
26 class Validate { 19 class Validate {
27 static int _classNameCheck(var selector, int matches) { 20 static int _classNameCheck(var selector, int matches) {
28 if (selector.isCombinatorDescendant() || 21 if (selector.isCombinatorDescendant() ||
29 (selector.isCombinatorNone() && matches == 0)) { 22 (selector.isCombinatorNone() && matches == 0)) {
30 if (matches < 0) { 23 if (matches < 0) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 118 }
126 } 119 }
127 120
128 // Every selector must match. 121 // Every selector must match.
129 Selector selector = selectors[0]; 122 Selector selector = selectors[0];
130 assert((matches >= 0 ? matches : -matches) == 123 assert((matches >= 0 ? matches : -matches) ==
131 selector.simpleSelectorSequences.length); 124 selector.simpleSelectorSequences.length);
132 } 125 }
133 } 126 }
134 127
OLDNEW
« no previous file with comments | « pkg/csslib/lib/src/tree_base.dart ('k') | pkg/csslib/lib/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698