Backed out changeset 141ea70b1caf (bug 1074736) for win marionette test failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 24 Oct 2014 14:46:28 +0200
changeset 212239 35de551b2727092cb98237df319adf03405b738c
parent 212238 247d688546b3200b5108aa1930cde454f4355384
child 212240 d4270e5224a97a4bdd4a042736ca4cac197ad325
push id9560
push userkwierso@gmail.com
push dateFri, 24 Oct 2014 22:09:23 +0000
treeherderfx-team@c70f62375f7d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1074736
milestone36.0a1
backs out141ea70b1caf6bf42a2ac2e1c359de7ed9a93a02
Backed out changeset 141ea70b1caf (bug 1074736) for win marionette test failures
testing/marionette/client/marionette/selection.py
--- a/testing/marionette/client/marionette/selection.py
+++ b/testing/marionette/client/marionette/selection.py
@@ -68,48 +68,40 @@ class SelectionManager(object):
             cmd = '''var len = arguments[0].value.length;
                   arguments[0].setSelectionRange(len, len);'''
         else:
             cmd = '''var sel = window.getSelection();
                   sel.collapse(arguments[0].lastChild, arguments[0].lastChild.length);'''
 
         self.element.marionette.execute_script(cmd, script_args=[self.element])
 
-    def selection_rect_list(self, idx):
-        '''Return the selection's DOMRectList object for the range at given idx.
+    def selection_rect_list(self):
+        '''Return the selection's DOMRectList object.
 
-        If the element is either <input> or <textarea>, return the DOMRectList of
-        the range at given idx of the selection within the element. Otherwise,
-        return the DOMRectList of the of the range at given idx of current selection.
+        If the element is either <input> or <textarea>, return the selection's
+        DOMRectList within the element. Otherwise, return the DOMRectList of the
+        current selection.
 
         '''
         cmd = self.js_selection_cmd() +\
-            '''return sel.getRangeAt(%d).getClientRects();''' % idx
-        return self.element.marionette.execute_script(cmd, script_args=[self.element])
-
-    def range_count(self):
-        '''Get selection's range count'''
-        cmd = self.js_selection_cmd() +\
-            '''return sel.rangeCount;'''
+            '''return sel.getRangeAt(0).getClientRects();'''
         return self.element.marionette.execute_script(cmd, script_args=[self.element])
 
     def _selection_location_helper(self, location_type):
         '''Return the start and end location of the selection in the element.
 
         Return a tuple containing two pairs of (x, y) coordinates of the start
         and end locations in the element. The coordinates are relative to the
         top left-hand corner of the element. Both ltr and rtl directions are
         considered.
 
         '''
-        range_count = self.range_count();
-        first_rect_list = self.selection_rect_list(0)
-        last_rect_list = self.selection_rect_list(range_count - 1)
-        last_list_length = last_rect_list['length']
-        first_rect, last_rect = first_rect_list['0'], last_rect_list[str(last_list_length - 1)]
+        rect_list = self.selection_rect_list()
+        list_length = rect_list['length']
+        first_rect, last_rect = rect_list['0'], rect_list[str(list_length - 1)]
         origin_x, origin_y = self.element.location['x'], self.element.location['y']
 
         if self.element.get_attribute('dir') == 'rtl':  # such as Arabic
             start_pos, end_pos = 'right', 'left'
         else:
             start_pos, end_pos = 'left', 'right'
 
         # Calculate y offset according to different needs.