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

Adele adele at opensource.apple.com
Wed Jul 13 17:10:55 PDT 2005


adele       05/07/13 17:10:54

  Modified:    .        ChangeLog
               kwq      KWQNSViewExtras.m
  Log:
          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
  1.4416    +14 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4415
  retrieving revision 1.4416
  diff -u -r1.4415 -r1.4416
  --- ChangeLog	12 Jul 2005 21:52:10 -0000	1.4415
  +++ ChangeLog	14 Jul 2005 00:10:49 -0000	1.4416
  @@ -1,3 +1,17 @@
  +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  Kevin Decker  <kdecker at apple.com>
   
            Reviewed by cblu.
  
  
  
  1.6       +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.6
  diff -u -r1.5 -r1.6
  --- KWQNSViewExtras.m	29 Sep 2004 14:16:35 -0000	1.5
  +++ KWQNSViewExtras.m	14 Jul 2005 00:10:54 -0000	1.6
  @@ -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