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

Side by Side Diff: LayoutTests/fast/regions/resources/helper.js

Issue 25761004: [CSS Regions] Helper functions for selection layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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 | LayoutTests/fast/regions/selection/selecting-text-in-empty-region.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function isDebugEnabled() 1 function isDebugEnabled()
2 { 2 {
3 // Add #debug at the end of the url to visually debug the test case. 3 // Add #debug at the end of the url to visually debug the test case.
4 return window.location.hash == "#debug"; 4 return window.location.hash == "#debug";
5 } 5 }
6 6
7 function getFlowByName(name) 7 function getFlowByName(name)
8 { 8 {
9 var namedFlows = document.webkitGetNamedFlows(); 9 var namedFlows = document.webkitGetNamedFlows();
10 return namedFlows[name] ? namedFlows[name] : null; 10 return namedFlows[name] ? namedFlows[name] : null;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 for (var i = 0; i < current.length; i++) 195 for (var i = 0; i < current.length; i++)
196 if (current[i] !== expected[i]) { 196 if (current[i] !== expected[i]) {
197 testFailed("Expected [" + expected.toString() + "]. Was [" + cu rrent.toString() + "]"); 197 testFailed("Expected [" + expected.toString() + "]. Was [" + cu rrent.toString() + "]");
198 return; 198 return;
199 } 199 }
200 } catch (ex) { 200 } catch (ex) {
201 testFailed(current + " threw exception " + ex); 201 testFailed(current + " threw exception " + ex);
202 } 202 }
203 testPassed("Array [" + expected.toString() + "] is equal to [" + current.to String() + "]"); 203 testPassed("Array [" + expected.toString() + "] is equal to [" + current.to String() + "]");
204 } 204 }
205
206 function selectContentByRange(fromX, fromY, toX, toY) {
207 if (!window.testRunner)
208 return;
209
210 eventSender.mouseMoveTo(fromX, fromY);
211 eventSender.mouseDown();
212
213 eventSender.mouseMoveTo(toX, toY);
214 eventSender.mouseUp();
215 }
216
217 function selectContentByIds(fromId, toId) {
218 var fromRect = document.getElementById(fromId).getBoundingClientRect();
219 var toRect = document.getElementById(toId).getBoundingClientRect();
220
221 var fromRectVerticalCenter = fromRect.top + fromRect.height / 2;
222 var toRectVerticalCenter = toRect.top + toRect.height / 2;
223
224 selectContentByRange(fromRect.left, fromRectVerticalCenter, toRect.right, to RectVerticalCenter);
225 }
226
227 function selectBaseAndExtent(fromId, fromOffset, toId, toOffset) {
228 var from = document.getElementById(fromId);
229 var to = document.getElementById(toId);
230
231 var selection = window.getSelection();
232 selection.setBaseAndExtent(from, fromOffset, to, toOffset);
233 }
234
235 function mouseClick(positionX, positionY) {
236 if (!window.testRunner)
237 return;
238
239 eventSender.mouseMoveTo(positionX, positionY);
240 eventSender.mouseDown();
241 eventSender.mouseUp();
242 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/regions/selection/selecting-text-in-empty-region.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698