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

weinig at apple.com weinig at apple.com
Wed Dec 22 13:33:20 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3619f4324d810b6d70e4cd16ae62e2654af25d42
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 15:08:41 2010 +0000

    Add WebKit2 API to load a string as plain text
    https://bugs.webkit.org/show_bug.cgi?id=46091
    
    Reviewed by Adam Roben.
    
    * Shared/CoreIPCSupport/WebPageMessageKinds.h:
    * UIProcess/API/C/WKPage.cpp:
    (WKPageLoadPlainTextString):
    * UIProcess/API/C/WKPage.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::loadPlainTextString):
    * UIProcess/WebPageProxy.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::loadData):
    (WebKit::WebPage::loadHTMLString):
    (WebKit::WebPage::loadPlainTextString):
    (WebKit::WebPage::didReceiveMessage):
    * WebProcess/WebPage/WebPage.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67849 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index db8734b..b4a16cb 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
+2010-09-20  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Add WebKit2 API to load a string as plain text
+        https://bugs.webkit.org/show_bug.cgi?id=46091
+
+        * Shared/CoreIPCSupport/WebPageMessageKinds.h:
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageLoadPlainTextString):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadPlainTextString):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::loadData):
+        (WebKit::WebPage::loadHTMLString):
+        (WebKit::WebPage::loadPlainTextString):
+        (WebKit::WebPage::didReceiveMessage):
+        * WebProcess/WebPage/WebPage.h:
+
 2010-09-19  Sam Weinig  <sam at webkit.org>
 
         Fix windows build.
diff --git a/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
index 4f5df09..62b317c 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
@@ -45,6 +45,7 @@ enum Kind {
     LoadURL,
     LoadURLRequest,
     LoadHTMLString,
+    LoadPlainTextString,
     MouseEvent,
     PreferencesDidChange,
     ReapplyEditCommand,
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 0619e3c..7f316bb 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -62,6 +62,11 @@ void WKPageLoadHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef
     toWK(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef));    
 }
 
+void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef)
+{
+    toWK(pageRef)->loadPlainTextString(toWTFString(plainTextStringRef));    
+}
+
 void WKPageStopLoading(WKPageRef pageRef)
 {
     toWK(pageRef)->stopLoading();
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 2137f86..03f7d07 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -172,6 +172,7 @@ WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
 WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
 WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest);
 WK_EXPORT void WKPageLoadHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL);
+WK_EXPORT void WKPageLoadPlainTextString(WKPageRef page, WKStringRef plainTextString);
 
 WK_EXPORT void WKPageStopLoading(WKPageRef page);
 WK_EXPORT void WKPageReload(WKPageRef page);
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 1eb3d08..331285f 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -251,6 +251,13 @@ void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseUR
     process()->send(WebPageMessage::LoadHTMLString, m_pageID, CoreIPC::In(htmlString, baseURL));
 }
 
+void WebPageProxy::loadPlainTextString(const String& string)
+{
+    if (!isValid())
+        return;
+    process()->send(WebPageMessage::LoadPlainTextString, m_pageID, CoreIPC::In(string));
+}
+
 void WebPageProxy::stopLoading()
 {
     if (!isValid())
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index fe41ccc..44f6046 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -115,6 +115,7 @@ public:
     void loadURL(const String&);
     void loadURLRequest(WebURLRequest*);
     void loadHTMLString(const String& htmlString, const String& baseURL);
+    void loadPlainTextString(const String& string);
 
     void stopLoading();
     void reload(bool reloadFromOrigin);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 8fdce73..65d8705 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -249,18 +249,24 @@ void WebPage::loadURLRequest(const ResourceRequest& request)
     m_mainFrame->coreFrame()->loader()->load(request, false);
 }
 
+void WebPage::loadData(PassRefPtr<SharedBuffer> sharedBuffer, const String& MIMEType, const String& encodingName, const KURL& baseURL, const KURL& failingURL)
+{
+    ResourceRequest request(baseURL);
+    SubstituteData substituteData(sharedBuffer, MIMEType, encodingName, failingURL);
+    m_mainFrame->coreFrame()->loader()->load(request, substituteData, false);
+}
+
 void WebPage::loadHTMLString(const String& htmlString, const String& baseURLString)
 {
     RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar));
-    String MIMEType("text/html");
-    String encodingName("utf-16");
     KURL baseURL = baseURLString.isEmpty() ? blankURL() : KURL(KURL(), baseURLString);
-    KURL failingURL;
-
-    ResourceRequest request(baseURL);
-    SubstituteData substituteData(sharedBuffer.release(), MIMEType, encodingName, failingURL);
+    loadData(sharedBuffer, "text/html", "utf-16", baseURL, KURL());
+}
 
-    m_mainFrame->coreFrame()->loader()->load(request, substituteData, false);
+void WebPage::loadPlainTextString(const String& string)
+{
+    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(string.characters()), string.length() * sizeof(UChar));
+    loadData(sharedBuffer, "text/plain", "utf-16", blankURL(), KURL());
 }
 
 void WebPage::stopLoading()
@@ -765,12 +771,20 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
         case WebPageMessage::LoadHTMLString: {
             String htmlString;
             String baseURL;
-            if (!arguments->decode(CoreIPC::In(htmlString, baseURL)))
+            if (!arguments->decode(CoreIPC::Out(htmlString, baseURL)))
                 return;
             
             loadHTMLString(htmlString, baseURL);
             return;
         }
+        case WebPageMessage::LoadPlainTextString: {
+            String string;
+            if (!arguments->decode(CoreIPC::Out(string)))
+                return;
+            
+            loadPlainTextString(string);
+            return;
+        }
         case WebPageMessage::StopLoading:
             stopLoading();
             return;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 0ed6586..1a674e6 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -56,6 +56,7 @@ namespace WebCore {
     class KeyboardEvent;
     class Page;
     class ResourceRequest;
+    class SharedBuffer;
 }
 
 namespace WebKit {
@@ -153,11 +154,14 @@ private:
 
     String sourceForFrame(WebFrame*);
 
+    void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL);
+
     // Actions
     void tryClose();
     void loadURL(const String&);
     void loadURLRequest(const WebCore::ResourceRequest&);
     void loadHTMLString(const String& htmlString, const String& baseURL);
+    void loadPlainTextString(const String&);
     void reload(bool reloadFromOrigin);
     void goForward(uint64_t);
     void goBack(uint64_t);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list