@@ -444,7 +444,6 @@ class ContentHoverVisibleData {
444
444
445
445
const HORIZONTAL_SCROLLING_BY = 30 ;
446
446
const SCROLLBAR_WIDTH = 10 ;
447
- const SASH_WIDTH_MINUS_BORDER = 3 ;
448
447
449
448
export class ContentHoverWidget extends ResizableContentWidget {
450
449
@@ -555,8 +554,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
555
554
556
555
private _setAdjustedHoverWidgetDimensions ( size : dom . Dimension ) : void {
557
556
this . _setContentsDomNodeMaxDimensions ( 'none' , 'none' ) ;
558
- const width = size . width - 2 * SASH_WIDTH_MINUS_BORDER ;
559
- const height = size . height - 2 * SASH_WIDTH_MINUS_BORDER ;
557
+ const width = size . width ;
558
+ const height = size . height ;
560
559
this . _setHoverWidgetDimensions ( width , height ) ;
561
560
// measure if widget has horizontal scrollbar after setting the dimensions
562
561
if ( this . _hasHorizontalScrollbar ( ) ) {
@@ -591,7 +590,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
591
590
if ( ! availableSpace ) {
592
591
return ;
593
592
}
594
- let maximumHeight = 3 * SASH_WIDTH_MINUS_BORDER ;
593
+ let maximumHeight = 0 ;
595
594
Array . from ( this . _hover . contentsDomNode . children ) . forEach ( ( hoverPart ) => {
596
595
maximumHeight += hoverPart . clientHeight ;
597
596
} ) ;
@@ -662,10 +661,6 @@ export class ContentHoverWidget extends ResizableContentWidget {
662
661
contentsDomNode . appendChild ( node ) ;
663
662
}
664
663
665
- private _getWidgetHeight ( ) : number {
666
- return this . _hover . containerDomNode . clientHeight + 2 * SASH_WIDTH_MINUS_BORDER ;
667
- }
668
-
669
664
private _layoutContentWidget ( ) : void {
670
665
this . _editor . layoutContentWidget ( this ) ;
671
666
this . _hover . onContentsChanged ( ) ;
@@ -705,7 +700,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
705
700
return ;
706
701
}
707
702
this . _render ( node , hoverData ) ;
708
- const widgetHeight = this . _getWidgetHeight ( ) ;
703
+ const widgetHeight = dom . getTotalHeight ( this . _hover . containerDomNode ) ;
709
704
const widgetPosition = hoverData . showAtPosition ;
710
705
this . _positionPreference = this . _findPositionPreference ( widgetHeight , widgetPosition ) ?? ContentWidgetPositionPreference . ABOVE ;
711
706
@@ -733,38 +728,38 @@ export class ContentHoverWidget extends ResizableContentWidget {
733
728
}
734
729
}
735
730
736
- private _setPersistedHoverDimensionsOrRenderNormally ( ) : void {
731
+ private _removeConstraintsRenderNormally ( ) : void {
737
732
// Added because otherwise the initial size of the hover content is smaller than should be
738
733
const layoutInfo = this . _editor . getLayoutInfo ( ) ;
739
734
this . _resizableNode . layout ( layoutInfo . height , layoutInfo . width ) ;
740
735
this . _setHoverWidgetDimensions ( 'auto' , 'auto' ) ;
741
736
}
742
737
743
- private _setContainerAbsolutePosition ( top : number , left : number ) : void {
744
- const containerDomNode = this . _hover . containerDomNode ;
745
- containerDomNode . style . top = top + 'px' ;
746
- containerDomNode . style . left = left + 'px' ;
747
- }
748
-
749
738
private _adjustHoverHeightForScrollbar ( height : number ) {
750
739
const containerDomNode = this . _hover . containerDomNode ;
751
740
const contentsDomNode = this . _hover . contentsDomNode ;
752
741
const maxRenderingHeight = this . _findMaximumRenderingHeight ( ) ?? Infinity ;
753
- this . _setContainerDomNodeDimensions ( containerDomNode . clientWidth , Math . min ( maxRenderingHeight , height ) ) ;
754
- this . _setContentsDomNodeDimensions ( contentsDomNode . clientWidth , Math . min ( maxRenderingHeight , height - SCROLLBAR_WIDTH ) ) ;
742
+ this . _setContainerDomNodeDimensions ( dom . getTotalWidth ( containerDomNode ) , Math . min ( maxRenderingHeight , height ) ) ;
743
+ this . _setContentsDomNodeDimensions ( dom . getTotalWidth ( contentsDomNode ) , Math . min ( maxRenderingHeight , height - SCROLLBAR_WIDTH ) ) ;
755
744
}
756
745
757
746
public onContentsChanged ( ) : void {
758
- this . _setPersistedHoverDimensionsOrRenderNormally ( ) ;
747
+ this . _removeConstraintsRenderNormally ( ) ;
759
748
const containerDomNode = this . _hover . containerDomNode ;
760
- const clientHeight = containerDomNode . clientHeight ;
761
- const clientWidth = containerDomNode . clientWidth ;
762
- const totalBorderWidth = 2 * SASH_WIDTH_MINUS_BORDER ;
763
- this . _resizableNode . layout ( clientHeight + totalBorderWidth , clientWidth + totalBorderWidth ) ;
764
- this . _setContainerAbsolutePosition ( SASH_WIDTH_MINUS_BORDER - 1 , SASH_WIDTH_MINUS_BORDER - 1 ) ;
749
+
750
+ let height = dom . getTotalHeight ( containerDomNode ) ;
751
+ let width = dom . getTotalWidth ( containerDomNode ) ;
752
+ this . _resizableNode . layout ( height , width ) ;
753
+
754
+ this . _setHoverWidgetDimensions ( width , height ) ;
755
+
756
+ height = dom . getTotalHeight ( containerDomNode ) ;
757
+ width = dom . getTotalWidth ( containerDomNode ) ;
758
+ this . _resizableNode . layout ( height , width ) ;
759
+
765
760
if ( this . _hasHorizontalScrollbar ( ) ) {
766
761
this . _adjustContentsBottomPadding ( ) ;
767
- this . _adjustHoverHeightForScrollbar ( clientHeight ) ;
762
+ this . _adjustHoverHeightForScrollbar ( height ) ;
768
763
}
769
764
this . _layoutContentWidget ( ) ;
770
765
}
0 commit comments