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

Side by Side Diff: runtime/observatory/lib/src/elements/script_inset.dart

Issue 1286943005: Fix links to script + line. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 script_inset_element; 5 library script_inset_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'service_ref.dart'; 10 import 'service_ref.dart';
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 var annotations = []; 383 var annotations = [];
384 var annotationsCursor; 384 var annotationsCursor;
385 385
386 StreamSubscription scriptChangeSubscription; 386 StreamSubscription scriptChangeSubscription;
387 387
388 String makeLineId(int line) { 388 String makeLineId(int line) {
389 return 'line-$line'; 389 return 'line-$line';
390 } 390 }
391 391
392 void _scrollToCurrentPos() { 392 void _scrollToCurrentPos() {
393 var line = querySelector('#${makeLineId(_currentLine)}'); 393 var line = shadowRoot.getElementById(makeLineId(_currentLine));
394 if (line != null) { 394 if (line != null) {
395 line.scrollIntoView(); 395 line.scrollIntoView();
396 } 396 }
397 } 397 }
398 398
399 void detached() { 399 void detached() {
400 if (scriptChangeSubscription != null) { 400 if (scriptChangeSubscription != null) {
401 // Don't leak. If only Dart and Javascript exposed weak references... 401 // Don't leak. If only Dart and Javascript exposed weak references...
402 scriptChangeSubscription.cancel(); 402 scriptChangeSubscription.cancel();
403 scriptChangeSubscription = null; 403 scriptChangeSubscription = null;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return; 462 return;
463 } 463 }
464 464
465 if (scriptChangeSubscription == null) { 465 if (scriptChangeSubscription == null) {
466 scriptChangeSubscription = script.changes.listen((_) => update()); 466 scriptChangeSubscription = script.changes.listen((_) => update());
467 } 467 }
468 468
469 computeAnnotations(); 469 computeAnnotations();
470 470
471 var table = linesTable(); 471 var table = linesTable();
472 var firstBuild = false;
472 if (container == null) { 473 if (container == null) {
473 // Indirect to avoid deleting the style element. 474 // Indirect to avoid deleting the style element.
474 container = new DivElement(); 475 container = new DivElement();
475 shadowRoot.append(container); 476 shadowRoot.append(container);
477 firstBuild = true;
476 } 478 }
477 container.children.clear(); 479 container.children.clear();
478 container.children.add(table); 480 container.children.add(table);
479 makeCssClassUncopyable(table, "noCopy"); 481 makeCssClassUncopyable(table, "noCopy");
482 if (firstBuild) {
483 _scrollToCurrentPos();
484 }
480 } 485 }
481 486
482 void computeAnnotations() { 487 void computeAnnotations() {
483 _startLine = (startPos != null 488 _startLine = (startPos != null
484 ? script.tokenToLine(startPos) 489 ? script.tokenToLine(startPos)
485 : 1 + script.lineOffset); 490 : 1 + script.lineOffset);
486 _currentLine = (currentPos != null 491 _currentLine = (currentPos != null
487 ? script.tokenToLine(currentPos) 492 ? script.tokenToLine(currentPos)
488 : null); 493 : null);
489 _currentCol = (currentPos != null 494 _currentCol = (currentPos != null
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 class SourceInsetElement extends PolymerElement { 932 class SourceInsetElement extends PolymerElement {
928 SourceInsetElement.created() : super.created(); 933 SourceInsetElement.created() : super.created();
929 934
930 @published SourceLocation location; 935 @published SourceLocation location;
931 @published String height = null; 936 @published String height = null;
932 @published int currentPos; 937 @published int currentPos;
933 @published bool inDebuggerContext = false; 938 @published bool inDebuggerContext = false;
934 @published ObservableList variables; 939 @published ObservableList variables;
935 } 940 }
936 941
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698