[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 14:27:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 645ffe2c82fabe5cb18aef8df04f8c3d6a383a9e
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 8 23:13:38 2010 +0000

    2010-10-08  Daniel Cheng  <dcheng at chromium.org>
    
            Reviewed by Tony Chang.
    
            [chromium] Update ReadableDataObject/WritableDataObject interface for ChromiumDataObject change
            https://bugs.webkit.org/show_bug.cgi?id=47394
    
            Minor cleanup--these classes have suffered from bit rot since they aren't
            actively used at the moment. The three main changes are to:
            1) Condense getURL, setURL, getHTML, setHTML, urlTitle, htmlBaseUrl,
               setUrlTitle, and sethtmlBaseUrl into setters/getters for just the URL
               title and HTML base URL.
            2) Use Clipboard::ClipboardType instead of a bool.
            3) Remove the use of virtuals, as they are no longer needed..
    
            * platform/chromium/ReadableDataObject.cpp:
            (WebCore::clipboardBuffer):
            (WebCore::ReadableDataObject::create):
            (WebCore::ReadableDataObject::ReadableDataObject):
            (WebCore::ReadableDataObject::getData):
            (WebCore::ReadableDataObject::urlTitle): renamed from getURL
            (WebCore::ReadableDataObject::htmlBaseUrl): renamed from getHTML
            (WebCore::ReadableDataObject::containsFilenames):
            (WebCore::ReadableDataObject::filenames):
            (WebCore::ReadableDataObject::ensureTypeCacheInitialized):
            * platform/chromium/ReadableDataObject.h:
            * platform/chromium/WritableDataObject.cpp:
            (WebCore::WritableDataObject::create):
            (WebCore::WritableDataObject::WritableDataObject):
            (WebCore::WritableDataObject::setData):
            * platform/chromium/WritableDataObject.h:
            (WebCore::WritableDataObject::setUrlTitle): renamed from setURL
            (WebCore::WritableDataObject::setHtmlBaseUrl): renamed from setHTML
            (WebCore::WritableDataObject::dataMap):
            (WebCore::WritableDataObject::urlTitle):
            (WebCore::WritableDataObject::htmlBaseURL):
            (WebCore::WritableDataObject::fileExtension):
            (WebCore::WritableDataObject::fileContentFilename):
            (WebCore::WritableDataObject::fileContent):
            (WebCore::WritableDataObject::setFileExtension):
            (WebCore::WritableDataObject::setFileContentFilename):
            (WebCore::WritableDataObject::setFileContent):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69431 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 996fb18..7c5cebe 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-10-08  Daniel Cheng  <dcheng at chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [chromium] Update ReadableDataObject/WritableDataObject interface for ChromiumDataObject change
+        https://bugs.webkit.org/show_bug.cgi?id=47394
+
+        Minor cleanup--these classes have suffered from bit rot since they aren't
+        actively used at the moment. The three main changes are to:
+        1) Condense getURL, setURL, getHTML, setHTML, urlTitle, htmlBaseUrl,
+           setUrlTitle, and sethtmlBaseUrl into setters/getters for just the URL
+           title and HTML base URL.
+        2) Use Clipboard::ClipboardType instead of a bool.
+        3) Remove the use of virtuals, as they are no longer needed..
+
+        * platform/chromium/ReadableDataObject.cpp:
+        (WebCore::clipboardBuffer):
+        (WebCore::ReadableDataObject::create):
+        (WebCore::ReadableDataObject::ReadableDataObject):
+        (WebCore::ReadableDataObject::getData):
+        (WebCore::ReadableDataObject::urlTitle): renamed from getURL
+        (WebCore::ReadableDataObject::htmlBaseUrl): renamed from getHTML
+        (WebCore::ReadableDataObject::containsFilenames):
+        (WebCore::ReadableDataObject::filenames):
+        (WebCore::ReadableDataObject::ensureTypeCacheInitialized):
+        * platform/chromium/ReadableDataObject.h:
+        * platform/chromium/WritableDataObject.cpp:
+        (WebCore::WritableDataObject::create):
+        (WebCore::WritableDataObject::WritableDataObject):
+        (WebCore::WritableDataObject::setData):
+        * platform/chromium/WritableDataObject.h:
+        (WebCore::WritableDataObject::setUrlTitle): renamed from setURL
+        (WebCore::WritableDataObject::setHtmlBaseUrl): renamed from setHTML
+        (WebCore::WritableDataObject::dataMap):
+        (WebCore::WritableDataObject::urlTitle):
+        (WebCore::WritableDataObject::htmlBaseURL):
+        (WebCore::WritableDataObject::fileExtension):
+        (WebCore::WritableDataObject::fileContentFilename):
+        (WebCore::WritableDataObject::fileContent):
+        (WebCore::WritableDataObject::setFileExtension):
+        (WebCore::WritableDataObject::setFileContentFilename):
+        (WebCore::WritableDataObject::setFileContent):
+
 2010-10-08  Abhishek Arya  <inferno at chromium.org>
 
         Unreviewed, rolling out r69360.
