@@ -79,13 +79,6 @@ public class ChromiumWebBrowser : IRenderWebBrowser
7979 /// binding.</remarks>
8080 public bool CanGoBack { get ; private set ; }
8181 /// <summary>
82- /// Gets or sets a value indicating whether the popup is open.
83- /// </summary>
84- /// <value>
85- /// <c>true</c> if popup is opened; otherwise, <c>false</c>.
86- /// </value>
87- public bool PopupOpen { get ; protected set ; }
88- /// <summary>
8982 /// A flag that indicates whether the state of the control currently supports the GoForward action (true) or not (false).
9083 /// </summary>
9184 /// <value><c>true</c> if this instance can go forward; otherwise, <c>false</c>.</value>
@@ -102,7 +95,6 @@ public class ChromiumWebBrowser : IRenderWebBrowser
10295 /// </summary>
10396 /// <value>The request context.</value>
10497 public IRequestContext RequestContext { get ; private set ; }
105-
10698 /// <summary>
10799 /// Implement <see cref="IJsDialogHandler" /> and assign to handle events related to JavaScript Dialogs.
108100 /// </summary>
@@ -275,16 +267,6 @@ public class ChromiumWebBrowser : IRenderWebBrowser
275267 /// </summary>
276268 public bool CanExecuteJavascriptInMainFrame { get ; private set ; }
277269
278- /// <summary>
279- /// Top Left position of the popup.
280- /// </summary>
281- private Point popupPosition ;
282-
283- /// <summary>
284- /// Size of the popup.
285- /// </summary>
286- private Size popupSize ;
287-
288270 /// <summary>
289271 /// Create a new OffScreen Chromium Browser
290272 /// </summary>
@@ -315,9 +297,6 @@ public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings =
315297 CreateBrowser ( IntPtr . Zero ) ;
316298 }
317299
318- popupPosition = new Point ( ) ;
319- popupSize = new Size ( ) ;
320-
321300 RenderHandler = new DefaultRenderHandler ( this ) ;
322301 }
323302
@@ -385,22 +364,6 @@ protected virtual void Dispose(bool disposing)
385364 this . SetHandlersToNull ( ) ;
386365 }
387366
388- /// <summary>
389- /// Gets the size of the popup.
390- /// </summary>
391- public Size PopupSize
392- {
393- get { return popupSize ; }
394- }
395-
396- /// <summary>
397- /// Gets the popup position.
398- /// </summary>
399- public Point PopupPosition
400- {
401- get { return popupPosition ; }
402- }
403-
404367 /// <summary>
405368 /// Create the underlying browser. The instance address, browser settings and request context will be used.
406369 /// </summary>
@@ -475,20 +438,20 @@ public Bitmap ScreenshotOrNull(PopupBlending blend = PopupBlending.Main)
475438
476439 if ( blend == PopupBlending . Popup )
477440 {
478- return PopupOpen ? renderHandler . PopupBuffer . CreateBitmap ( ) : null ;
441+ return renderHandler . PopupOpen ? renderHandler . PopupBuffer . CreateBitmap ( ) : null ;
479442 }
480443
481444
482445 var bitmap = renderHandler . BitmapBuffer . CreateBitmap ( ) ;
483446
484- if ( PopupOpen && bitmap != null )
447+ if ( renderHandler . PopupOpen && bitmap != null )
485448 {
486449 var popup = renderHandler . PopupBuffer . CreateBitmap ( ) ;
487450 if ( popup == null )
488451 {
489452 return bitmap ;
490453 }
491- return MergeBitmaps ( bitmap , popup ) ;
454+ return MergeBitmaps ( bitmap , popup , renderHandler . PopupPosition ) ;
492455 }
493456
494457 return bitmap ;
@@ -667,9 +630,7 @@ public IBrowser GetBrowser()
667630 /// <returns>ScreenInfo.</returns>
668631 protected virtual ScreenInfo ? GetScreenInfo ( )
669632 {
670- var screenInfo = new ScreenInfo ( scaleFactor : 1.0F ) ;
671-
672- return screenInfo ;
633+ return RenderHandler ? . GetScreenInfo ( ) ;
673634 }
674635
675636 /// <summary>
@@ -687,9 +648,7 @@ public IBrowser GetBrowser()
687648 /// <returns>ViewRect.</returns>
688649 protected virtual ViewRect ? GetViewRect ( )
689650 {
690- var viewRect = new ViewRect ( size . Width , size . Height ) ;
691-
692- return viewRect ;
651+ return RenderHandler ? . GetViewRect ( ) ;
693652 }
694653
695654 /// <summary>
@@ -718,7 +677,7 @@ protected virtual bool GetScreenPoint(int viewX, int viewY, out int screenX, out
718677 screenX = 0 ;
719678 screenY = 0 ;
720679
721- return false ;
680+ return RenderHandler ? . GetScreenPoint ( viewX , viewY , out screenX , out screenY ) ?? false ;
722681 }
723682
724683 /// <summary>
@@ -755,11 +714,10 @@ void IRenderWebBrowser.OnPaint(PaintElementType type, Rect dirtyRect, IntPtr buf
755714 /// <param name="buffer">The bitmap will be will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin</param>
756715 /// <param name="width">width</param>
757716 /// <param name="height">height</param>
717+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
758718 protected virtual void OnPaint ( PaintElementType type , Rect dirtyRect , IntPtr buffer , int width , int height )
759719 {
760- var isPopup = type == PaintElementType . Popup ;
761-
762- RenderHandler ? . OnPaint ( isPopup , dirtyRect , buffer , width , height ) ;
720+ RenderHandler ? . OnPaint ( type , dirtyRect , buffer , width , height ) ;
763721 }
764722
765723 /// <summary>
@@ -779,8 +737,10 @@ void IRenderWebBrowser.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo
779737 /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param>
780738 /// <param name="type">cursor type</param>
781739 /// <param name="customCursorInfo">custom cursor Information</param>
740+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
782741 protected virtual void OnCursorChange ( IntPtr cursor , CursorType type , CursorInfo customCursorInfo )
783742 {
743+ RenderHandler ? . OnCursorChange ( cursor , type , customCursorInfo ) ;
784744 }
785745
786746 /// <summary>
@@ -804,19 +764,21 @@ bool IRenderWebBrowser.StartDragging(IDragData dragData, DragOperationsMask mask
804764 /// <param name="x">The x.</param>
805765 /// <param name="y">The y.</param>
806766 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
767+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
807768 protected virtual bool StartDragging ( IDragData dragData , DragOperationsMask mask , int x , int y )
808769 {
809- return false ;
770+ return RenderHandler ? . StartDragging ( dragData , mask , x , y ) ?? false ;
810771 }
811772
812773 void IRenderWebBrowser . UpdateDragCursor ( DragOperationsMask operation )
813774 {
814775 UpdateDragCursor ( operation ) ;
815776 }
816777
778+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
817779 protected virtual void UpdateDragCursor ( DragOperationsMask operation )
818780 {
819-
781+ RenderHandler ? . UpdateDragCursor ( operation ) ;
820782 }
821783
822784 /// <summary>
@@ -828,9 +790,10 @@ void IRenderWebBrowser.OnPopupShow(bool show)
828790 OnPopupShow ( show ) ;
829791 }
830792
793+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
831794 protected virtual void OnPopupShow ( bool show )
832795 {
833- PopupOpen = show ;
796+ RenderHandler ? . OnPopupShow ( show ) ;
834797 }
835798
836799 /// <summary>
@@ -846,22 +809,21 @@ void IRenderWebBrowser.OnPopupSize(Rect rect)
846809 /// Called when the browser wants to move or resize the popup widget.
847810 /// </summary>
848811 /// <param name="rect">contains the new location and size in view coordinates. </param>
812+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
849813 protected virtual void OnPopupSize ( Rect rect )
850814 {
851- popupPosition . X = rect . X ;
852- popupPosition . Y = rect . Y ;
853- popupSize . Width = rect . Width ;
854- popupSize . Height = rect . Height ;
815+ RenderHandler ? . OnPopupSize ( rect ) ;
855816 }
856817
857818 void IRenderWebBrowser . OnImeCompositionRangeChanged ( Range selectedRange , Rect [ ] characterBounds )
858819 {
859820 OnImeCompositionRangeChanged ( selectedRange , characterBounds ) ;
860821 }
861822
823+ [ Obsolete ( "This method will be removed, implement IRenderHandler and assign browser.RenderHandler" ) ]
862824 protected virtual void OnImeCompositionRangeChanged ( Range selectedRange , Rect [ ] characterBounds )
863825 {
864-
826+ RenderHandler ? . OnImeCompositionRangeChanged ( selectedRange , characterBounds ) ;
865827 }
866828
867829 /// <summary>
@@ -990,14 +952,15 @@ void IWebBrowserInternal.SetCanExecuteJavascriptOnMainFrame(bool canExecute)
990952 /// </summary>
991953 /// <param name="firstBitmap">First bitmap, this will be the first image drawn</param>
992954 /// <param name="secondBitmap">Second bitmap, this image will be drawn on the first</param>
955+ /// <param name="secondBitmapPosition">Position of the second bitmap</param>
993956 /// <returns>The merged bitmap, size of firstBitmap</returns>
994- private Bitmap MergeBitmaps ( Bitmap firstBitmap , Bitmap secondBitmap )
957+ private Bitmap MergeBitmaps ( Bitmap firstBitmap , Bitmap secondBitmap , Point secondBitmapPosition )
995958 {
996959 var mergedBitmap = new Bitmap ( firstBitmap . Width , firstBitmap . Height , PixelFormat . Format32bppPArgb ) ;
997960 using ( var g = Graphics . FromImage ( mergedBitmap ) )
998961 {
999962 g . DrawImage ( firstBitmap , new Rectangle ( 0 , 0 , firstBitmap . Width , firstBitmap . Height ) ) ;
1000- g . DrawImage ( secondBitmap , new Rectangle ( popupPosition . X , popupPosition . Y , secondBitmap . Width , secondBitmap . Height ) ) ;
963+ g . DrawImage ( secondBitmap , new Rectangle ( secondBitmapPosition . X , secondBitmapPosition . Y , secondBitmap . Width , secondBitmap . Height ) ) ;
1001964 }
1002965 return mergedBitmap ;
1003966 }
0 commit comments