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

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:43:24 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 5c06b49d27a74dc76ce0eaa6d01d043f2904a57c
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 3 06:57:50 2004 +0000

    	Added types property to JS clipboard object.
    
            Reviewed by Richard.
    
            * khtml/ecma/kjs_events.cpp:
            (Clipboard::getValueProperty):  Create JS array for strings coming from the clipboard impl.
            * khtml/ecma/kjs_events.h:
            (KJS::Clipboard::):
            * khtml/ecma/kjs_events.lut.h:
            * kwq/KWQClipboard.mm:
            (MIMETypeFromCocoaType):  New helper routine to map types.
            (KWQClipboard::types):  Implement based on NSPasteboard's types.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6750 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c3af8e3..d9a807b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2004-06-02  Trey Matteson  <trey at apple.com>
+
+	Added types property to JS clipboard object.
+
+        Reviewed by Richard.
+
+        * khtml/ecma/kjs_events.cpp:
+        (Clipboard::getValueProperty):  Create JS array for strings coming from the clipboard impl.
+        * khtml/ecma/kjs_events.h:
+        (KJS::Clipboard::):
+        * khtml/ecma/kjs_events.lut.h:
+        * kwq/KWQClipboard.mm:
+        (MIMETypeFromCocoaType):  New helper routine to map types.
+        (KWQClipboard::types):  Implement based on NSPasteboard's types.
+
 2004-06-02  Richard Williamson   <rjw at apple.com>
 
 	Corrected typo ID_IMG should have been ID_CANVAS when
diff --git a/WebCore/khtml/ecma/kjs_events.cpp b/WebCore/khtml/ecma/kjs_events.cpp
index 2e6c392..5a18f3c 100644
--- a/WebCore/khtml/ecma/kjs_events.cpp
+++ b/WebCore/khtml/ecma/kjs_events.cpp
@@ -889,9 +889,10 @@ Value DOMMutationEventProtoFunc::tryCall(ExecState *exec, Object &thisObj, const
 const ClassInfo Clipboard::info = { "Clipboard", 0, &ClipboardTable, 0 };
 
 /* Source for ClipboardTable. Use "make hashtables" to regenerate.
- at begin ClipboardTable 2
+ at begin ClipboardTable 3
   dropEffect	Clipboard::DropEffect	DontDelete
   dropAllowed	Clipboard::DropAllowed	DontDelete
+  types         Clipboard::Types	DontDelete|ReadOnly
 @end
 @begin ClipboardProtoTable 4
   clearData	Clipboard::ClearData	DontDelete|Function 0
@@ -932,6 +933,19 @@ Value Clipboard::getValueProperty(ExecState *exec, int token) const
             return String(clipboard->dropEffect());
         case DropAllowed:
             return String(clipboard->dropAllowed());
+        case Types:
+        {
+            QStringList qTypes = clipboard->types();
+            if (qTypes.isEmpty()) {
+                return Null(); 
+            } else {
+                List list;
+                for (QStringList::Iterator it = qTypes.begin(); it != qTypes.end(); ++it) {
+                    list.append(String(UString(*it)));
+                }
+                return exec->lexicalInterpreter()->builtinArray().construct(exec, list);
+            }
+        }
         default:
             kdWarning() << "Clipboard::getValueProperty unhandled token " << token << endl;
             return Value();
diff --git a/WebCore/khtml/ecma/kjs_events.h b/WebCore/khtml/ecma/kjs_events.h
index 310d7fb..191801e 100644
--- a/WebCore/khtml/ecma/kjs_events.h
+++ b/WebCore/khtml/ecma/kjs_events.h
@@ -200,7 +200,7 @@ namespace KJS {
     virtual bool toBoolean(ExecState *) const { return true; }
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
-    enum { ClearData, GetData, SetData, SetDragImage, DropEffect, DropAllowed };
+    enum { ClearData, GetData, SetData, Types, SetDragImage, DropEffect, DropAllowed };
   private:
     DOM::ClipboardImpl *clipboard;
   };
diff --git a/WebCore/khtml/ecma/kjs_events.lut.h b/WebCore/khtml/ecma/kjs_events.lut.h
index 9de2e2d..540c28b 100644
--- a/WebCore/khtml/ecma/kjs_events.lut.h
+++ b/WebCore/khtml/ecma/kjs_events.lut.h
@@ -214,11 +214,13 @@ const struct HashTable DOMMutationEventProtoTable = { 2, 1, DOMMutationEventProt
 namespace KJS {
 
 const struct HashEntry ClipboardTableEntries[] = {
-   { "dropEffect", Clipboard::DropEffect, DontDelete, 0, 0 },
+   { "dropEffect", Clipboard::DropEffect, DontDelete, 0, &ClipboardTableEntries[3] },
+   { "types", Clipboard::Types, DontDelete|ReadOnly, 0, 0 },
+   { 0, 0, 0, 0, 0 },
    { "dropAllowed", Clipboard::DropAllowed, DontDelete, 0, 0 }
 };
 
-const struct HashTable ClipboardTable = { 2, 2, ClipboardTableEntries, 2 };
+const struct HashTable ClipboardTable = { 2, 4, ClipboardTableEntries, 3 };
 
 } // namespace
 
diff --git a/WebCore/kwq/KWQClipboard.mm b/WebCore/kwq/KWQClipboard.mm
index 1d8b0e7..cb48c2b 100644
--- a/WebCore/kwq/KWQClipboard.mm
+++ b/WebCore/kwq/KWQClipboard.mm
@@ -95,11 +95,23 @@ static NSString *cocoaTypeFromMIMEType(const DOMString &type) {
     }
 }
 
-/*
-static QString MIMETypeFromCocoaType(NSString type) {
-    return QString("");
+static QString MIMETypeFromCocoaType(NSString *type)
+{
+    if ([type isEqualToString:NSStringPboardType]) {
+        return QString("text/plain");
+    } else if ([type isEqualToString:NSURLPboardType]
+               || [type isEqualToString:NSFilenamesPboardType]) {
+        return QString("text/uri-list");
+    } else if ([type isEqualToString:NSHTMLPboardType]) {
+        return QString("text/html");
+    } else if ([type isEqualToString:NSHTMLPboardType]) {
+        return QString("text/rtf");
+    } else {
+        // FIXME - Better fallback for Foo might be application/Foo
+        // FIXME - Ignore way old _NSAsciiPboardType, used by 3.3 apps
+        return QString::fromNSString(type);
+    }    
 }
-*/
 
 void KWQClipboard::clearData(const DOMString &type)
 {
@@ -197,18 +209,19 @@ bool KWQClipboard::setData(const DOMString &type, const DOMString &data)
 
 QStringList KWQClipboard::types() const
 {
-#if 0
     NSArray *types = [m_pasteboard types];
     QStringList result;
     if (types) {
         unsigned count = [types count];
         unsigned i;
         for (i = 0; i < count; i++) {
-            NSString *nsstr = [types objectAtIndex:i];
+            QString qstr = MIMETypeFromCocoaType([types objectAtIndex:i]);
+            if (!result.contains(qstr)) {
+                result.append(qstr);
+            }
         }
     }
-#endif
-    return QStringList();
+    return result;
 }
 
 QPoint KWQClipboard::dragLocation() const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list