OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 anchorMid - BubbleBase.ARROW_OFFSET; | 184 anchorMid - BubbleBase.ARROW_OFFSET; |
185 var max_left_pos = | 185 var max_left_pos = |
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 min_left_pos = 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, min_left_pos), max_left_pos); |
190 else | 190 else |
191 left = Math.max(Math.min(left, max_left_pos), min_left_pos); | 191 left = Math.max(Math.min(left, max_left_pos), min_left_pos); |
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, |
195 left + bubble.width - anchorMid : | 195 this.arrowAtRight_ ? 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: |
202 // * Outside the anchor, arrow tip touching the anchor (arrow at | 202 // * Outside the anchor, arrow tip touching the anchor (arrow at |
203 // top/bottom as specified by the arrow location). | 203 // top/bottom as specified by the arrow location). |
204 // * Outside the anchor, arrow tip touching the anchor (arrow at | 204 // * Outside the anchor, arrow tip touching the anchor (arrow at |
205 // bottom/top, opposite the specified arrow location). | 205 // bottom/top, opposite the specified arrow location). |
206 // * Outside the anchor, arrow tip overlapping the anchor (arrow at | 206 // * Outside the anchor, arrow tip overlapping the anchor (arrow at |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 }); |
OLD | NEW |