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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/resources/common.js

Issue 2332553002: Walk the entire offsetParent chain in fast/forms/resources/common.js utility functions. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function $(id) { 1 function $(id) {
2 return document.getElementById(id); 2 return document.getElementById(id);
3 } 3 }
4 4
5 function createFormControlDataSet() { 5 function createFormControlDataSet() {
6 // A list of labelable elements resides in http://www.whatwg.org/specs/web-a pps/current-work/multipage/forms.html#category-label 6 // A list of labelable elements resides in http://www.whatwg.org/specs/web-a pps/current-work/multipage/forms.html#category-label
7 var formControlClassNames = [ 7 var formControlClassNames = [
8 'HTMLButtonElement', 8 'HTMLButtonElement',
9 'HTMLDataListElement', 9 'HTMLDataListElement',
10 'HTMLFieldSetElement', 10 'HTMLFieldSetElement',
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 function getAbsoluteRect(element) { 89 function getAbsoluteRect(element) {
90 var rect = element.getBoundingClientRect(); 90 var rect = element.getBoundingClientRect();
91 rect.top += document.scrollingElement.scrollTop; 91 rect.top += document.scrollingElement.scrollTop;
92 rect.bottom += document.scrollingElement.scrollTop; 92 rect.bottom += document.scrollingElement.scrollTop;
93 rect.left += document.scrollingElement.scrollLeft; 93 rect.left += document.scrollingElement.scrollLeft;
94 rect.right += document.scrollingElement.scrollLeft; 94 rect.right += document.scrollingElement.scrollLeft;
95 return rect; 95 return rect;
96 } 96 }
97 97
98 function searchCancelButtonPosition(element) { 98 function searchCancelButtonPosition(element) {
99 var offset = cumulativeOffset(element);
99 var pos = {}; 100 var pos = {};
100 pos.x = element.offsetLeft + element.offsetWidth - 9; 101 pos.x = offset[0] + element.offsetWidth - 9;
101 pos.y = element.offsetTop + element.offsetHeight / 2; 102 pos.y = offset[1] + element.offsetHeight / 2;
102 return pos; 103 return pos;
103 } 104 }
104 105
105 function rtlSearchCancelButtonPosition(element) { 106 function rtlSearchCancelButtonPosition(element) {
107 var offset = cumulativeOffset(element);
106 var pos = {}; 108 var pos = {};
107 pos.x = element.offsetLeft + 9; 109 pos.x = offset[0] + 9;
108 pos.y = element.offsetTop + element.offsetHeight / 2; 110 pos.y = offset[1] + element.offsetHeight / 2;
109 return pos; 111 return pos;
110 } 112 }
111 113
112 function mouseMoveToIndexInListbox(index, listboxId) { 114 function mouseMoveToIndexInListbox(index, listboxId) {
113 var listbox = document.getElementById(listboxId); 115 var listbox = document.getElementById(listboxId);
114 var itemHeight = Math.floor(listbox.offsetHeight / listbox.size); 116 var itemHeight = Math.floor(listbox.offsetHeight / listbox.size);
115 var border = 1; 117 var border = 1;
116 var y = border + index * itemHeight; 118 var y = border + index * itemHeight;
117 if (window.eventSender) 119 if (window.eventSender)
118 eventSender.mouseMoveTo(listbox.offsetLeft + border, listbox.offsetTop + y - window.pageYOffset); 120 eventSender.mouseMoveTo(listbox.offsetLeft + border, listbox.offsetTop + y - window.pageYOffset);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 return; 231 return;
230 } 232 }
231 for (var i = 0; i < str.length; ++i) { 233 for (var i = 0; i < str.length; ++i) {
232 var key = str.charAt(i); 234 var key = str.charAt(i);
233 if (key == '\n') 235 if (key == '\n')
234 key = 'Enter'; 236 key = 'Enter';
235 eventSender.keyDown(key); 237 eventSender.keyDown(key);
236 } 238 }
237 } 239 }
238 240
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698