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

Side by Side Diff: chrome/browser/resources/print_preview/common/search_bubble.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Encapsulated handling of a search bubble. 9 * Encapsulated handling of a search bubble.
10 * @constructor 10 * @constructor
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 */ 84 */
85 updatePosition: function() { 85 updatePosition: function() {
86 // This bubble is 'owned' by the next sibling. 86 // This bubble is 'owned' by the next sibling.
87 var owner = (this.wrapper || this).nextSibling; 87 var owner = (this.wrapper || this).nextSibling;
88 88
89 // If there isn't an offset parent, we have nothing to do. 89 // If there isn't an offset parent, we have nothing to do.
90 if (!owner.offsetParent) 90 if (!owner.offsetParent)
91 return; 91 return;
92 92
93 // Position the bubble below the location of the owner. 93 // Position the bubble below the location of the owner.
94 var left = owner.offsetLeft + owner.offsetWidth / 2 - 94 var left =
95 this.offsetWidth / 2; 95 owner.offsetLeft + owner.offsetWidth / 2 - this.offsetWidth / 2;
96 var top = owner.offsetTop + owner.offsetHeight; 96 var top = owner.offsetTop + owner.offsetHeight;
97 97
98 // Update the position in the CSS. Cache the last values for 98 // Update the position in the CSS. Cache the last values for
99 // best performance. 99 // best performance.
100 if (left != this.lastLeft) { 100 if (left != this.lastLeft) {
101 this.style.left = left + 'px'; 101 this.style.left = left + 'px';
102 this.lastLeft = left; 102 this.lastLeft = left;
103 } 103 }
104 if (top != this.lastTop) { 104 if (top != this.lastTop) {
105 this.style.top = top + 'px'; 105 this.style.top = top + 'px';
106 this.lastTop = top; 106 this.lastTop = top;
107 } 107 }
108 }, 108 },
109 }; 109 };
110 110
111 // Export 111 // Export
112 return { 112 return {SearchBubble: SearchBubble};
113 SearchBubble: SearchBubble
114 };
115 }); 113 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698