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

John sullivan at opensource.apple.com
Wed Jul 27 15:35:54 PDT 2005


sullivan    05/07/27 15:35:53

  Modified:    .        ChangeLog
               WebView.subproj WebView.m
  Log:
  	Patch by Trey Matteson <trey at usa.net>
          Reviewed by me.
  
          Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4169
            scaling PDF view up leaves later HTML view scaled too
  
          An additional step of separating scaling of HTML and PDF.  If we do a zoom and there
          are no docViews that track the common scaling factor, then don't change it.  Thus in
          the common PDF case where it is the only doc view, scaling the PDF does not affect
          HTML pages loaded in the same window.
  
          * WebView.subproj/WebView.m:
          (-[WebView canMakeTextSmaller]):  Pass 0 for new scaling factor, since we just querying.
          (-[WebView canMakeTextLarger]):  Ditto.
          (-[WebView makeTextSmaller:]):  Pass new scaling factor.
          (-[WebView makeTextLarger:]):  Ditto.
          (-[WebView canMakeTextStandardSize]):  Pass 0 for new scaling factor.
          (-[WebView makeTextStandardSize:]):  Pass new scaling factor.
          (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]):
            The meat of the change is that this Swiss Army Knife also takes a new scaling
            factor, which it will set as the common scaling factor if it finds any doc views that
            are able to be scaled which track the common scaling factor.
  
  Revision  Changes    Path
  1.3263    +25 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3262
  retrieving revision 1.3263
  diff -u -r1.3262 -r1.3263
  --- ChangeLog	27 Jul 2005 21:36:40 -0000	1.3262
  +++ ChangeLog	27 Jul 2005 22:35:51 -0000	1.3263
  @@ -3,6 +3,31 @@
   	Patch by Trey Matteson <trey at usa.net>
           Reviewed by me.
   
  +        Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4169
  +          scaling PDF view up leaves later HTML view scaled too
  +
  +        An additional step of separating scaling of HTML and PDF.  If we do a zoom and there
  +        are no docViews that track the common scaling factor, then don't change it.  Thus in
  +        the common PDF case where it is the only doc view, scaling the PDF does not affect
  +        HTML pages loaded in the same window.
  +
  +        * WebView.subproj/WebView.m:
  +        (-[WebView canMakeTextSmaller]):  Pass 0 for new scaling factor, since we just querying.
  +        (-[WebView canMakeTextLarger]):  Ditto.
  +        (-[WebView makeTextSmaller:]):  Pass new scaling factor.
  +        (-[WebView makeTextLarger:]):  Ditto.
  +        (-[WebView canMakeTextStandardSize]):  Pass 0 for new scaling factor.
  +        (-[WebView makeTextStandardSize:]):  Pass new scaling factor.
  +        (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]):
  +          The meat of the change is that this Swiss Army Knife also takes a new scaling
  +          factor, which it will set as the common scaling factor if it finds any doc views that
  +          are able to be scaled which track the common scaling factor.
  +
  +2005-07-27  John Sullivan  <sullivan at apple.com>
  +
  +	Patch by Trey Matteson <trey at usa.net>
  +        Reviewed by me.
  +
           Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4015
             PDF views should remember viewing mode, scroll position across back/forward
             Note this doesn't work within frames because of a PDFKit bug - see 4164
  
  
  
  1.299     +18 -20    WebKit/WebView.subproj/WebView.m
  
  Index: WebView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebView.m,v
  retrieving revision 1.298
  retrieving revision 1.299
  diff -u -r1.298 -r1.299
  --- WebView.m	27 Jul 2005 21:36:44 -0000	1.298
  +++ WebView.m	27 Jul 2005 22:35:53 -0000	1.299
  @@ -214,7 +214,7 @@
   - (void)_preflightSpellChecker;
   - (BOOL)_continuousCheckingAllowed;
   - (NSResponder *)_responderForResponderOperations;
  -- (BOOL)_performTextSizingSelector:(SEL)sel withObject:(id)arg onTrackingDocs:(BOOL)doTrackingViews selForNonTrackingDocs:(SEL)testSel;
  +- (BOOL)_performTextSizingSelector:(SEL)sel withObject:(id)arg onTrackingDocs:(BOOL)doTrackingViews selForNonTrackingDocs:(SEL)testSel newScaleFactor:(float)newScaleFactor;
   @end
   
   NSString *WebElementDOMNodeKey =            @"WebElementDOMNode";
  @@ -2366,31 +2366,27 @@
   - (BOOL)canMakeTextSmaller
   {
       BOOL canShrinkMore = _private->textSizeMultiplier/TextSizeMultiplierRatio > MinimumTextSizeMultiplier;
  -    return [self _performTextSizingSelector:(SEL)0 withObject:nil onTrackingDocs:canShrinkMore selForNonTrackingDocs:@selector(_canMakeTextSmaller)];
  +    return [self _performTextSizingSelector:(SEL)0 withObject:nil onTrackingDocs:canShrinkMore selForNonTrackingDocs:@selector(_canMakeTextSmaller) newScaleFactor:0];
   }
   
   - (BOOL)canMakeTextLarger
   {
       BOOL canGrowMore = _private->textSizeMultiplier*TextSizeMultiplierRatio < MaximumTextSizeMultiplier;
  -    return [self _performTextSizingSelector:(SEL)0 withObject:nil onTrackingDocs:canGrowMore selForNonTrackingDocs:@selector(_canMakeTextLarger)];
  +    return [self _performTextSizingSelector:(SEL)0 withObject:nil onTrackingDocs:canGrowMore selForNonTrackingDocs:@selector(_canMakeTextLarger) newScaleFactor:0];
   }
   
   - (IBAction)makeTextSmaller:(id)sender
   {
  -    BOOL canShrinkMore = _private->textSizeMultiplier/TextSizeMultiplierRatio > MinimumTextSizeMultiplier;
  -    if (canShrinkMore) {
  -        [self setTextSizeMultiplier:_private->textSizeMultiplier/TextSizeMultiplierRatio];
  -    }
  -    [self _performTextSizingSelector:@selector(_makeTextSmaller:) withObject:sender onTrackingDocs:canShrinkMore selForNonTrackingDocs:@selector(_canMakeTextSmaller)];
  +    float newScale = _private->textSizeMultiplier/TextSizeMultiplierRatio;
  +    BOOL canShrinkMore = newScale > MinimumTextSizeMultiplier;
  +    [self _performTextSizingSelector:@selector(_makeTextSmaller:) withObject:sender onTrackingDocs:canShrinkMore selForNonTrackingDocs:@selector(_canMakeTextSmaller) newScaleFactor:newScale];
   }
   
   - (IBAction)makeTextLarger:(id)sender
   {
  -    BOOL canGrowMore = _private->textSizeMultiplier*TextSizeMultiplierRatio < MaximumTextSizeMultiplier;
  -    if (canGrowMore) {
  -        [self setTextSizeMultiplier:_private->textSizeMultiplier*TextSizeMultiplierRatio];
  -    }
  -    [self _performTextSizingSelector:@selector(_makeTextLarger:) withObject:sender onTrackingDocs:canGrowMore selForNonTrackingDocs:@selector(_canMakeTextLarger)];
  +    float newScale = _private->textSizeMultiplier*TextSizeMultiplierRatio;
  +    BOOL canGrowMore = newScale < MaximumTextSizeMultiplier;
  +    [self _performTextSizingSelector:@selector(_makeTextLarger:) withObject:sender onTrackingDocs:canGrowMore selForNonTrackingDocs:@selector(_canMakeTextLarger) newScaleFactor:newScale];
   }
   
   - (BOOL)_responderValidateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
  @@ -2546,16 +2542,13 @@
   - (BOOL)canMakeTextStandardSize
   {
       BOOL notAlreadyStandard = _private->textSizeMultiplier != 1.0;
  -    return [self _performTextSizingSelector:(SEL)0 withObject:nil onTrackingDocs:notAlreadyStandard selForNonTrackingDocs:@selector(_canMakeTextStandardSize)];
  +    return [self _performTextSizingSelector:(SEL)0 withObject:nil onTrackingDocs:notAlreadyStandard selForNonTrackingDocs:@selector(_canMakeTextStandardSize) newScaleFactor:0];
   }
   
   - (IBAction)makeTextStandardSize:(id)sender
   {
       BOOL notAlreadyStandard = _private->textSizeMultiplier != 1.0;
  -    if (notAlreadyStandard) {
  -        [self setTextSizeMultiplier:1.0];
  -    }
  -    [self _performTextSizingSelector:@selector(_makeTextStandardSize:) withObject:sender onTrackingDocs:notAlreadyStandard selForNonTrackingDocs:@selector(_canMakeTextStandardSize)];
  +    [self _performTextSizingSelector:@selector(_makeTextStandardSize:) withObject:sender onTrackingDocs:notAlreadyStandard selForNonTrackingDocs:@selector(_canMakeTextStandardSize) newScaleFactor:1.0];
   }
   
   @end
  @@ -3147,8 +3140,10 @@
   // text sizing.  It returns whether it found any "suitable" doc views.  It sends sel to any suitable
   // doc views, or if sel==0 we do nothing to them.  For doc views that track our size factor, they are
   // suitable if doTrackingViews==YES (which in practice means that our size factor isn't at its max or
  -// min).  For doc views that don't track it, we send them testSel to determine suitablility.
  -- (BOOL)_performTextSizingSelector:(SEL)sel withObject:(id)arg onTrackingDocs:(BOOL)doTrackingViews selForNonTrackingDocs:(SEL)testSel
  +// min).  For doc views that don't track it, we send them testSel to determine suitablility.  If we
  +// do find any suitable tracking doc views and newScaleFactor!=0, we will set the common scale factor
  +// to that new factor before we send sel to any of them. 
  +- (BOOL)_performTextSizingSelector:(SEL)sel withObject:(id)arg onTrackingDocs:(BOOL)doTrackingViews selForNonTrackingDocs:(SEL)testSel newScaleFactor:(float)newScaleFactor
   {
       if ([[self mainFrame] dataSource] == nil) {
           return NO;
  @@ -3164,6 +3159,9 @@
               BOOL isSuitable;
               if ([sizingDocView _tracksCommonSizeFactor]) {
                   isSuitable = doTrackingViews;
  +                if (isSuitable && newScaleFactor != 0) {
  +                    [self setTextSizeMultiplier:newScaleFactor];
  +                }
               } else {
                   // Incarnation to perform a selector returning a BOOL from objc/objc-runtime.h
                   isSuitable = (*(BOOL(*)(id, SEL, ...))objc_msgSend)(sizingDocView, testSel);
  
  
  



More information about the webkit-changes mailing list