|
Lines 1324-1334
Link Here
|
| 1324 |
var document = this.parentNode.ownerDocument; |
1324 |
var document = this.parentNode.ownerDocument; |
| 1325 |
var viewportWidth = document.documentElement.clientWidth, |
1325 |
var viewportWidth = document.documentElement.clientWidth, |
| 1326 |
viewportHeight = document.documentElement.clientHeight; |
1326 |
viewportHeight = document.documentElement.clientHeight; |
| 1327 |
if (caretLocation.y + this.parentNode.offsetHeight > viewportHeight) { |
1327 |
|
| 1328 |
this.parentNode.style.top = (caretLocation.y - this.parentNode.offsetHeight - this.textView.getLineHeight()) + "px"; //$NON-NLS-0$ |
1328 |
var spaceBelow = viewportHeight - caretLocation.y; |
|
|
1329 |
if (this.parentNode.offsetHeight > spaceBelow) { |
| 1330 |
// Check if div is too large to fit above |
| 1331 |
var spaceAbove = caretLocation.y - this.textView.getLineHeight(); |
| 1332 |
if (this.parentNode.offsetHeight > spaceAbove){ |
| 1333 |
// Squeeze the div into the larger area |
| 1334 |
if (spaceBelow > spaceAbove) { |
| 1335 |
this.parentNode.style.maxHeight = spaceBelow + "px"; //$NON-NLS-0$ |
| 1336 |
} else { |
| 1337 |
this.parentNode.style.maxHeight = spaceAbove + "px"; //$NON-NLS-0$ |
| 1338 |
this.parentNode.style.top = "0"; //$NON-NLS-0$ |
| 1339 |
} |
| 1340 |
} else { |
| 1341 |
// Put the div above the line |
| 1342 |
this.parentNode.style.top = (caretLocation.y - this.parentNode.offsetHeight - this.textView.getLineHeight()) + "px"; //$NON-NLS-0$ |
| 1343 |
this.parentNode.style.maxHeight = spaceAbove + "px"; //$NON-NLS-0$ |
| 1344 |
} |
| 1345 |
} else { |
| 1346 |
this.parentNode.style.maxHeight = spaceBelow + "px"; //$NON-NLS-0$ |
| 1329 |
} |
1347 |
} |
|
|
1348 |
|
| 1330 |
if (caretLocation.x + this.parentNode.offsetWidth > viewportWidth) { |
1349 |
if (caretLocation.x + this.parentNode.offsetWidth > viewportWidth) { |
| 1331 |
this.parentNode.style.left = (viewportWidth - this.parentNode.offsetWidth) + "px"; //$NON-NLS-0$ |
1350 |
var leftSide = viewportWidth - this.parentNode.offsetWidth; |
|
|
1351 |
if (leftSide < 0) { |
| 1352 |
leftSide = 0; |
| 1353 |
} |
| 1354 |
this.parentNode.style.left = leftSide + "px"; //$NON-NLS-0$ |
| 1355 |
this.parentNode.style.maxWidth = viewportWidth - leftSide; |
| 1356 |
} else { |
| 1357 |
this.parentNode.style.maxWidth = viewportWidth + caretLocation.x + "px"; //$NON-NLS-0$ |
| 1332 |
} |
1358 |
} |
| 1333 |
}, |
1359 |
}, |
| 1334 |
_removeCloneNode: function(){ |
1360 |
_removeCloneNode: function(){ |