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

Unified Diff: runtime/observatory/lib/src/elements/observatory_element.dart

Issue 1137523002: Make copying from script insets omit line numbers and breakpoint indicators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/script_inset.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/elements/observatory_element.dart
diff --git a/runtime/observatory/lib/src/elements/observatory_element.dart b/runtime/observatory/lib/src/elements/observatory_element.dart
index f516bacbe6a214fd87b5d7c2a34f919e2b100636..8efc7b541936eefc5c2792bb339e30deade889f3 100644
--- a/runtime/observatory/lib/src/elements/observatory_element.dart
+++ b/runtime/observatory/lib/src/elements/observatory_element.dart
@@ -196,4 +196,35 @@ class ObservatoryElement extends PolymerElement {
anchorElement.onClick.listen(onClickGoto);
shadowRoot.children.add(anchorElement);
}
+
+
+ var _onCopySubscription;
+ /// Exclude nodes from being copied, for example the line numbers and
+ /// breakpoint toggles in script insets. Must be called after [root]'s
+ /// children have been added, and only supports one node at a time.
+ void makeCssClassUncopyable(Element root, String className) {
+ var noCopyNodes = root.getElementsByClassName(className);
+ for (var node in noCopyNodes) {
+ node.style.setProperty('-moz-user-select', 'none');
+ node.style.setProperty('-khtml-user-select', 'none');
+ node.style.setProperty('-webkit-user-select', 'none');
+ node.style.setProperty('-ms-user-select', 'none');
+ node.style.setProperty('user-select', 'none');
+ }
+ if (_onCopySubscription != null) {
+ _onCopySubscription.cancel();
+ }
+ _onCopySubscription = root.onCopy.listen((event) {
+ // Mark the nodes as hidden before the copy happens, then mark them as
+ // visible on the next event loop turn.
+ for (var node in noCopyNodes) {
+ node.style.visibility = 'hidden';
+ }
+ Timer.run(() {
+ for (var node in noCopyNodes) {
+ node.style.visibility = 'visible';
+ }
+ });
+ });
+ }
}
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/script_inset.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698