diff --git a/WebCore/platform/chromium/ReadableDataObject.cpp b/WebCore/platform/chromium/ReadableDataObject.cpp
index 088673f..f0fdd19 100644
--- a/WebCore/platform/chromium/ReadableDataObject.cpp
+++ b/WebCore/platform/chromium/ReadableDataObject.cpp
@@ -36,18 +36,18 @@
 
 namespace WebCore {
 
-static PasteboardPrivate::ClipboardBuffer clipboardBuffer(bool isForDragging)
+static PasteboardPrivate::ClipboardBuffer clipboardBuffer(Clipboard::ClipboardType clipboardType)
 {
-    return isForDragging ? PasteboardPrivate::DragBuffer : PasteboardPrivate::StandardBuffer;
+    return clipboardType == Clipboard::DragAndDrop ? PasteboardPrivate::DragBuffer : PasteboardPrivate::StandardBuffer;
 }
 
-PassRefPtr<ReadableDataObject> ReadableDataObject::create(bool isForDragging)
+PassRefPtr<ReadableDataObject> ReadableDataObject::create(Clipboard::ClipboardType clipboardType)
 {
-    return adoptRef(new ReadableDataObject(isForDragging));
+    return adoptRef(new ReadableDataObject(clipboardType));
 }
 
-ReadableDataObject::ReadableDataObject(bool isForDragging)
-    : m_isForDragging(isForDragging)
+ReadableDataObject::ReadableDataObject(Clipboard::ClipboardType clipboardType)
+    : m_clipboardType(clipboardType)
     , m_containsFilenames(false)
     , m_isTypeCacheInitialized(false)
 {
@@ -70,33 +70,29 @@ String ReadableDataObject::getData(const String& type, bool& succeeded) const
     String data;
     String ignoredMetadata;
     succeeded = ChromiumBridge::clipboardReadData(
-        clipboardBuffer(m_isForDragging), type, data, ignoredMetadata);
+        clipboardBuffer(m_clipboardType), type, data, ignoredMetadata);
     return data;
 }
 
-String ReadableDataObject::getURL(String* title) const
+String ReadableDataObject::urlTitle() const
 {
-    String url;
-    String ignoredTitle;
-    if (!title)
-        title = &ignoredTitle;
+    String ignoredData;
+    String urlTitle;
     ChromiumBridge::clipboardReadData(
-        clipboardBuffer(m_isForDragging), mimeTypeTextURIList, url, *title);
-    return url;
+        clipboardBuffer(m_clipboardType), mimeTypeTextURIList, ignoredData, urlTitle);
+    return urlTitle;
 }
 
-String ReadableDataObject::getHTML(String* baseURL) const
+KURL ReadableDataObject::htmlBaseUrl() const
 {
-    String html;
-    String ignoredBaseURL;
-    if (!baseURL)
-        baseURL = &ignoredBaseURL;
+    String ignoredData;
+    String htmlBaseUrl;
     ChromiumBridge::clipboardReadData(
-        clipboardBuffer(m_isForDragging), mimeTypeTextHTML, html, *baseURL);
-    return html;
+        clipboardBuffer(m_clipboardType), mimeTypeTextHTML, ignoredData, htmlBaseUrl);
+    return KURL(ParsedURLString, htmlBaseUrl);
 }
 
