Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 function selectContentByIds(fromId, toId) { | 217 function selectContentByIds(fromId, toId) { |
| 218 var fromRect = document.getElementById(fromId).getBoundingClientRect(); | 218 var fromRect = document.getElementById(fromId).getBoundingClientRect(); |
| 219 var toRect = document.getElementById(toId).getBoundingClientRect(); | 219 var toRect = document.getElementById(toId).getBoundingClientRect(); |
| 220 | 220 |
| 221 var fromRectVerticalCenter = fromRect.top + fromRect.height / 2; | 221 var fromRectVerticalCenter = fromRect.top + fromRect.height / 2; |
| 222 var toRectVerticalCenter = toRect.top + toRect.height / 2; | 222 var toRectVerticalCenter = toRect.top + toRect.height / 2; |
| 223 | 223 |
| 224 selectContentByRange(fromRect.left, fromRectVerticalCenter, toRect.right, to RectVerticalCenter); | 224 selectContentByRange(fromRect.left, fromRectVerticalCenter, toRect.right, to RectVerticalCenter); |
| 225 } | 225 } |
| 226 | 226 |
| 227 function selectContentByIdsVert(fromId, toId) { | |
|
ojan
2013/10/04 22:26:05
Blink code prefers avoiding abbreviations (Vert).
| |
| 228 var fromRect = document.getElementById(fromId).getBoundingClientRect(); | |
| 229 var toRect = document.getElementById(toId).getBoundingClientRect(); | |
| 230 | |
| 231 var fromRectHorizontalCenter = fromRect.left + fromRect.width / 2; | |
| 232 var toRectHorizontalCenter = toRect.left + toRect.width / 2; | |
| 233 | |
| 234 selectContentByRange(fromRectHorizontalCenter, fromRect.top, toRectHorizonta lCenter, toRect.bottom); | |
| 235 } | |
| 236 | |
| 227 function selectBaseAndExtent(fromId, fromOffset, toId, toOffset) { | 237 function selectBaseAndExtent(fromId, fromOffset, toId, toOffset) { |
| 228 var from = document.getElementById(fromId); | 238 var from = document.getElementById(fromId); |
| 229 var to = document.getElementById(toId); | 239 var to = document.getElementById(toId); |
| 230 | 240 |
| 231 var selection = window.getSelection(); | 241 var selection = window.getSelection(); |
| 232 selection.setBaseAndExtent(from, fromOffset, to, toOffset); | 242 selection.setBaseAndExtent(from, fromOffset, to, toOffset); |
| 233 } | 243 } |
| 234 | 244 |
| 235 function mouseClick(positionX, positionY) { | 245 function mouseClick(positionX, positionY) { |
| 236 if (!window.testRunner) | 246 if (!window.testRunner) |
| 237 return; | 247 return; |
| 238 | 248 |
| 239 eventSender.mouseMoveTo(positionX, positionY); | 249 eventSender.mouseMoveTo(positionX, positionY); |
| 240 eventSender.mouseDown(); | 250 eventSender.mouseDown(); |
| 241 eventSender.mouseUp(); | 251 eventSender.mouseUp(); |
| 242 } | 252 } |
| 253 | |
| 254 function onMouseUpLogSelection(elementId) { | |
| 255 document.onmouseup = function() { | |
| 256 var selectedContent = document.getElementById(elementId); | |
| 257 selectedContent.innerHTML = window.getSelection().getRangeAt(0); | |
| 258 } | |
| 259 } | |
| OLD | NEW |