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

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

Issue 2277543004: Converted Observatory script-inset & source-inset elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted Observatory eval-box element Created 4 years, 3 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
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 observatory_element; 5 library observatory_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void insertLinkIntoShadowRoot(String label, String href, [String title]) { 182 void insertLinkIntoShadowRoot(String label, String href, [String title]) {
183 var anchorElement = new AnchorElement(); 183 var anchorElement = new AnchorElement();
184 anchorElement.href = href; 184 anchorElement.href = href;
185 anchorElement.text = label; 185 anchorElement.text = label;
186 if (title != null) { 186 if (title != null) {
187 anchorElement.title = title; 187 anchorElement.title = title;
188 } 188 }
189 anchorElement.onClick.listen(onClickGoto); 189 anchorElement.onClick.listen(onClickGoto);
190 shadowRoot.children.add(anchorElement); 190 shadowRoot.children.add(anchorElement);
191 } 191 }
192
193
194 var _onCopySubscription;
195 /// Exclude nodes from being copied, for example the line numbers and
196 /// breakpoint toggles in script insets. Must be called after [root]'s
197 /// children have been added, and only supports one node at a time.
198 void makeCssClassUncopyable(Element root, String className) {
199 var noCopyNodes = root.getElementsByClassName(className);
200 for (var node in noCopyNodes) {
201 node.style.setProperty('-moz-user-select', 'none');
202 node.style.setProperty('-khtml-user-select', 'none');
203 node.style.setProperty('-webkit-user-select', 'none');
204 node.style.setProperty('-ms-user-select', 'none');
205 node.style.setProperty('user-select', 'none');
206 }
207 if (_onCopySubscription != null) {
208 _onCopySubscription.cancel();
209 }
210 _onCopySubscription = root.onCopy.listen((event) {
211 // Mark the nodes as hidden before the copy happens, then mark them as
212 // visible on the next event loop turn.
213 for (var node in noCopyNodes) {
214 node.style.visibility = 'hidden';
215 }
216 Timer.run(() {
217 for (var node in noCopyNodes) {
218 node.style.visibility = 'visible';
219 }
220 });
221 });
222 }
223 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698