|
|
@@ -10,6 +10,7 @@
|
|
|
import global from './global';
|
|
|
import Rect from './rect';
|
|
|
import getPositionedAncestor from './getpositionedancestor';
|
|
|
+import getBorderWidths from './getborderwidths';
|
|
|
|
|
|
/**
|
|
|
* Calculates the `position: absolute` coordinates of a given element so it can be positioned with respect to the
|
|
|
@@ -107,7 +108,7 @@ export function getOptimalPosition( { element, target, positions, limiter, fitIn
|
|
|
|
|
|
if ( positionedElementAncestor ) {
|
|
|
const ancestorPosition = getAbsoluteRectCoordinates( new Rect( positionedElementAncestor ) );
|
|
|
- const ancestorComputedStyles = global.window.getComputedStyle( positionedElementAncestor );
|
|
|
+ const ancestorBorderWidths = getBorderWidths( positionedElementAncestor );
|
|
|
|
|
|
// (https://github.com/ckeditor/ckeditor5-ui-default/issues/126)
|
|
|
// If there's some positioned ancestor of the panel, then its `Rect` must be taken into
|
|
|
@@ -129,8 +130,8 @@ export function getOptimalPosition( { element, target, positions, limiter, fitIn
|
|
|
// while `position: absolute` positioning does not consider it.
|
|
|
// E.g. `{ position: absolute, top: 0, left: 0 }` means upper left corner of the element,
|
|
|
// not upper-left corner of its border.
|
|
|
- left -= parseInt( ancestorComputedStyles.borderLeftWidth, 10 );
|
|
|
- top -= parseInt( ancestorComputedStyles.borderTopWidth, 10 );
|
|
|
+ left -= ancestorBorderWidths.left;
|
|
|
+ top -= ancestorBorderWidths.top;
|
|
|
}
|
|
|
|
|
|
return { left, top, name };
|