-bool ReadableDataObject::hasFilenames() const
+bool ReadableDataObject::containsFilenames() const
 {
     ensureTypeCacheInitialized();
     return m_containsFilenames;
@@ -104,7 +100,7 @@ bool ReadableDataObject::hasFilenames() const
 
 Vector<String> ReadableDataObject::filenames() const
 {
-    return ChromiumBridge::clipboardReadFilenames(clipboardBuffer(m_isForDragging));
+    return ChromiumBridge::clipboardReadFilenames(clipboardBuffer(m_clipboardType));
 }
 
 void ReadableDataObject::ensureTypeCacheInitialized() const
@@ -113,7 +109,7 @@ void ReadableDataObject::ensureTypeCacheInitialized() const
         return;
 
     m_types = ChromiumBridge::clipboardReadAvailableTypes(
-        clipboardBuffer(m_isForDragging), &m_containsFilenames);
+        clipboardBuffer(m_clipboardType), &m_containsFilenames);
     m_isTypeCacheInitialized = true;
 }
 
diff --git a/WebCore/platform/chromium/ReadableDataObject.h b/WebCore/platform/chromium/ReadableDataObject.h
index 60f6d45..027e0ed 100644
--- a/WebCore/platform/chromium/ReadableDataObject.h
+++ b/WebCore/platform/chromium/ReadableDataObject.h
@@ -31,6 +31,7 @@
 #ifndef ReadableDataObject_h
 #define ReadableDataObject_h
 
+#include "Clipboard.h"
 #include "PlatformString.h"
 #include <wtf/HashSet.h>
 #include <wtf/RefCounted.h>
