@@ -139,7 +139,7 @@ public sealed class HtmlContainer : IDisposable
139139 /// Gets or sets a value indicating if image loading only when visible should be avoided (default - false).<br/>
140140 /// </summary>
141141 private bool _avoidImagesLateLoading ;
142-
142+
143143 /// <summary>
144144 /// Use GDI+ text rendering to measure/draw text.
145145 /// </summary>
@@ -280,7 +280,7 @@ public bool UseGdiPlusTextRendering
280280 get { return _useGdiPlusTextRendering ; }
281281 set
282282 {
283- if ( _useGdiPlusTextRendering != value )
283+ if ( _useGdiPlusTextRendering != value )
284284 {
285285 _useGdiPlusTextRendering = value ;
286286 RequestRefresh ( true ) ;
@@ -402,22 +402,21 @@ internal Color SelectionBackColor
402402 /// <param name="baseCssData">optional: the stylesheet to init with, init default if not given</param>
403403 public void SetHtml ( string htmlSource , CssData baseCssData = null )
404404 {
405-
406- if ( _root != null )
405+ if ( _root != null )
407406 {
408407 _root . Dispose ( ) ;
409408 _root = null ;
410- if ( _selectionHandler != null )
409+ if ( _selectionHandler != null )
411410 _selectionHandler . Dispose ( ) ;
412411 _selectionHandler = null ;
413412 }
414413
415- if ( ! string . IsNullOrEmpty ( htmlSource ) )
414+ if ( ! string . IsNullOrEmpty ( htmlSource ) )
416415 {
417416 _cssData = baseCssData ?? CssUtils . DefaultCssData ;
418417
419418 _root = DomParser . GenerateCssTree ( htmlSource , this , ref _cssData ) ;
420- if ( _root != null )
419+ if ( _root != null )
421420 {
422421 _selectionHandler = new SelectionHandler ( _root ) ;
423422 }
@@ -483,9 +482,9 @@ public void PerformLayout(Graphics g)
483482 {
484483 ArgChecker . AssertArgNotNull ( g , "g" ) ;
485484
486- if ( _root != null )
485+ if ( _root != null )
487486 {
488- using ( var ig = new WinGraphics ( g , _useGdiPlusTextRendering ) )
487+ using ( var ig = new WinGraphics ( g , _useGdiPlusTextRendering ) )
489488 {
490489 _actualSize = SizeF . Empty ;
491490
@@ -494,7 +493,7 @@ public void PerformLayout(Graphics g)
494493 _root . Location = _location ;
495494 _root . PerformLayout ( ig ) ;
496495
497- if ( _maxSize . Width <= 0.1 )
496+ if ( _maxSize . Width <= 0.1 )
498497 {
499498 // in case the width is not restricted we need to double layout, first will find the width so second can layout by it (center alignment)
500499 _root . Size = new SizeF ( ( int ) Math . Ceiling ( _actualSize . Width ) , 0 ) ;
@@ -514,21 +513,21 @@ public void PerformPaint(Graphics g)
514513 ArgChecker . AssertArgNotNull ( g , "g" ) ;
515514
516515 Region prevClip = null ;
517- if ( MaxSize . Height > 0 )
516+ if ( MaxSize . Height > 0 )
518517 {
519518 prevClip = g . Clip ;
520519 g . SetClip ( new RectangleF ( _location , _maxSize ) ) ;
521520 }
522521
523- if ( _root != null )
522+ if ( _root != null )
524523 {
525- using ( var ig = new WinGraphics ( g , _useGdiPlusTextRendering ) )
524+ using ( var ig = new WinGraphics ( g , _useGdiPlusTextRendering ) )
526525 {
527526 _root . Paint ( ig ) ;
528527 }
529528 }
530529
531- if ( prevClip != null )
530+ if ( prevClip != null )
532531 {
533532 g . SetClip ( prevClip , CombineMode . Replace ) ;
534533 }
@@ -546,10 +545,10 @@ public void HandleMouseDown(Control parent, MouseEventArgs e)
546545
547546 try
548547 {
549- if ( _selectionHandler != null )
548+ if ( _selectionHandler != null )
550549 _selectionHandler . HandleMouseDown ( parent , OffsetByScroll ( e . Location ) , IsMouseInContainer ( e . Location ) ) ;
551550 }
552- catch ( Exception ex )
551+ catch ( Exception ex )
553552 {
554553 ReportError ( HtmlRenderErrorType . KeyboardMouse , "Failed mouse down handle" , ex ) ;
555554 }
@@ -567,25 +566,25 @@ public void HandleMouseUp(Control parent, MouseEventArgs e)
567566
568567 try
569568 {
570- if ( _selectionHandler != null && IsMouseInContainer ( e . Location ) )
569+ if ( _selectionHandler != null && IsMouseInContainer ( e . Location ) )
571570 {
572571 var ignore = _selectionHandler . HandleMouseUp ( parent , e . Button ) ;
573- if ( ! ignore && ( e . Button & MouseButtons . Left ) != 0 )
572+ if ( ! ignore && ( e . Button & MouseButtons . Left ) != 0 )
574573 {
575574 var loc = OffsetByScroll ( e . Location ) ;
576575 var link = DomUtils . GetLinkBox ( _root , loc ) ;
577- if ( link != null )
576+ if ( link != null )
578577 {
579578 HandleLinkClicked ( parent , e , link ) ;
580579 }
581580 }
582581 }
583582 }
584- catch ( HtmlLinkClickedException )
583+ catch ( HtmlLinkClickedException )
585584 {
586585 throw ;
587586 }
588- catch ( Exception ex )
587+ catch ( Exception ex )
589588 {
590589 ReportError ( HtmlRenderErrorType . KeyboardMouse , "Failed mouse up handle" , ex ) ;
591590 }
@@ -603,10 +602,10 @@ public void HandleMouseDoubleClick(Control parent, MouseEventArgs e)
603602
604603 try
605604 {
606- if ( _selectionHandler != null && IsMouseInContainer ( e . Location ) )
605+ if ( _selectionHandler != null && IsMouseInContainer ( e . Location ) )
607606 _selectionHandler . SelectWord ( parent , OffsetByScroll ( e . Location ) ) ;
608607 }
609- catch ( Exception ex )
608+ catch ( Exception ex )
610609 {
611610 ReportError ( HtmlRenderErrorType . KeyboardMouse , "Failed mouse double click handle" , ex ) ;
612611 }
@@ -625,7 +624,7 @@ public void HandleMouseMove(Control parent, MouseEventArgs e)
625624 try
626625 {
627626 var loc = OffsetByScroll ( e . Location ) ;
628- if ( _selectionHandler != null && IsMouseInContainer ( e . Location ) )
627+ if ( _selectionHandler != null && IsMouseInContainer ( e . Location ) )
629628 _selectionHandler . HandleMouseMove ( parent , loc ) ;
630629
631630 /*
@@ -649,7 +648,7 @@ public void HandleMouseMove(Control parent, MouseEventArgs e)
649648 }
650649 */
651650 }
652- catch ( Exception ex )
651+ catch ( Exception ex )
653652 {
654653 ReportError ( HtmlRenderErrorType . KeyboardMouse , "Failed mouse move handle" , ex ) ;
655654 }
@@ -665,10 +664,10 @@ public void HandleMouseLeave(Control parent)
665664
666665 try
667666 {
668- if ( _selectionHandler != null )
667+ if ( _selectionHandler != null )
669668 _selectionHandler . HandleMouseLeave ( parent ) ;
670669 }
671- catch ( Exception ex )
670+ catch ( Exception ex )
672671 {
673672 ReportError ( HtmlRenderErrorType . KeyboardMouse , "Failed mouse leave handle" , ex ) ;
674673 }
@@ -686,22 +685,22 @@ public void HandleKeyDown(Control parent, KeyEventArgs e)
686685
687686 try
688687 {
689- if ( e . Control && _selectionHandler != null )
688+ if ( e . Control && _selectionHandler != null )
690689 {
691690 // select all
692- if ( e . KeyCode == Keys . A )
691+ if ( e . KeyCode == Keys . A )
693692 {
694693 _selectionHandler . SelectAll ( parent ) ;
695694 }
696695
697696 // copy currently selected text
698- if ( e . KeyCode == Keys . C )
697+ if ( e . KeyCode == Keys . C )
699698 {
700699 _selectionHandler . CopySelectedHtml ( ) ;
701700 }
702701 }
703702 }
704- catch ( Exception ex )
703+ catch ( Exception ex )
705704 {
706705 ReportError ( HtmlRenderErrorType . KeyboardMouse , "Failed key down handle" , ex ) ;
707706 }
@@ -715,12 +714,12 @@ internal void RaiseHtmlStylesheetLoadEvent(HtmlStylesheetLoadEventArgs args)
715714 {
716715 try
717716 {
718- if ( StylesheetLoad != null )
717+ if ( StylesheetLoad != null )
719718 {
720719 StylesheetLoad ( this , args ) ;
721720 }
722721 }
723- catch ( Exception ex )
722+ catch ( Exception ex )
724723 {
725724 ReportError ( HtmlRenderErrorType . CssParsing , "Failed stylesheet load event" , ex ) ;
726725 }
@@ -734,12 +733,12 @@ internal void RaiseHtmlImageLoadEvent(HtmlImageLoadEventArgs args)
734733 {
735734 try
736735 {
737- if ( ImageLoad != null )
736+ if ( ImageLoad != null )
738737 {
739738 ImageLoad ( this , args ) ;
740739 }
741740 }
742- catch ( Exception ex )
741+ catch ( Exception ex )
743742 {
744743 ReportError ( HtmlRenderErrorType . Image , "Failed image load event" , ex ) ;
745744 }
@@ -753,12 +752,12 @@ internal void RequestRefresh(bool layout)
753752 {
754753 try
755754 {
756- if ( Refresh != null )
755+ if ( Refresh != null )
757756 {
758757 Refresh ( this , new HtmlRefreshEventArgs ( layout ) ) ;
759758 }
760759 }
761- catch ( Exception ex )
760+ catch ( Exception ex )
762761 {
763762 ReportError ( HtmlRenderErrorType . General , "Failed refresh request" , ex ) ;
764763 }
@@ -774,13 +773,13 @@ internal void ReportError(HtmlRenderErrorType type, string message, Exception ex
774773 {
775774 try
776775 {
777- if ( RenderError != null )
776+ if ( RenderError != null )
778777 {
779778 RenderError ( this , new HtmlRenderErrorEventArgs ( type , message , exception ) ) ;
780779 }
781780 }
782781 catch
783- { }
782+ { }
784783 }
785784
786785 /// <summary>
@@ -791,29 +790,29 @@ internal void ReportError(HtmlRenderErrorType type, string message, Exception ex
791790 /// <param name="link">the link that was clicked</param>
792791 internal void HandleLinkClicked ( Control parent , MouseEventArgs e , CssBox link )
793792 {
794- if ( LinkClicked != null )
793+ if ( LinkClicked != null )
795794 {
796795 var args = new HtmlLinkClickedEventArgs ( link . HrefLink , link . HtmlTag . Attributes ) ;
797796 try
798797 {
799798 LinkClicked ( this , args ) ;
800799 }
801- catch ( Exception ex )
800+ catch ( Exception ex )
802801 {
803802 throw new HtmlLinkClickedException ( "Error in link clicked intercept" , ex ) ;
804803 }
805- if ( args . Handled )
804+ if ( args . Handled )
806805 return ;
807806 }
808807
809- if ( ! string . IsNullOrEmpty ( link . HrefLink ) )
808+ if ( ! string . IsNullOrEmpty ( link . HrefLink ) )
810809 {
811- if ( link . HrefLink . StartsWith ( "#" ) && link . HrefLink . Length > 1 )
810+ if ( link . HrefLink . StartsWith ( "#" ) && link . HrefLink . Length > 1 )
812811 {
813- if ( ScrollChange != null )
812+ if ( ScrollChange != null )
814813 {
815814 var rect = GetElementRectangle ( link . HrefLink . Substring ( 1 ) ) ;
816- if ( rect . HasValue )
815+ if ( rect . HasValue )
817816 {
818817 ScrollChange ( this , new HtmlScrollEventArgs ( Point . Round ( rect . Value . Location ) ) ) ;
819818 HandleMouseMove ( parent , e ) ;
@@ -839,7 +838,7 @@ internal void AddHoverBox(CssBox box, CssBlock block)
839838 ArgChecker . AssertArgNotNull ( box , "box" ) ;
840839 ArgChecker . AssertArgNotNull ( block , "block" ) ;
841840
842- if ( _hoverBoxes == null )
841+ if ( _hoverBoxes == null )
843842 _hoverBoxes = new List < Tupler < CssBox , CssBlock > > ( ) ;
844843
845844 _hoverBoxes . Add ( new Tupler < CssBox , CssBlock > ( box , block ) ) ;
@@ -884,7 +883,7 @@ private void Dispose(bool all)
884883 {
885884 try
886885 {
887- if ( all )
886+ if ( all )
888887 {
889888 LinkClicked = null ;
890889 Refresh = null ;
@@ -894,15 +893,15 @@ private void Dispose(bool all)
894893 }
895894
896895 _cssData = null ;
897- if ( _root != null )
896+ if ( _root != null )
898897 _root . Dispose ( ) ;
899898 _root = null ;
900- if ( _selectionHandler != null )
899+ if ( _selectionHandler != null )
901900 _selectionHandler . Dispose ( ) ;
902901 _selectionHandler = null ;
903902 }
904903 catch
905- { }
904+ { }
906905 }
907906
908907 #endregion
0 commit comments