[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:43:07 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 7fd95cc02ce46ad53fc2bd761e72ebdc3fa58a64
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 1 21:21:07 2004 +0000

            Reviewed by Darin.
    
            - fixed <rdar://problem/3657003>: (HTML Editing: Color panel doesn't work)
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _colorPanelColorAsStyleUsingSelector:]):
            new method, returns a DOMCSSStyleDeclaration *
            (-[WebHTMLView _changeCSSColorUsingSelector:]):
            new method, sets a color-related style attribute on the selection
            (-[WebHTMLView changeDocumentBackgroundColor:]):
            call _changeCSSColorUsingSelector: with @selector(setBackgroundColor:)
            (-[WebHTMLView changeColor:]):
            call _changeCSSColorUsingSelector: with @selector(setColor:); also added
            comments explaining why changeDocumentBackgroundColor: will never actually
            be called until an AppKit code-incest mess is straighted out.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6737 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 89c7263..89c9ae8 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,21 @@
+2004-06-01  John Sullivan  <sullivan at apple.com>
+
+        Reviewed by Darin.
+        
+        - fixed <rdar://problem/3657003>: (HTML Editing: Color panel doesn't work)
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _colorPanelColorAsStyleUsingSelector:]):
+        new method, returns a DOMCSSStyleDeclaration *
+        (-[WebHTMLView _changeCSSColorUsingSelector:]):
+        new method, sets a color-related style attribute on the selection
+        (-[WebHTMLView changeDocumentBackgroundColor:]):
+        call _changeCSSColorUsingSelector: with @selector(setBackgroundColor:)
+        (-[WebHTMLView changeColor:]):
+        call _changeCSSColorUsingSelector: with @selector(setColor:); also added
+        comments explaining why changeDocumentBackgroundColor: will never actually
+        be called until an AppKit code-incest mess is straighted out.
+
 2004-06-01  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Darin
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 8845b25..744b282 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -2420,14 +2420,41 @@ static WebHTMLView *lastHitView = nil;
     ERROR("unimplemented");
 }
 
+- (DOMCSSStyleDeclaration *)_colorPanelColorAsStyleUsingSelector:(SEL)selector
+{
+    WebBridge *bridge = [self _bridge];
+    DOMCSSStyleDeclaration *style = [[bridge DOMDocument] createCSSStyleDeclaration];
+    NSColor *color = [[NSColorPanel sharedColorPanel] color];
+    NSString *colorAsString = [NSString stringWithFormat:@"rgb(%.0f,%.0f,%.0f)", [color redComponent]*255, [color greenComponent]*255, [color blueComponent]*255];
+    ASSERT([style respondsToSelector:selector]);
+    [style performSelector:selector withObject:colorAsString];
+    
+    return style;
+}
+
+- (void)_changeCSSColorUsingSelector:(SEL)selector
+{
+    DOMCSSStyleDeclaration *style = [self _colorPanelColorAsStyleUsingSelector:selector];
+    WebView *webView = [self _webView];
+    WebBridge *bridge = [self _bridge];
+    if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:[bridge selectedDOMRange]]) {
+        [bridge applyStyle:style];
+    }
+}
+
 - (void)changeDocumentBackgroundColor:(id)sender
 {
-    ERROR("unimplemented");
+    [self _changeCSSColorUsingSelector:@selector(setBackgroundColor:)];
 }
 
 - (void)changeColor:(id)sender
 {
-    ERROR("unimplemented");
+    // FIXME: in NSTextView, this method calls changeDocumentBackgroundColor: when a
+    // private call has earlier been made by [NSFontFontEffectsBox changeColor:], see 3674493. 
+    // AppKit will have to be revised to allow this to work with anything that isn't an 
+    // NSTextView. However, this might not be required for Tiger, since the background-color 
+    // changing box in the font panel doesn't work in Mail (3674481), though it does in TextEdit.
+    [self _changeCSSColorUsingSelector:@selector(setColor:)];
 }
 
 - (void)alignCenter:(id)sender

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list