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

Unified Diff: dart/site/try/src/selection.dart

Issue 266293002: Make Try Dart tests run on Firefox. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r35787 Created 6 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 | « dart/site/try/src/interaction_manager.dart ('k') | dart/site/try/src/ui.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/selection.dart
diff --git a/dart/site/try/src/selection.dart b/dart/site/try/src/selection.dart
index 35e17a8bab13d09753ca7ad3746f5b0f3a7fc9a7..bf48c6d217b9095cf33852c62cce6a2c7707c6c4 100644
--- a/dart/site/try/src/selection.dart
+++ b/dart/site/try/src/selection.dart
@@ -23,8 +23,8 @@ class TrySelection {
int globalOffset = -1;
TrySelection(this.root, Selection selection)
- : this.anchorNode = selection.isCollapsed ? selection.anchorNode : null,
- this.anchorOffset = selection.isCollapsed ? selection.anchorOffset : -1;
+ : anchorNode = isCollapsed(selection) ? selection.anchorNode : null,
+ anchorOffset = isCollapsed(selection) ? selection.anchorOffset : -1;
Text addNodeFromSubstring(int start,
int end,
@@ -74,3 +74,9 @@ class TrySelection {
return -1;
}
}
+
+bool isCollapsed(Selection selection) {
+ // Firefox and Chrome don't agree on if the selection is collapsed if there
+ // is no node selected.
+ return selection.isCollapsed && selection.anchorNode != null;
+}
« no previous file with comments | « dart/site/try/src/interaction_manager.dart ('k') | dart/site/try/src/ui.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698