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

Side by Side Diff: chrome/browser/resources/extensions/extension_list.js

Issue 68723003: Make chrome/ be documentElement/body agnostic with regards to scrollTop/Left (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_305800
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 <include src="extension_error.js"></include> 5 <include src="extension_error.js"></include>
6 6
7 cr.define('options', function() { 7 cr.define('options', function() {
8 'use strict'; 8 'use strict';
9 9
10 /** 10 /**
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Iterate over the extension data and add each item to the list. 52 // Iterate over the extension data and add each item to the list.
53 this.data_.extensions.forEach(this.createNode_, this); 53 this.data_.extensions.forEach(this.createNode_, this);
54 54
55 var idToHighlight = this.getIdQueryParam_(); 55 var idToHighlight = this.getIdQueryParam_();
56 if (idToHighlight && $(idToHighlight)) { 56 if (idToHighlight && $(idToHighlight)) {
57 // Scroll offset should be calculated slightly higher than the actual 57 // Scroll offset should be calculated slightly higher than the actual
58 // offset of the element being scrolled to, so that it ends up not all 58 // offset of the element being scrolled to, so that it ends up not all
59 // the way at the top. That way it is clear that there are more elements 59 // the way at the top. That way it is clear that there are more elements
60 // above the element being scrolled to. 60 // above the element being scrolled to.
61 var scrollFudge = 1.2; 61 var scrollFudge = 1.2;
62 document.documentElement.scrollTop = $(idToHighlight).offsetTop - 62 var scrollTop = $(idToHighlight).offsetTop - scrollFudge *
63 scrollFudge * $(idToHighlight).clientHeight; 63 $(idToHighlight).clientHeight;
64 setScrollTopForDocument(document, scrollTop);
64 } 65 }
65 66
66 if (this.data_.extensions.length == 0) 67 if (this.data_.extensions.length == 0)
67 this.classList.add('empty-extension-list'); 68 this.classList.add('empty-extension-list');
68 else 69 else
69 this.classList.remove('empty-extension-list'); 70 this.classList.remove('empty-extension-list');
70 }, 71 },
71 72
72 /** 73 /**
73 * Synthesizes and initializes an HTML element for the extension metadata 74 * Synthesizes and initializes an HTML element for the extension metadata
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 330 }
330 331
331 this.appendChild(node); 332 this.appendChild(node);
332 if (location.hash.substr(1) == extension.id) { 333 if (location.hash.substr(1) == extension.id) {
333 // Scroll beneath the fixed header so that the extension is not 334 // Scroll beneath the fixed header so that the extension is not
334 // obscured. 335 // obscured.
335 var topScroll = node.offsetTop - $('page-header').offsetHeight; 336 var topScroll = node.offsetTop - $('page-header').offsetHeight;
336 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); 337 var pad = parseInt(getComputedStyle(node, null).marginTop, 10);
337 if (!isNaN(pad)) 338 if (!isNaN(pad))
338 topScroll -= pad / 2; 339 topScroll -= pad / 2;
339 document.documentElement.scrollTop = topScroll; 340 setScrollTopForDocument(document, topScroll);
340 } 341 }
341 }, 342 },
342 }; 343 };
343 344
344 return { 345 return {
345 ExtensionsList: ExtensionsList 346 ExtensionsList: ExtensionsList
346 }; 347 };
347 }); 348 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/about_memory.js ('k') | chrome/browser/resources/help/help_base_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698