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

Side by Side Diff: ios/chrome/browser/find_in_page/resources/find_in_page.js

Issue 1123383006: [iOS] Cleanup comments in find_in_page.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 7 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 | 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 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 /** 5 /**
6 * This file is lifted from the GoogleMobile find tool. 6 * Based heavily on code from the Google iOS app.
7 * 7 *
8 * @fileoverview A find in page tool. It scans the DOM for elements with the 8 * @fileoverview A find in page tool. It scans the DOM for elements with the
9 * text being search for, and wraps them with a span that highlights them. 9 * text being search for, and wraps them with a span that highlights them.
10 *
11 * @author bmcmahan@google.com (Benjamin McMahan)
12 *
13 */ 10 */
14 11
15 /** 12 /**
16 * Namespace for this file. Depends on __gCrWeb having already been injected. 13 * Namespace for this file. Depends on __gCrWeb having already been injected.
17 */ 14 */
18 __gCrWeb['findInPage'] = {}; 15 __gCrWeb['findInPage'] = {};
19 16
20 /** 17 /**
21 * Index of the current highlighted choice. -1 means none. 18 * Index of the current highlighted choice. -1 means none.
22 * @type {number} 19 * @type {number}
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 857
861 var originalElement = elem; 858 var originalElement = elem;
862 var nextOffsetParent = originalElement.offsetParent; 859 var nextOffsetParent = originalElement.offsetParent;
863 var computedStyle = 860 var computedStyle =
864 elem.ownerDocument.defaultView.getComputedStyle(elem, null); 861 elem.ownerDocument.defaultView.getComputedStyle(elem, null);
865 862
866 // We are currently handling all scrolling through the app, which means we can 863 // We are currently handling all scrolling through the app, which means we can
867 // only scroll the window, not any scrollable containers in the DOM itself. So 864 // only scroll the window, not any scrollable containers in the DOM itself. So
868 // for now this function returns false if the element is scrolled outside the 865 // for now this function returns false if the element is scrolled outside the
869 // viewable area of its ancestors. 866 // viewable area of its ancestors.
870 // TODO (jonwall): handle scrolling within the DOM. 867 // TODO(justincohen): handle scrolling within the DOM.
871 var pageHeight = __gCrWeb['findInPage'].getBodyHeight(); 868 var pageHeight = __gCrWeb['findInPage'].getBodyHeight();
872 var pageWidth = __gCrWeb['findInPage'].getBodyWidth(); 869 var pageWidth = __gCrWeb['findInPage'].getBodyWidth();
873 870
874 while (elem && elem.nodeName != 'BODY') { 871 while (elem && elem.nodeName != 'BODY') {
875 if (elem.style.display === 'none' || 872 if (elem.style.display === 'none' ||
876 elem.style.visibility === 'hidden' || 873 elem.style.visibility === 'hidden' ||
877 elem.style.opacity === 0 || 874 elem.style.opacity === 0 ||
878 computedStyle.display === 'none' || 875 computedStyle.display === 'none' ||
879 computedStyle.visibility === 'hidden' || 876 computedStyle.visibility === 'hidden' ||
880 computedStyle.opacity === 0) { 877 computedStyle.opacity === 0) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 var win = windowsToSearch.pop(); 952 var win = windowsToSearch.pop();
956 for (var i = win.frames.length - 1; i >= 0; i--) { 953 for (var i = win.frames.length - 1; i >= 0; i--) {
957 if (win.frames[i].document) { 954 if (win.frames[i].document) {
958 documents.push(win.frames[i].document); 955 documents.push(win.frames[i].document);
959 windowsToSearch.push(win.frames[i]); 956 windowsToSearch.push(win.frames[i]);
960 } 957 }
961 } 958 }
962 } 959 }
963 return documents; 960 return documents;
964 }; 961 };
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