WebKit:
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2005 20:27:17 +0000 (20:27 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2005 20:27:17 +0000 (20:27 +0000)
        Reviewed by Kevin.

        - WebKit support for <rdar://problem/3795701> Menu item/keyboard shortcut to
        restore text zoom to normal

        * WebView.subproj/WebView.m:
        (-[WebView validateUserInterfaceItem:]):
        validate makeTextStandardSize by calling canMakeTextStandardSize
        (-[WebView canMakeTextStandardSize]):
        new method, returns YES unless text size multiplier is currently 1
        (-[WebView makeTextStandardSize:]):
        new method, sets text size multiplier to 1

        * WebView.subproj/WebViewPrivate.h:
        add makeTextStandardSize: and canMakeTextStandardSize to pending public category

WebBrowser:

        Reviewed by Chris.

        - fixed <rdar://problem/3795701> Menu item/keyboard shortcut to restore text zoom to normal

        * BrowserDocument.h: added -makeTextStandardSize:
        * BrowserDocument.m:
        (-[BrowserDocument makeTextStandardSize:]):
        call through to webview
        (-[BrowserDocument validateUserInterfaceItem:]):
        call through to webview

        * BrowserWebController.m:
        (-[BrowserWebView canMakeTextStandardSize]):
        new method, special case bookmarks view, as with other text size methods
        (-[BrowserWebView makeTextStandardSize:]):
        new method, bail out if canMakeTextStandardSize fails, as with other text size methods

        * BrowserWindowController.h: added -makeTextStandardSize:
        * BrowserWindowController.m:
        (-[BrowserWindowController validateUserInterfaceItem:]):
        call through to webview
        (-[BrowserWindowController makeTextStandardSize:]):
        ditto

        * English.lproj/MainMenu.nib:
        Added Make Text Normal Size menu item with keyboard equivalent of command-0, in
        between Make Text Bigger and Make Text Smaller

        * HTMLSourceDocument.m:
        (-[HTMLSourceDocument canMakeTextStandardSize]):
        new method, imitates WebView code
        (-[HTMLSourceDocument makeTextStandardSize:]):
        ditto
        (-[HTMLSourceDocument validateUserInterfaceItem:]):
        validate new method

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9152 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView.subproj/WebView.m
WebKit/WebView.subproj/WebViewPrivate.h

index a24a96e421e0a32b6353981cf2dc2003865efb5f..433a99ade60afa0aaead89de8294ea6f6e934047 100644 (file)
@@ -1,3 +1,21 @@
+2005-05-10  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Kevin.
+        
+        - WebKit support for <rdar://problem/3795701> Menu item/keyboard shortcut to 
+        restore text zoom to normal
+
+        * WebView.subproj/WebView.m:
+        (-[WebView validateUserInterfaceItem:]):
+        validate makeTextStandardSize by calling canMakeTextStandardSize
+        (-[WebView canMakeTextStandardSize]):
+        new method, returns YES unless text size multiplier is currently 1
+        (-[WebView makeTextStandardSize:]):
+        new method, sets text size multiplier to 1
+        
+        * WebView.subproj/WebViewPrivate.h:
+        add makeTextStandardSize: and canMakeTextStandardSize to pending public category
+
 2005-05-10  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Chris.
 2005-05-10  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Chris.
index 14c53017d4590783e1d2523e8cfe563d4f22f058..89030d696504d22bbe1995a9399980accdaa2f48 100644 (file)
@@ -2399,6 +2399,8 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
        return [self canMakeTextLarger];
     } else if (action == @selector(makeTextSmaller:)) {
        return [self canMakeTextSmaller];
        return [self canMakeTextLarger];
     } else if (action == @selector(makeTextSmaller:)) {
        return [self canMakeTextSmaller];
+    } else if (action == @selector(makeTextStandardSize:)) {
+       return [self canMakeTextStandardSize];
     } else if (action == @selector(reload:)) {
        return [[self mainFrame] dataSource] != nil;
     } else if (action == @selector(stopLoading:)) {
     } else if (action == @selector(reload:)) {
        return [[self mainFrame] dataSource] != nil;
     } else if (action == @selector(stopLoading:)) {
@@ -2505,6 +2507,28 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
     }
 }
 
     }
 }
 
+
+- (BOOL)canMakeTextStandardSize
+{
+    if ([[self mainFrame] dataSource] == nil) {
+        return NO;
+    }
+    // FIXME: This will prevent text sizing in subframes if the main frame doesn't support it
+    if (![[[[self mainFrame] frameView] documentView] conformsToProtocol:@protocol(_web_WebDocumentTextSizing)]) {
+        return NO;
+    }
+    
+    return [self textSizeMultiplier] != 1;
+}
+
+- (IBAction)makeTextStandardSize:(id)sender
+{
+    if (![self canMakeTextStandardSize]) {
+        return;
+    }
+    [self setTextSizeMultiplier:1];
+}
+
 @end
 
 @implementation WebView (WebViewPrintingPrivate)
 @end
 
 @implementation WebView (WebViewPrintingPrivate)
index ba57f6d5d476a6a3d9a0902013f491b875f04fd7..530a9ee97ac22b9deadeec8bd7ff669fed7973e1 100644 (file)
@@ -58,6 +58,9 @@ typedef enum {
 
 - (void)toggleSmartInsertDelete:(id)sender;
 
 
 - (void)toggleSmartInsertDelete:(id)sender;
 
+- (BOOL)canMakeTextStandardSize;
+- (IBAction)makeTextStandardSize:(id)sender;
+
 @end
 
 @interface WebView (WebPrivate)
 @end
 
 @interface WebView (WebPrivate)