@@ -43,26 +44,25 @@ namespace WebCore {
 // browser to the renderer.
 class ReadableDataObject : public RefCounted<ReadableDataObject> {
 public:
-    static PassRefPtr<ReadableDataObject> create(bool isForDragging);
+    static PassRefPtr<ReadableDataObject> create(Clipboard::ClipboardType);
 
-    virtual bool hasData() const;
-    virtual HashSet<String> types() const;
-    virtual String getData(const String& type, bool& succeeded) const;
+    bool hasData() const;
+    HashSet<String> types() const;
+    String getData(const String& type, bool& succeeded) const;
 
-    virtual String getURL(String* title) const;
-    virtual String getHTML(String* baseURL) const;
+    String urlTitle() const;
+    KURL htmlBaseUrl() const;
 
-    virtual bool hasFilenames() const;
-    virtual Vector<String> filenames() const;
+    bool containsFilenames() const;
+    Vector<String> filenames() const;
 
 private:
-    explicit ReadableDataObject(bool isForDragging);
+    explicit ReadableDataObject(Clipboard::ClipboardType);
 
     // This isn't always const... but most of the time it is.
     void ensureTypeCacheInitialized() const;
 
-
-    bool m_isForDragging;
+    Clipboard::ClipboardType m_clipboardType;
 
     // To avoid making a lot of IPC calls for each drag event, we cache some
     // values in the renderer.
diff --git a/WebCore/platform/chromium/WritableDataObject.cpp b/WebCore/platform/chromium/WritableDataObject.cpp
index aee7bfc..ec8ff6e 100644
--- a/WebCore/platform/chromium/WritableDataObject.cpp
+++ b/WebCore/platform/chromium/WritableDataObject.cpp
@@ -36,13 +36,13 @@
 
 namespace WebCore {
 
-PassRefPtr<WritableDataObject> WritableDataObject::create(bool isForDragging)
+PassRefPtr<WritableDataObject> WritableDataObject::create(Clipboard::ClipboardType clipboardType)
 {
-    return adoptRef(new WritableDataObject(isForDragging));
+    return adoptRef(new WritableDataObject(clipboardType));
 }
 
-WritableDataObject::WritableDataObject(bool isForDragging)
-    : m_isForDragging(isForDragging)
+WritableDataObject::WritableDataObject(Clipboard::ClipboardType clipboardType)
+    : m_clipboardType(clipboardType)
 {
 }
 
@@ -76,7 +76,7 @@ void WritableDataObject::clearAll()
 
 bool WritableDataObject::setData(const String& type, const String& data)
 {
-    if (!m_isForDragging) {
+    if (m_clipboardType == Clipboard::CopyAndPaste) {
         ChromiumBridge::clipboardWriteData(type, data, "");
         return true;
     }
@@ -88,65 +88,4 @@ bool WritableDataObject::setData(const String& type, const String& data)
     return true;
 }
 
-void WritableDataObject::setURL(const String& url, const String& title)
-{
-    setData(mimeTypeTextURIList, url);
-    m_urlTitle = title;
-}
-
-void WritableDataObject::setHTML(const String& html, const KURL& baseURL)
-{
-    setData(mimeTypeTextHTML, html);
-    m_htmlBaseURL = baseURL;
-}
-
-// Accessors used when transferring drag data from the renderer to the
-// browser.
-HashMap<String, String> WritableDataObject::dataMap() const
-{
-    return m_dataMap;
-}
-
-String WritableDataObject::urlTitle() const
-{
-    return m_urlTitle;
-}
-
-KURL WritableDataObject::htmlBaseURL() const
-{
-    return m_htmlBaseURL;
-}
-
-// Used for transferring file data from the renderer to the browser.
-String WritableDataObject::fileExtension() const
-{
-    return m_fileExtension;
-}
-
-String WritableDataObject::fileContentFilename() const
-{
-    return m_fileContentFilename;
-}
-
-PassRefPtr<SharedBuffer> WritableDataObject::fileContent() const
-{
-    return m_fileContent;
-}
-
-void WritableDataObject::setFileExtension(const String& fileExtension)
-{
-    m_fileExtension = fileExtension;
-}
-
-void WritableDataObject::setFileContentFilename(const String& fileContentFilename)
-{
-    m_fileContentFilename = fileContentFilename;
-}
-
-void WritableDataObject::setFileContent(PassRefPtr<SharedBuffer> fileContent)
-{
-    m_fileContent = fileContent;
-}
-
-
 } // namespace WebCore
diff --git a/WebCore/platform/chromium/WritableDataObject.h b/WebCore/platform/chromium/WritableDataObject.h
index 71e2e26..c475d15 100644
--- a/WebCore/platform/chromium/WritableDataObject.h
+++ b/WebCore/platform/chromium/WritableDataObject.h
@@ -31,6 +31,7 @@
 #ifndef WritableDataObject_h
 #define WritableDataObject_h
 
+#include "Clipboard.h"
 #include "KURL.h"
 #include "PlatformString.h"
 #include "SharedBuffer.h"
@@ -47,32 +48,32 @@ namespace WebCore {
 // atomically.
 class WritableDataObject : public RefCounted<WritableDataObject> {
 public:
-    static PassRefPtr<WritableDataObject> create(bool isForDragging);
+    static PassRefPtr<WritableDataObject> create(Clipboard::ClipboardType);
 
-    virtual void clearData(const String& type);
-    virtual void clearAllExceptFiles();
-    virtual void clearAll();
-    virtual bool setData(const String& type, const String& data);
+    void clearData(const String& type);
+    void clearAllExceptFiles();
+    void clearAll();
+    bool setData(const String& type, const String& data);
 
-    virtual void setURL(const String& url, const String& title);
-    virtual void setHTML(const String& html, const KURL& baseURL);
+    void setUrlTitle(const String& title) { m_urlTitle = title; }
+    void setHtmlBaseUrl(const KURL& baseURL) { m_htmlBaseURL = baseURL; }
 
     // Used for transferring drag data from the renderer to the browser.
-    virtual HashMap<String, String> dataMap() const;
-    virtual String urlTitle() const;
-    virtual KURL htmlBaseURL() const;
+    HashMap<String, String> dataMap() const { return m_dataMap; }
+    String urlTitle() const { return m_urlTitle; }
+    KURL htmlBaseURL() const { return m_htmlBaseURL; }
 
-    virtual String fileExtension() const;
-    virtual String fileContentFilename() const;
-    virtual PassRefPtr<SharedBuffer> fileContent() const;
-    virtual void setFileExtension(const String&);
-    virtual void setFileContentFilename(const String&);
-    virtual void setFileContent(PassRefPtr<SharedBuffer>);
+    String fileExtension() const { return m_fileExtension; }
+    String fileContentFilename() const { return m_fileContentFilename; }
+    PassRefPtr<SharedBuffer> fileContent() const { return m_fileContent; }
+    void setFileExtension(const String& fileExtension) { m_fileExtension = fileExtension; }
+    void setFileContentFilename(const String& fileContentFilename) { m_fileContentFilename = fileContentFilename; }
+    void setFileContent(PassRefPtr<SharedBuffer> fileContent) { m_fileContent = fileContent; }
 
 private:
-    explicit WritableDataObject(bool isForDragging);
+    explicit WritableDataObject(Clipboard::ClipboardType);
 
-    bool m_isForDragging;
+    Clipboard::ClipboardType m_clipboardType;
 
     HashMap<String, String> m_dataMap;
     String m_urlTitle;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list