Backed out changeset 141ea70b1caf (bug 1074736) for win marionette test failures

This commit is contained in:
Carsten "Tomcat" Book 2014-10-24 14:46:28 +02:00
parent 59fffd8c1d
commit 3dac3afbb2

View File

@ -73,22 +73,16 @@ class SelectionManager(object):
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):
@ -100,11 +94,9 @@ class SelectionManager(object):
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