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

Side by Side Diff: ui/webui/resources/js/cr/ui/bubble.js

Issue 2889113002: web_dev_style: Fix errors in new directories and enable PRESUBMIT (Closed)
Patch Set: merge+fix Created 3 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
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 // require: event_tracker.js 5 // require: event_tracker.js
6 6
7 // TODO(vitalyp): Inline the enums below into cr.ui definition function, remove 7 // TODO(vitalyp): Inline the enums below into cr.ui definition function, remove
8 // cr.exportPath() call and remove exportPath from exports in cr.js when this 8 // cr.exportPath() call and remove exportPath from exports in cr.js when this
9 // issue will be fixed: 9 // issue will be fixed:
10 // https://github.com/google/closure-compiler/issues/544 10 // https://github.com/google/closure-compiler/issues/544
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 if (this.bubbleAlignment_ == cr.ui.BubbleAlignment.ENTIRELY_VISIBLE) { 176 if (this.bubbleAlignment_ == cr.ui.BubbleAlignment.ENTIRELY_VISIBLE) {
177 // Work out horizontal placement. The bubble is initially positioned so 177 // Work out horizontal placement. The bubble is initially positioned so
178 // that the arrow tip points toward the midpoint of the anchor and is 178 // that the arrow tip points toward the midpoint of the anchor and is
179 // BubbleBase.ARROW_OFFSET pixels from the reference edge and (as 179 // BubbleBase.ARROW_OFFSET pixels from the reference edge and (as
180 // specified by the arrow location). If the bubble is not entirely 180 // specified by the arrow location). If the bubble is not entirely
181 // within view, it is then shifted, preserving the arrow tip position. 181 // within view, it is then shifted, preserving the arrow tip position.
182 var left = this.arrowAtRight_ ? 182 var left = this.arrowAtRight_ ?
183 anchorMid + BubbleBase.ARROW_OFFSET - bubble.width : 183 anchorMid + BubbleBase.ARROW_OFFSET - bubble.width :
184 anchorMid - BubbleBase.ARROW_OFFSET; 184 anchorMid - BubbleBase.ARROW_OFFSET;
185 var max_left_pos = 185 var maxLeftPos =
186 documentWidth - bubble.width - BubbleBase.MIN_VIEWPORT_EDGE_MARGIN; 186 documentWidth - bubble.width - BubbleBase.MIN_VIEWPORT_EDGE_MARGIN;
187 var min_left_pos = BubbleBase.MIN_VIEWPORT_EDGE_MARGIN; 187 var minLeftPos = BubbleBase.MIN_VIEWPORT_EDGE_MARGIN;
188 if (document.documentElement.dir == 'rtl') 188 if (document.documentElement.dir == 'rtl')
189 left = Math.min(Math.max(left, min_left_pos), max_left_pos); 189 left = Math.min(Math.max(left, minLeftPos), maxLeftPos);
190 else 190 else
191 left = Math.max(Math.min(left, max_left_pos), min_left_pos); 191 left = Math.max(Math.min(left, maxLeftPos), minLeftPos);
192 var arrowTip = Math.min( 192 var arrowTip = Math.min(
193 Math.max( 193 Math.max(
194 arrow.width / 2, this.arrowAtRight_ ? 194 arrow.width / 2, this.arrowAtRight_ ?
195 left + bubble.width - anchorMid : 195 left + bubble.width - anchorMid :
196 anchorMid - left), 196 anchorMid - left),
197 bubble.width - arrow.width / 2); 197 bubble.width - arrow.width / 2);
198 198
199 // Work out the vertical placement, attempting to fit the bubble 199 // Work out the vertical placement, attempting to fit the bubble
200 // entirely into view. The following placements are considered in 200 // entirely into view. The following placements are considered in
201 // decreasing order of preference: 201 // decreasing order of preference:
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 }, 534 },
535 }; 535 };
536 536
537 537
538 return { 538 return {
539 BubbleBase: BubbleBase, 539 BubbleBase: BubbleBase,
540 Bubble: Bubble, 540 Bubble: Bubble,
541 AutoCloseBubble: AutoCloseBubble 541 AutoCloseBubble: AutoCloseBubble
542 }; 542 };
543 }); 543 });
OLDNEW
« tools/web_dev_style/html_checker.py ('K') | « ui/webui/resources/css/list.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698