[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

sullivan sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:37:33 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 3657e98898eb8c532488093c2f82b24bbb49ac49
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 28 18:45:45 2004 +0000

            Initial plumbing to get the font panel to be updated from an editable
            WebView.
    
            Reviewed by Ken.
    
            * WebView.subproj/WebView.m:
            (-[WebView _textAttributesFromStyle:]):
            new dummy method, will need implementation
            (-[WebView _updateFontPanel]):
            new method, sets the font shown in the font panel from the current
            selection. Lots of placeholder stuff.
            (-[WebView setSelectedDOMRange:affinity:]):
            call _updateFontPanel here for now.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6504 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a64bfa3..9ada97c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2004-04-28  John Sullivan  <sullivan at apple.com>
+
+        Initial plumbing to get the font panel to be updated from an editable
+        WebView.
+
+        Reviewed by Ken.
+
+        * WebView.subproj/WebView.m:
+        (-[WebView _textAttributesFromStyle:]):
+        new dummy method, will need implementation
+        (-[WebView _updateFontPanel]):
+        new method, sets the font shown in the font panel from the current
+        selection. Lots of placeholder stuff.
+        (-[WebView setSelectedDOMRange:affinity:]):
+        call _updateFontPanel here for now.
+
 2004-04-28  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Darin
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index ed092e9..91ca04f 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -2142,6 +2142,57 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 @implementation WebView (WebViewEditing)
 
+- (NSDictionary *)_textAttributesFromStyle:(DOMCSSStyleDeclaration *)style
+{
+    // FIXME: this should probably be a method of DOMCSSStyleDeclaration
+    ERROR("unimplemented");
+    return nil;
+}
+
+- (void)_updateFontPanel
+{
+    // FIXME: can we bail out if [NSFontManager fontPanel:NO] returns nil? (Will we somehow be notified or asked
+    // to provide a font when the font panel first comes into existence?)
+    // FIXME: NSTextView bails out if becoming or resigning first responder, for which it has ivar flags. Not
+    // sure if we need to do something similar.
+    
+    if (![self _currentSelectionIsEditable]) {
+        return;
+    }
+    
+    NSWindow *window = [self window];
+    // FIXME: is this first-responder check correct? What happens if a subframe is editable and is first responder?
+    if ([NSApp keyWindow] != window || [window firstResponder] != [[[self mainFrame] frameView] documentView]) {
+        return;
+    }
+    
+    NSFont *font = nil;
+    BOOL onlyOneFontInSelection = YES;
+    BOOL attributesIdenticalThroughoutSelection = YES;
+    NSDictionary *textAttributes = nil;
+    DOMCSSStyleDeclaration *style = nil;
+    NSFontManager *fm = [NSFontManager sharedFontManager];
+    
+    if ([[self _bridgeForCurrentSelection] haveSelection]) {
+        // FIXME: get first element in selection, get style, get attributes
+        // and font from style. Then walk through other elements to see whether 
+        // any other styles/attributes are in selection, to update
+        // onlyOneFontInSelection and attributesIdenticalThroughoutSelection. But how to get elements in selection?
+        // FIXME: For now, return some bogus font to test the rest of the code path.
+        font = [NSFont menuFontOfSize:23];
+    } else {
+        style = [self typingStyle];
+        // FIXME: get font from style somehow. For now, return some bogus font to test the rest of the code path.
+        font = [NSFont toolTipsFontOfSize:17];
+        textAttributes = [self _textAttributesFromStyle:style];
+    }
+    
+    if (font != nil) {
+        [fm setSelectedFont:font isMultiple:!onlyOneFontInSelection];
+    }
+    [fm setSelectedAttributes:textAttributes isMultiple:!attributesIdenticalThroughoutSelection];
+}
+
 - (void)_editingKeyDown:(NSEvent *)event
 {   
     // Work around this bug:
@@ -2155,6 +2206,12 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity
 {
     [[self _bridgeForCurrentSelection] setSelectedDOMRange:range affinity:selectionAffinity];
+
+    // FIXME: this doesn't catch the cases where the selection is changed on the other side
+    // of the bridge. Eventually we need to notice all such changes and call _updateFontPanel,
+    // but this is not yet implemented. (The bottlenecks that send the notifications like
+    // webViewDidChangeSelection and friends will also need to call _updateFontPanel).
+    [self _updateFontPanel];
 }
 
 - (DOMRange *)selectedDOMRange

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list