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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:49:42 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 67eb2def0a117862ed59e5a1317941d212e4ad16
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 15 19:47:31 2002 +0000

            Added attributed string to pasteboard.  Fixes 3006760.
            We may want to scale back the content that is included in the
            attributed string.  Currently all text nodes in the selection
            are converted.  This include text nodes for non-visible content,
            i.e. scripts.
            [Note we may also want to put HTML snippet on the pboard.  The appkit
            does support reading text using htmldisplay today.  Of course this should
            eventually migrate to use WebView.]
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView copy:]):
    
            Added API to get attributed string from bridge.
            Added API to get selection in terms of the DOM API
            from the bridge.
    
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (attributedString):
            (-[WebCoreBridge selectionStart]):
            (-[WebCoreBridge selectionStartOffset]):
            (-[WebCoreBridge selectionEnd]):
            (-[WebCoreBridge selectionEndOffset]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index e9b2339..a205e41 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-10-15  Richard Williamson  <rjw at apple.com>
+
+        Added API to get attributed string from bridge.
+        Added API to get selection in terms of the DOM API
+        from the bridge.
+        
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (attributedString):
+        (-[WebCoreBridge selectionStart]):
+        (-[WebCoreBridge selectionStartOffset]):
+        (-[WebCoreBridge selectionEnd]):
+        (-[WebCoreBridge selectionEndOffset]):
+
 2002-10-15  Darin Adler  <darin at apple.com>
 
 	- fixed 3054791 -- crash in WebCoreSettings _updateAllViews changing font
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index e9b2339..a205e41 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,17 @@
+2002-10-15  Richard Williamson  <rjw at apple.com>
+
+        Added API to get attributed string from bridge.
+        Added API to get selection in terms of the DOM API
+        from the bridge.
+        
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (attributedString):
+        (-[WebCoreBridge selectionStart]):
+        (-[WebCoreBridge selectionStartOffset]):
+        (-[WebCoreBridge selectionEnd]):
+        (-[WebCoreBridge selectionEndOffset]):
+
 2002-10-15  Darin Adler  <darin at apple.com>
 
 	- fixed 3054791 -- crash in WebCoreSettings _updateAllViews changing font
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index e9b2339..a205e41 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,17 @@
+2002-10-15  Richard Williamson  <rjw at apple.com>
+
+        Added API to get attributed string from bridge.
+        Added API to get selection in terms of the DOM API
+        from the bridge.
+        
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (attributedString):
+        (-[WebCoreBridge selectionStart]):
+        (-[WebCoreBridge selectionStartOffset]):
+        (-[WebCoreBridge selectionEnd]):
+        (-[WebCoreBridge selectionEndOffset]):
+
 2002-10-15  Darin Adler  <darin at apple.com>
 
 	- fixed 3054791 -- crash in WebCoreSettings _updateAllViews changing font
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 779c500..2185c65 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -101,9 +101,6 @@ typedef khtml::RenderPart KHTMLRenderPart;
 
 - (void)createKHTMLViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
 
-- (NSString *)selectedText;
-- (void)selectAll;
-
 - (BOOL)isFrameSet;
 
 - (void)reapplyStyles;
@@ -140,6 +137,14 @@ typedef khtml::RenderPart KHTMLRenderPart;
 
 - (void)setSelectionFrom:(id<WebDOMNode>)start startOffset:(int)startOffset to:(id<WebDOMNode>)end endOffset:(int) endOffset;
 
+- (NSString *)selectedText;
+- (void)selectAll;
+
+- (id<WebDOMNode>)selectionStart;
+- (int)selectionStartOffset;
+- (id<WebDOMNode>)selectionEnd;
+- (int)selectionEndOffset;
+
 - (NSAttributedString *)attributedStringFrom: (id<WebDOMNode>)startNode startOffset: (int)startOffset to: (id<WebDOMNode>)endNode endOffset: (int)endOffset;
 
 @end
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index beedc2a..7948b10 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -571,6 +571,7 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
     NSFont *font;
     NSMutableAttributedString *result = [[[NSMutableAttributedString alloc] init] autorelease];
     NSAttributedString *partialString;
+    NSColor *color;
     
     while(!n.isNull()) {
         if(n.nodeType() == DOM::Node::TEXT_NODE) {
@@ -581,8 +582,10 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
             font = nil;
             if (renderer){
                 style = renderer->style();
-                if (style)
+                if (style) {
                     font = style->font().getNSFont();
+                    color = style->color().getNSColor();
+                }
             }
             
             hasNewLine = false;            
@@ -596,7 +599,7 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
                 text = str;
                 
             if (font)
-                partialString = [[NSAttributedString alloc] initWithString: text.getNSString() attributes: [NSDictionary dictionaryWithObjectsAndKeys: font, NSFontAttributeName, 0]];
+                partialString = [[NSAttributedString alloc] initWithString: text.getNSString() attributes: [NSDictionary dictionaryWithObjectsAndKeys: font, NSFontAttributeName, NSForegroundColorAttributeName, color, 0]];
             else
                 partialString = [[NSAttributedString alloc] initWithString: text.getNSString() attributes: nil];
                 
@@ -726,4 +729,26 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
     return attributedString ([(WebCoreDOMNode *)startNode impl], startOffset, [(WebCoreDOMNode *)endNode impl], endOffset);
 }
 
+
+- (id<WebDOMNode>)selectionStart
+{
+    return [WebCoreDOMNode nodeWithImpl: part->impl->selectionStart()];
+}
+
+- (int)selectionStartOffset
+{
+    return part->impl->selectionStartOffset();
+}
+
+- (id<WebDOMNode>)selectionEnd
+{
+    return [WebCoreDOMNode nodeWithImpl: part->impl->selectionEnd()];
+}
+
+- (int)selectionEndOffset
+{
+    return part->impl->selectionEndOffset();
+}
+
+
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7475cf9..c5c60d5 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,17 @@
+2002-10-15  Richard Williamson  <rjw at apple.com>
+
+        Added attributed string to pasteboard.  Fixes 3006760.
+        We may want to scale back the content that is included in the
+        attributed string.  Currently all text nodes in the selection
+        are converted.  This include text nodes for non-visible content,
+        i.e. scripts.
+        [Note we may also want to put HTML snippet on the pboard.  The appkit
+        does support reading text using htmldisplay today.  Of course this should
+        eventually migrate to use WebView.]
+        
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView copy:]):
+
 2002-10-15  Darin Adler  <darin at apple.com>
 
 	Fixed bug where URLs dragged to the content area were not made canonical
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 7475cf9..c5c60d5 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-10-15  Richard Williamson  <rjw at apple.com>
+
+        Added attributed string to pasteboard.  Fixes 3006760.
+        We may want to scale back the content that is included in the
+        attributed string.  Currently all text nodes in the selection
+        are converted.  This include text nodes for non-visible content,
+        i.e. scripts.
+        [Note we may also want to put HTML snippet on the pboard.  The appkit
+        does support reading text using htmldisplay today.  Of course this should
+        eventually migrate to use WebView.]
+        
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView copy:]):
+
 2002-10-15  Darin Adler  <darin at apple.com>
 
 	Fixed bug where URLs dragged to the content area were not made canonical
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index bfdce9d..8834a6b 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -92,8 +92,26 @@
 - (void)copy:(id)sender
 {
     NSPasteboard *pboard = [NSPasteboard generalPasteboard];
-    [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil];
-    [pboard setString:[[self _bridge] selectedText] forType:NSStringPboardType];
+    NSAttributedString *attributedString;
+    NSData *attributedData;
+    WebBridge *b = [self _bridge];
+    
+#ifdef SUPPORT_HTML_PBOARD
+    [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, NSHTMLPboardType, NSRTFPboardType, nil] owner:nil];
+#endif
+    [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, NSRTFPboardType, nil] owner:nil];
+    [pboard setString:[b selectedText] forType:NSStringPboardType];
+    
+    // Put attributed string on the pasteboard.
+    attributedString = [b
+        attributedStringFrom: [b selectionStart] startOffset: [b selectionStartOffset]
+        to: [b selectionEnd] endOffset: [b selectionEndOffset]];
+    attributedData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
+    [pboard setData:attributedData forType:NSRTFPboardType];
+
+#ifdef SUPPORT_HTML_PBOARD
+    // Put HTML on the pasteboard.
+#endif
 }
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list