[webkit-changes] cvs commit: WebKit/Carbon.subproj HIViewAdapter.m

Timothy thatcher at opensource.apple.com
Wed Oct 19 11:34:28 PDT 2005


thatcher    05/10/19 11:34:27

  Modified:    .        Tag: Safari-Den-branch ChangeLog
               Carbon.subproj Tag: Safari-Den-branch HIViewAdapter.m
  Log:
          Merged fix from TOT to Safari-Den-branch
  
      2005-10-18  Tim Omernick  <tomernick at apple.com>
  
          Reviewed by John Sullivan.
  
          <rdar://problem/4301852> Denver Regression: Text is invisible as you type in text fields in SimpleCarbonWeb
  
          This regression was caused by the fix to <rdar://problem/4141161> REGRESSION (Tiger): WebKit does not display in composited Carbon windows.
          Before that change, the dirty rect was obtained after calling -setNeedsDisplayInRect:, which intersects the dirty rect with the view's bounds.
          The change in question subtly removed the bounds-intersection step, resulting in very large NSRects being converted to QuickDraw Rects with
          sometimes disastrous results.
  
          * Carbon.subproj/HIViewAdapter.m:
          Added quickDrawRectForRect(), which returns a QuickDraw Rect derived from the passed CGRect.  The Rect's values
          are clamped so that they do not overflow when cast to the short integer data type.
          (-[NSView setNeedsDisplay:]):
          NSTextView will occasionally pass a very large rect to -setNeedsDisplayInRect:.  Maybe it's passing the bounds
          of its NSTextContainer, or something like that.  Who knows?  What's important here is that when we convert that
          NSRect to a QuickDraw Rect, the Rect's values are overflowed, which leads to unpredictable results.  The solution
          is to use quickDrawRectForRect() to clamp the NSRect's values to the limits imposed by Rect's short int type.
          (-[NSView setNeedsDisplayInRect:]): ditto
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3118.4.67.2.8 +25 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3118.4.67.2.7
  retrieving revision 1.3118.4.67.2.8
  diff -u -r1.3118.4.67.2.7 -r1.3118.4.67.2.8
  --- ChangeLog	4 Oct 2005 17:31:03 -0000	1.3118.4.67.2.7
  +++ ChangeLog	19 Oct 2005 18:34:22 -0000	1.3118.4.67.2.8
  @@ -1,3 +1,28 @@
  +2005-10-19  Timothy Hatcher  <timothy at apple.com>
  +
  +        Merged fix from TOT to Safari-Den-branch
  +
  +    2005-10-18  Tim Omernick  <tomernick at apple.com>
  +
  +        Reviewed by John Sullivan.
  +
  +        <rdar://problem/4301852> Denver Regression: Text is invisible as you type in text fields in SimpleCarbonWeb
  +
  +        This regression was caused by the fix to <rdar://problem/4141161> REGRESSION (Tiger): WebKit does not display in composited Carbon windows.
  +        Before that change, the dirty rect was obtained after calling -setNeedsDisplayInRect:, which intersects the dirty rect with the view's bounds.
  +        The change in question subtly removed the bounds-intersection step, resulting in very large NSRects being converted to QuickDraw Rects with
  +        sometimes disastrous results.
  +
  +        * Carbon.subproj/HIViewAdapter.m:
  +        Added quickDrawRectForRect(), which returns a QuickDraw Rect derived from the passed CGRect.  The Rect's values
  +        are clamped so that they do not overflow when cast to the short integer data type.
  +        (-[NSView setNeedsDisplay:]):
  +        NSTextView will occasionally pass a very large rect to -setNeedsDisplayInRect:.  Maybe it's passing the bounds
  +        of its NSTextContainer, or something like that.  Who knows?  What's important here is that when we convert that
  +        NSRect to a QuickDraw Rect, the Rect's values are overflowed, which leads to unpredictable results.  The solution
  +        is to use quickDrawRectForRect() to clamp the NSRect's values to the limits imposed by Rect's short int type.
  +        (-[NSView setNeedsDisplayInRect:]): ditto
  +
   === WebKit-416.10 ===
   
   2005-10-04  Timothy Hatcher  <timothy at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.56.1.2.1 +21 -12    WebKit/Carbon.subproj/HIViewAdapter.m
  
  Index: HIViewAdapter.m
  ===================================================================
  RCS file: /cvs/root/WebKit/Carbon.subproj/HIViewAdapter.m,v
  retrieving revision 1.3.56.1
  retrieving revision 1.3.56.1.2.1
  diff -u -r1.3.56.1 -r1.3.56.1.2.1
  --- HIViewAdapter.m	12 Aug 2005 01:53:27 -0000	1.3.56.1
  +++ HIViewAdapter.m	19 Oct 2005 18:34:27 -0000	1.3.56.1.2.1
  @@ -19,6 +19,25 @@
   
   @implementation HIViewAdapter
   
  +static inline Rect quickDrawRectForRect(CGRect rect)
  +{
  +    // Make sure rect's values are within the allowed range for the data type (short) used by QuickDraw's Rect structure.
  +    CGRect largestQuickDrawRect = CGRectMake(
  +        SHRT_MIN,
  +        SHRT_MIN,
  +        SHRT_MAX - SHRT_MIN,
  +        SHRT_MAX - SHRT_MIN);
  +    rect = CGRectIntersection(rect, largestQuickDrawRect);
  +    
  +    Rect qdRect;
  +    qdRect.top = (SInt16)rect.origin.y;
  +    qdRect.left = (SInt16)rect.origin.x;
  +    qdRect.bottom = CGRectGetMaxY(rect);
  +    qdRect.right = CGRectGetMaxX(rect);
  +    
  +    return qdRect;
  +}
  +
   static CFMutableDictionaryRef	sViewMap;
   
   + (void)bindHIViewToNSView:(HIViewRef)hiView nsView:(NSView*)nsView
  @@ -103,12 +122,7 @@
   				RgnHandle rgn = NewRgn();
   				if ( rgn )
   				{
  -					Rect		qdRect;
  -					qdRect.top = (SInt16)rect.origin.y;
  -					qdRect.left = (SInt16)rect.origin.x;
  -					qdRect.bottom = CGRectGetMaxY( rect );
  -					qdRect.right = CGRectGetMaxX( rect );
  -				
  +                    Rect qdRect = quickDrawRectForRect(rect);
   					RectRgn( rgn, &qdRect );
   					SetViewNeedsDisplay( hiView, rgn, false );
   					DisposeRgn( rgn );
  @@ -163,12 +177,7 @@
   					RgnHandle rgn = NewRgn();
   					if ( rgn )
   					{
  -						Rect		qdRect;
  -						qdRect.top = (SInt16)rect.origin.y;
  -						qdRect.left = (SInt16)rect.origin.x;
  -						qdRect.bottom = CGRectGetMaxY( rect );
  -						qdRect.right = CGRectGetMaxX( rect );
  -					
  +                        Rect qdRect = quickDrawRectForRect(rect);
   						RectRgn( rgn, &qdRect );
   						SetViewNeedsDisplay( hiView, rgn, true );
   						DisposeRgn( rgn );
  
  
  



More information about the webkit-changes mailing list