[webkit-changes] cvs commit: WebCore/kwq KWQNSViewExtras.m

Adele adele at opensource.apple.com
Wed Jul 13 17:14:37 PDT 2005


adele       05/07/13 17:14:37

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               kwq      Tag: Safari-2-0-branch KWQNSViewExtras.m
  Log:
          Merged fix from TOT to Safari-2-0-branch
  
      2005-07-13  Adele Peterson  <adele at apple.com>
  
          Reviewed by John.
  
          Fixed <rdar://problem/4170963> Focusing a field unnecessarily horizontally scrolls
  
          Horizontal scrolling while tabbing through forms can be surprising, and distracting.  This
          change will minimize that scrolling if we're not explicitly trying to center a rectangle in
          _KWQ_scrollRectToVisible.
  
          Test cases added: None.  This test case involves tabbing to form controls and scrolling.
  
          * kwq/KWQNSViewExtras.m: (-[NSClipView _KWQ_scrollRectToVisible:inView:forceCentering:]):
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4104.2.64 +18 -1     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4104.2.63
  retrieving revision 1.4104.2.64
  diff -u -r1.4104.2.63 -r1.4104.2.64
  --- ChangeLog	13 Jul 2005 01:07:19 -0000	1.4104.2.63
  +++ ChangeLog	14 Jul 2005 00:14:30 -0000	1.4104.2.64
  @@ -1,3 +1,21 @@
  +2005-07-13  Adele Peterson  <adele at apple.com>
  +
  +        Merged fix from TOT to Safari-2-0-branch
  +
  +    2005-07-13  Adele Peterson  <adele at apple.com>
  +
  +        Reviewed by John.
  +
  +        Fixed <rdar://problem/4170963> Focusing a field unnecessarily horizontally scrolls
  +
  +        Horizontal scrolling while tabbing through forms can be surprising, and distracting.  This 
  +        change will minimize that scrolling if we're not explicitly trying to center a rectangle in
  +        _KWQ_scrollRectToVisible.
  +
  +        Test cases added: None.  This test case involves tabbing to form controls and scrolling.
  +
  +        * kwq/KWQNSViewExtras.m: (-[NSClipView _KWQ_scrollRectToVisible:inView:forceCentering:]):
  +
   2005-07-12  Adele Peterson  <adele at apple.com>
   
           Merged fix from TOT to Safari-2-0-branch
  @@ -15,7 +33,6 @@
   
           * khtml/khtml_part.cpp:
           (KHTMLPart::scheduleLocationChange): If a redirect was scheduled during a load, then stop the current load. Otherwise when the current load transitions from a provisional to a committed state, pending redirects may be cancelled. 
  -        (KHTMLPart::scheduleLocationChange):
   
   2005-07-12  Adele Peterson  <adele at apple.com>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.10.1  +11 -5     WebCore/kwq/KWQNSViewExtras.m
  
  Index: KWQNSViewExtras.m
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQNSViewExtras.m,v
  retrieving revision 1.5
  retrieving revision 1.5.10.1
  diff -u -r1.5 -r1.5.10.1
  --- KWQNSViewExtras.m	29 Sep 2004 14:16:35 -0000	1.5
  +++ KWQNSViewExtras.m	14 Jul 2005 00:14:36 -0000	1.5.10.1
  @@ -25,6 +25,8 @@
   
   #import "KWQNSViewExtras.h"
   
  +#define MIN_INTERSECT_FOR_REVEAL 32
  +
   @implementation NSView (KWQNSViewExtras)
   
   - (void)_KWQ_scrollFrameToVisible
  @@ -64,8 +66,13 @@
       NSRect visibleRect = [self bounds];
       
       if (forceCentering || !NSContainsRect(visibleRect, exposeRect)) {
  -        // Make an expose rectangle that will end up centering the passed-in rectangle horizontally.
  -        if (exposeRect.size.width >= visibleRect.size.width) {
  +    
  +        // First check whether enough of the desired rect is already visible horizontally. If so, and we're not forcing centering,
  +        // we don't want to scroll horizontally because doing so is surprising.
  +        if (!forceCentering && NSIntersectionRect(visibleRect, exposeRect).size.width >= MIN_INTERSECT_FOR_REVEAL) {
  +            exposeRect.origin.x = visibleRect.origin.x;
  +            exposeRect.size.width = visibleRect.size.width;
  +        } else if (exposeRect.size.width >= visibleRect.size.width) {
               if (forceCentering) {
                   float expLeft = exposeRect.origin.x;
                   float expRight = exposeRect.origin.x + exposeRect.size.width;
  @@ -88,12 +95,11 @@
                   }
               }
               exposeRect.size.width = visibleRect.size.width;
  -        } 
  -        else {
  +        } else {
               exposeRect.origin.x -= (visibleRect.size.width - exposeRect.size.width) / 2.0;
               exposeRect.size.width += (visibleRect.size.width - exposeRect.size.width);
           }
  -        
  +               
           // Make an expose rectangle that will end up centering the passed-in rectangle vertically.
           if (exposeRect.size.height >= visibleRect.size.height) {
               if (forceCentering) {
  
  
  



More information about the webkit-changes mailing list