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

Side by Side Diff: samples/third_party/codemirror/js/select.js

Issue 3083012: Tidying up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* Functionality for finding, storing, and restoring selections 1 /* Functionality for finding, storing, and restoring selections
2 * 2 *
3 * This does not provide a generic API, just the minimal functionality 3 * This does not provide a generic API, just the minimal functionality
4 * required by the CodeMirror system. 4 * required by the CodeMirror system.
5 */ 5 */
6 6
7 // Namespace object. 7 // Namespace object.
8 var select = {}; 8 var select = {};
9 9
10 (function() { 10 (function() {
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 475
476 to = to || from; 476 to = to || from;
477 if (setPoint(to.node, to.offset, "End") && setPoint(from.node, from.offset , "Start")) 477 if (setPoint(to.node, to.offset, "End") && setPoint(from.node, from.offset , "Start"))
478 selectRange(range, win); 478 selectRange(range, win);
479 }; 479 };
480 480
481 select.scrollToCursor = function(container) { 481 select.scrollToCursor = function(container) {
482 var body = container.ownerDocument.body, win = container.ownerDocument.def aultView; 482 var body = container.ownerDocument.body, win = container.ownerDocument.def aultView;
483 var element = select.selectionTopNode(container, true) || container.firstC hild; 483 var element = select.selectionTopNode(container, true) || container.firstC hild;
484 484
485 // In Opera, BR elements *always* have a scrollTop property of zero. Go Op era. 485 // In Opera, BR elements *always* have a scrollTop property of zero. Go Op era.
486 while (element && !element.offsetTop) 486 while (element && !element.offsetTop)
487 element = element.previousSibling; 487 element = element.previousSibling;
488 488
489 var y = 0, pos = element; 489 var y = 0, pos = element;
490 while (pos && pos.offsetParent) { 490 while (pos && pos.offsetParent) {
491 y += pos.offsetTop; 491 y += pos.offsetTop;
492 pos = pos.offsetParent; 492 pos = pos.offsetParent;
493 } 493 }
494 494
495 var screen_y = y - body.scrollTop; 495 var screen_y = y - body.scrollTop;
496 if (screen_y < 0 || screen_y > win.innerHeight - 10) 496 if (screen_y < 0 || screen_y > win.innerHeight - 10)
497 win.scrollTo(0, y); 497 win.scrollTo(0, y);
498 }; 498 };
499 } 499 }
500 }()); 500 }());
OLDNEW
« no previous file with comments | « samples/third_party/codemirror/js/parsexml.js ('k') | samples/third_party/codemirror/js/tokenize.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698