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

Side by Side Diff: chrome/browser/resources/new_new_tab.js

Issue 147097: Fix issues with the last patch.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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
« 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 1
2 // Helpers 2 // Helpers
3 3
4 function $(id) { 4 function $(id) {
5 return document.getElementById(id); 5 return document.getElementById(id);
6 } 6 }
7 7
8 // TODO(arv): Remove these when classList is available in HTML5. 8 // TODO(arv): Remove these when classList is available in HTML5.
9 // https://bugs.webkit.org/show_bug.cgi?id=20709 9 // https://bugs.webkit.org/show_bug.cgi?id=20709
10 function hasClass(el, name) { 10 function hasClass(el, name) {
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 * @param {Element} menu The menu element. 676 * @param {Element} menu The menu element.
677 * @constructor 677 * @constructor
678 */ 678 */
679 function OptionMenu(button, menu) { 679 function OptionMenu(button, menu) {
680 this.button = button; 680 this.button = button;
681 this.menu = menu; 681 this.menu = menu;
682 this.button.onmousedown = bind(this.handleMouseDown, this); 682 this.button.onmousedown = bind(this.handleMouseDown, this);
683 this.button.onkeydown = bind(this.handleKeyDown, this); 683 this.button.onkeydown = bind(this.handleKeyDown, this);
684 this.boundHideMenu_ = bind(this.hideMenu, this); 684 this.boundHideMenu_ = bind(this.hideMenu, this);
685 this.boundMaybeHide_ = bind(this.maybeHide_, this); 685 this.boundMaybeHide_ = bind(this.maybeHide_, this);
686 this.menu.onmouseover = bind(this.handleMouseOver, this);
687 this.menu.onmouseout = bind(this.handleMouseOut, this);
688 this.menu.onmouseup = bind(this.handleMouseUp, this);
686 } 689 }
687 690
688 OptionMenu.prototype = { 691 OptionMenu.prototype = {
689 showMenu: function() { 692 showMenu: function() {
690 this.menu.style.display = 'block'; 693 this.menu.style.display = 'block';
691 this.button.focus(); 694 this.button.focus();
692 695
693 // Listen to document and window events so that we hide the menu when the 696 // Listen to document and window events so that we hide the menu when the
694 // user clicks outside the menu or tabs away or the whole window is blurred. 697 // user clicks outside the menu or tabs away or the whole window is blurred.
695 document.addEventListener('focus', this.boundMaybeHide_, true); 698 document.addEventListener('focus', this.boundMaybeHide_, true);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 this.showMenu(); 801 this.showMenu();
799 } 802 }
800 break; 803 break;
801 } 804 }
802 }, 805 },
803 806
804 selectedIndex_: -1, 807 selectedIndex_: -1,
805 setSelectedIndex: function(i) { 808 setSelectedIndex: function(i) {
806 if (i != this.selectedIndex_) { 809 if (i != this.selectedIndex_) {
807 var items = this.menu.children; 810 var items = this.menu.children;
808 var oldItem = this.items[this.selectedIndex_]; 811 var oldItem = items[this.selectedIndex_];
809 if (oldItem) { 812 if (oldItem) {
810 oldItem.removeAttribute('selected'); 813 oldItem.removeAttribute('selected');
811 } 814 }
812 var newItem = items[i]; 815 var newItem = items[i];
813 if (newItem) { 816 if (newItem) {
814 newItem.setAttribute('selected', 'selected'); 817 newItem.setAttribute('selected', 'selected');
815 } 818 }
816 this.selectedIndex_ = i; 819 this.selectedIndex_ = i;
817 } 820 }
818 }, 821 },
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 el.addEventListener('dragover', bind(this.handleDragOver, this)); 1077 el.addEventListener('dragover', bind(this.handleDragOver, this));
1075 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); 1078 el.addEventListener('dragleave', bind(this.handleDragLeave, this));
1076 el.addEventListener('drop', bind(this.handleDrop, this)); 1079 el.addEventListener('drop', bind(this.handleDrop, this));
1077 el.addEventListener('dragend', bind(this.handleDragEnd, this)); 1080 el.addEventListener('dragend', bind(this.handleDragEnd, this));
1078 el.addEventListener('drag', bind(this.handleDrag, this)); 1081 el.addEventListener('drag', bind(this.handleDrag, this));
1079 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); 1082 el.addEventListener('mousedown', bind(this.handleMouseDown, this));
1080 } 1083 }
1081 }; 1084 };
1082 1085
1083 dnd.init(); 1086 dnd.init();
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