OLD | NEW |
1 // Copyright 2015 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2015 The ChromeOS IME Authors. All Rights Reserved. |
2 // limitations under the License. | 2 // limitations under the License. |
3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
7 // | 7 // |
8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
9 // | 9 // |
10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
11 // you may not use this file except in compliance with the License. | 11 // you may not use this file except in compliance with the License. |
12 // Licensed under the Apache License, Version 2.0 (the "License"); | 12 // Licensed under the Apache License, Version 2.0 (the "License"); |
13 // | 13 // |
14 goog.provide('i18n.input.chrome.FloatingWindow'); | 14 goog.provide('i18n.input.chrome.FloatingWindow'); |
15 | 15 |
16 goog.require('goog.dom.DomHelper'); | 16 goog.require('goog.dom.DomHelper'); |
17 goog.require('goog.dom.TagName'); | 17 goog.require('goog.dom.TagName'); |
| 18 goog.require('goog.math.Coordinate'); |
18 goog.require('goog.style'); | 19 goog.require('goog.style'); |
19 goog.require('goog.ui.Container'); | 20 goog.require('goog.ui.Container'); |
20 goog.require('i18n.input.chrome.Env'); | 21 goog.require('i18n.input.chrome.Env'); |
21 goog.require('i18n.input.chrome.FloatingWindowDragger'); | 22 goog.require('i18n.input.chrome.FloatingWindowDragger'); |
22 | 23 |
23 | 24 |
24 goog.scope(function() { | 25 goog.scope(function() { |
25 var Env = i18n.input.chrome.Env; | 26 var Env = i18n.input.chrome.Env; |
26 var FloatingWindowDragger = i18n.input.chrome.FloatingWindowDragger; | 27 var FloatingWindowDragger = i18n.input.chrome.FloatingWindowDragger; |
27 | 28 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 */ | 122 */ |
122 FloatingWindow.prototype.reposition = function(position) { | 123 FloatingWindow.prototype.reposition = function(position) { |
123 var outerBounds = this.parentWindow.outerBounds; | 124 var outerBounds = this.parentWindow.outerBounds; |
124 if (outerBounds.left != position.x || outerBounds.top != position.y) { | 125 if (outerBounds.left != position.x || outerBounds.top != position.y) { |
125 outerBounds.setPosition(position.x, position.y); | 126 outerBounds.setPosition(position.x, position.y); |
126 } | 127 } |
127 }; | 128 }; |
128 | 129 |
129 | 130 |
130 /** | 131 /** |
| 132 * Gets the position of the floating window. |
| 133 * |
| 134 * @return {!goog.math.Coordinate} The top teft coordinate of the screen. |
| 135 */ |
| 136 FloatingWindow.prototype.getPosition = function() { |
| 137 var outerBounds = this.parentWindow.outerBounds; |
| 138 return new goog.math.Coordinate(outerBounds.left, outerBounds.top); |
| 139 }; |
| 140 |
| 141 |
| 142 /** |
131 * Changes the size of the floating window. | 143 * Changes the size of the floating window. |
132 * | 144 * |
133 * @param {number} width The width of the new window. | 145 * @param {number} width The width of the new window. |
134 * @param {number} height The height of the new window. | 146 * @param {number} height The height of the new window. |
135 */ | 147 */ |
136 FloatingWindow.prototype.resize = function(width, height) { | 148 FloatingWindow.prototype.resize = function(width, height) { |
137 this.parentWindow.outerBounds.setSize(width, height); | 149 this.parentWindow.outerBounds.setSize(width, height); |
138 }; | 150 }; |
139 | 151 |
140 | 152 |
141 /** | 153 /** |
142 * Gets the size of the floating window. | 154 * Gets the size of the floating window. |
143 * | 155 * |
144 * @return {!goog.math.Size} The element's size. | 156 * @return {!goog.math.Size} The element's size. |
145 */ | 157 */ |
146 FloatingWindow.prototype.size = function() { | 158 FloatingWindow.prototype.size = function() { |
147 return goog.style.getSize(this.getElement()); | 159 return goog.style.getSize(this.getElement()); |
148 }; | 160 }; |
149 | 161 |
150 | 162 |
151 /** @override */ | 163 /** @override */ |
152 FloatingWindow.prototype.disposeInternal = function() { | 164 FloatingWindow.prototype.disposeInternal = function() { |
153 this.parentWindow.close(); | 165 this.parentWindow.close(); |
154 goog.dispose(this.dragger_); | 166 goog.dispose(this.dragger_); |
155 goog.base(this, 'disposeInternal'); | 167 goog.base(this, 'disposeInternal'); |
156 }; | 168 }; |
157 }); // goog.scope | 169 }); // goog.scope |
OLD | NEW |