[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
tony at chromium.org
tony at chromium.org
Wed Dec 22 11:32:47 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 55406a7935c6acd75f6223f4dd1d2d24bd175091
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jul 28 23:21:22 2010 +0000
2010-07-28 Tony Chang <tony at chromium.org>
Reviewed by Ojan Vafai.
implement getData('text/html') for webkit win
https://bugs.webkit.org/show_bug.cgi?id=37981
* platform/win/Skipped: 2 tests now pass
2010-07-28 Tony Chang <tony at chromium.org>
Reviewed by Ojan Vafai.
implement getData('text/html') for webkit win
https://bugs.webkit.org/show_bug.cgi?id=37981
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::extractMarkupFromCFHTML):
(WebCore::getCFHTML):
(WebCore::fragmentFromCFHTML):
(WebCore::fragmentFromHTML):
* platform/win/ClipboardUtilitiesWin.h:
* platform/win/ClipboardWin.cpp:
(WebCore::):
(WebCore::clipboardTypeFromMIMEType):
(WebCore::ClipboardWin::getData):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 93e329f..5d4bcef 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-28 Tony Chang <tony at chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ implement getData('text/html') for webkit win
+ https://bugs.webkit.org/show_bug.cgi?id=37981
+
+ * platform/win/Skipped: 2 tests now pass
+
2010-07-28 Alex Nicolaou <anicolao at chromium.org>
Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 2269b9c..4768335 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -846,10 +846,6 @@ fast/repaint/overflow-scroll-body-appear.html
# Need to add functionality to DumpRenderTree to handle scrollbar police changes
fast/overflow/scrollbar-restored-and-then-locked.html
-# Need to handle getting text/html in ClipboardWin::getData.
-editing/pasteboard/onpaste-text-html.html
-fast/events/ondrop-text-html.html
-
# <http://webkit.org/b/37096> http/tests/security/xss-DENIED-iframe-src-alias.html sometimes times out on Windows
http/tests/security/xss-DENIED-iframe-src-alias.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2e5945f..12336ce 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-07-28 Tony Chang <tony at chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ implement getData('text/html') for webkit win
+ https://bugs.webkit.org/show_bug.cgi?id=37981
+
+ * platform/win/ClipboardUtilitiesWin.cpp:
+ (WebCore::extractMarkupFromCFHTML):
+ (WebCore::getCFHTML):
+ (WebCore::fragmentFromCFHTML):
+ (WebCore::fragmentFromHTML):
+ * platform/win/ClipboardUtilitiesWin.h:
+ * platform/win/ClipboardWin.cpp:
+ (WebCore::):
+ (WebCore::clipboardTypeFromMIMEType):
+ (WebCore::ClipboardWin::getData):
+
2010-07-28 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.cpp b/WebCore/platform/win/ClipboardUtilitiesWin.cpp
index f96882c..0130a70 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.cpp
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.cpp
@@ -169,6 +169,23 @@ HGLOBAL createGlobalData(const Vector<char>& vector)
return globalData;
}
+static String getFullCFHTML(IDataObject* data, bool& success)
+{
+ STGMEDIUM store;
+ if (SUCCEEDED(data->GetData(htmlFormat(), &store))) {
+ // MS HTML Format parsing
+ char* data = static_cast<char*>(GlobalLock(store.hGlobal));
+ SIZE_T dataSize = ::GlobalSize(store.hGlobal);
+ String cfhtml(UTF8Encoding().decode(data, dataSize));
+ GlobalUnlock(store.hGlobal);
+ ReleaseStgMedium(&store);
+ success = true;
+ return cfhtml;
+ }
+ success = false;
+ return String();
+}
+
static void append(Vector<char>& vector, const char* string)
{
vector.append(string, strlen(string));
@@ -179,6 +196,17 @@ static void append(Vector<char>& vector, const CString& string)
vector.append(string.data(), string.length());
}
+// Find the markup between "<!--StartFragment -->" and "<!--EndFragment -->", accounting for browser quirks.
+static String extractMarkupFromCFHTML(const String& cfhtml)
+{
+ unsigned markupStart = cfhtml.find("<html", 0, false);
+ unsigned tagStart = cfhtml.find("startfragment", markupStart, false);
+ unsigned fragmentStart = cfhtml.find('>', tagStart) + 1;
+ unsigned tagEnd = cfhtml.find("endfragment", fragmentStart, false);
+ unsigned fragmentEnd = cfhtml.reverseFind('<', tagEnd);
+ return cfhtml.substring(fragmentStart, fragmentEnd - fragmentStart).stripWhiteSpace();
+}
+
// Documentation for the CF_HTML format is available at http://msdn.microsoft.com/workshop/networking/clipboard/htmlclipboard.asp
void markupToCFHTML(const String& markup, const String& srcURL, Vector<char>& result)
{
@@ -396,6 +424,14 @@ String getTextHTML(IDataObject* data, bool& success)
return html;
}
+String getCFHTML(IDataObject* data, bool& success)
+{
+ String cfhtml = getFullCFHTML(data, success);
+ if (success)
+ return extractMarkupFromCFHTML(cfhtml);
+ return String();
+}
+
PassRefPtr<DocumentFragment> fragmentFromFilenames(Document*, const IDataObject*)
{
// FIXME: We should be able to create fragments from files
@@ -410,7 +446,7 @@ bool containsFilenames(const IDataObject*)
// Convert a String containing CF_HTML formatted text to a DocumentFragment
PassRefPtr<DocumentFragment> fragmentFromCFHTML(Document* doc, const String& cfhtml)
-{
+{
// obtain baseURL if present
String srcURLStr("sourceURL:");
String srcURL;
@@ -423,38 +459,24 @@ PassRefPtr<DocumentFragment> fragmentFromCFHTML(Document* doc, const String& cfh
srcURL = rawSrcURL.stripWhiteSpace();
}
- // find the markup between "<!--StartFragment -->" and "<!--EndFragment -->", accounting for browser quirks
- unsigned markupStart = cfhtml.find("<html", 0, false);
- unsigned tagStart = cfhtml.find("startfragment", markupStart, false);
- unsigned fragmentStart = cfhtml.find('>', tagStart) + 1;
- unsigned tagEnd = cfhtml.find("endfragment", fragmentStart, false);
- unsigned fragmentEnd = cfhtml.reverseFind('<', tagEnd);
- String markup = cfhtml.substring(fragmentStart, fragmentEnd - fragmentStart).stripWhiteSpace();
-
+ String markup = extractMarkupFromCFHTML(cfhtml);
return createFragmentFromMarkup(doc, markup, srcURL, FragmentScriptingNotAllowed);
}
-
PassRefPtr<DocumentFragment> fragmentFromHTML(Document* doc, IDataObject* data)
{
if (!doc || !data)
return 0;
- STGMEDIUM store;
- String html;
- String srcURL;
- if (SUCCEEDED(data->GetData(htmlFormat(), &store))) {
- // MS HTML Format parsing
- char* data = static_cast<char*>(GlobalLock(store.hGlobal));
- SIZE_T dataSize = ::GlobalSize(store.hGlobal);
- String cfhtml(UTF8Encoding().decode(data, dataSize));
- GlobalUnlock(store.hGlobal);
- ReleaseStgMedium(&store);
+ bool success = false;
+ String cfhtml = getFullCFHTML(data, success);
+ if (success) {
if (PassRefPtr<DocumentFragment> fragment = fragmentFromCFHTML(doc, cfhtml))
return fragment;
- }
- bool success = false;
- html = getTextHTML(data, success);
+ }
+
+ String html = getTextHTML(data, success);
+ String srcURL;
if (success)
return createFragmentFromMarkup(doc, html, srcURL, FragmentScriptingNotAllowed);
diff --git a/WebCore/platform/win/ClipboardUtilitiesWin.h b/WebCore/platform/win/ClipboardUtilitiesWin.h
index 4ca46f9..fe01499 100644
--- a/WebCore/platform/win/ClipboardUtilitiesWin.h
+++ b/WebCore/platform/win/ClipboardUtilitiesWin.h
@@ -64,6 +64,7 @@ PassRefPtr<DocumentFragment> fragmentFromCFHTML(Document*, const String& cfhtml)
String getURL(IDataObject*, DragData::FilenameConversionPolicy, bool& success, String* title = 0);
String getPlainText(IDataObject*, bool& success);
String getTextHTML(IDataObject*, bool& success);
+String getCFHTML(IDataObject*, bool& success);
} // namespace WebCore
diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp
index fad1646..6e026d6 100644
--- a/WebCore/platform/win/ClipboardWin.cpp
+++ b/WebCore/platform/win/ClipboardWin.cpp
@@ -70,7 +70,7 @@ static const char szShellDotUrlTemplate[] = "[InternetShortcut]\r\nURL=%s\r\n";
// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft
// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3
-enum ClipboardDataType { ClipboardDataTypeNone, ClipboardDataTypeURL, ClipboardDataTypeText };
+enum ClipboardDataType { ClipboardDataTypeNone, ClipboardDataTypeURL, ClipboardDataTypeText, ClipboardDataTypeTextHTML };
static ClipboardDataType clipboardTypeFromMIMEType(const String& type)
{
@@ -81,6 +81,8 @@ static ClipboardDataType clipboardTypeFromMIMEType(const String& type)
return ClipboardDataTypeText;
if (qType == "url" || qType == "text/uri-list")
return ClipboardDataTypeURL;
+ if (qType == "text/html")
+ return ClipboardDataTypeTextHTML;
return ClipboardDataTypeNone;
}
@@ -505,6 +507,12 @@ String ClipboardWin::getData(const String& type, bool& success) const
return getPlainText(m_dataObject.get(), success);
if (dataType == ClipboardDataTypeURL)
return getURL(m_dataObject.get(), DragData::DoNotConvertFilenames, success);
+ else if (dataType == ClipboardDataTypeTextHTML) {
+ String data = getTextHTML(m_dataObject.get(), success);
+ if (success)
+ return data;
+ return getCFHTML(m_dataObject.get(), success);
+ }
return "";
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list