summaryrefslogtreecommitdiff
path: root/Source/WebKit2/Shared/API
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebKit2/Shared/API
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
downloadqtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebKit2/Shared/API')
-rw-r--r--Source/WebKit2/Shared/API/c/WKArray.cpp6
-rw-r--r--Source/WebKit2/Shared/API/c/WKArray.h1
-rw-r--r--Source/WebKit2/Shared/API/c/WKBase.h12
-rw-r--r--Source/WebKit2/Shared/API/c/WKImage.h3
-rw-r--r--Source/WebKit2/Shared/API/c/WKSharedAPICast.h30
-rw-r--r--Source/WebKit2/Shared/API/c/WKURL.cpp5
-rw-r--r--Source/WebKit2/Shared/API/c/WKURL.h1
-rw-r--r--Source/WebKit2/Shared/API/c/WKURLResponse.cpp10
-rw-r--r--Source/WebKit2/Shared/API/c/WKURLResponse.h4
-rw-r--r--Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp3
10 files changed, 74 insertions, 1 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKArray.cpp b/Source/WebKit2/Shared/API/c/WKArray.cpp
index 6ca9af273..5bf35e3c3 100644
--- a/Source/WebKit2/Shared/API/c/WKArray.cpp
+++ b/Source/WebKit2/Shared/API/c/WKArray.cpp
@@ -42,6 +42,12 @@ WKArrayRef WKArrayCreate(WKTypeRef* values, size_t numberOfValues)
return toAPI(array.release().leakRef());
}
+WKArrayRef WKArrayCreateAdoptingValues(WKTypeRef* values, size_t numberOfValues)
+{
+ RefPtr<ImmutableArray> array = ImmutableArray::adopt(reinterpret_cast<APIObject**>(const_cast<void**>(values)), numberOfValues);
+ return toAPI(array.release().leakRef());
+}
+
WKTypeRef WKArrayGetItemAtIndex(WKArrayRef arrayRef, size_t index)
{
return toImpl(arrayRef)->at(index);
diff --git a/Source/WebKit2/Shared/API/c/WKArray.h b/Source/WebKit2/Shared/API/c/WKArray.h
index da4560a0a..25900f313 100644
--- a/Source/WebKit2/Shared/API/c/WKArray.h
+++ b/Source/WebKit2/Shared/API/c/WKArray.h
@@ -37,6 +37,7 @@ extern "C" {
WK_EXPORT WKTypeID WKArrayGetTypeID();
WK_EXPORT WKArrayRef WKArrayCreate(WKTypeRef* values, size_t numberOfValues);
+WK_EXPORT WKArrayRef WKArrayCreateAdoptingValues(WKTypeRef* values, size_t numberOfValues);
WK_EXPORT WKTypeRef WKArrayGetItemAtIndex(WKArrayRef array, size_t index);
WK_EXPORT size_t WKArrayGetSize(WKArrayRef array);
diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h
index ab6ca84cd..1a2761024 100644
--- a/Source/WebKit2/Shared/API/c/WKBase.h
+++ b/Source/WebKit2/Shared/API/c/WKBase.h
@@ -79,6 +79,18 @@ typedef const struct OpaqueWKURLRequest* WKURLRequestRef;
typedef const struct OpaqueWKURLResponse* WKURLResponseRef;
typedef const struct OpaqueWKUserContentURLPattern* WKUserContentURLPatternRef;
+enum WKUserContentInjectedFrames {
+ kWKInjectInAllFrames,
+ kWKInjectInTopFrameOnly
+};
+typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames;
+
+enum WKUserScriptInjectionTime {
+ kWKInjectAtDocumentStart,
+ kWKInjectAtDocumentEnd
+};
+typedef enum WKUserScriptInjectionTime WKUserScriptInjectionTime;
+
/* WebKit2 main API types */
typedef const struct OpaqueWKApplicationCacheManager* WKApplicationCacheManagerRef;
diff --git a/Source/WebKit2/Shared/API/c/WKImage.h b/Source/WebKit2/Shared/API/c/WKImage.h
index 1f23b134a..07437bd76 100644
--- a/Source/WebKit2/Shared/API/c/WKImage.h
+++ b/Source/WebKit2/Shared/API/c/WKImage.h
@@ -41,7 +41,8 @@ typedef uint32_t WKImageOptions;
enum {
kWKSnapshotOptionsShareable = 1 << 0,
kWKSnapshotOptionsExcludeSelectionHighlighting = 1 << 1,
- kWKSnapshotOptionsInViewCoordinates = 1 << 2
+ kWKSnapshotOptionsInViewCoordinates = 1 << 2,
+ kWKSnapshotOptionsPaintSelectionRectangle = 1 << 3
};
typedef uint32_t WKSnapshotOptions;
diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
index 94a77e176..ff9a50fe3 100644
--- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
+++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
@@ -48,6 +48,8 @@
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/IntRect.h>
#include <WebCore/LayoutMilestones.h>
+#include <WebCore/UserContentTypes.h>
+#include <WebCore/UserScriptTypes.h>
#include <wtf/TypeTraits.h>
namespace WebKit {
@@ -807,10 +809,38 @@ inline SnapshotOptions toSnapshotOptions(WKSnapshotOptions wkSnapshotOptions)
snapshotOptions |= SnapshotOptionsExcludeSelectionHighlighting;
if (wkSnapshotOptions & kWKSnapshotOptionsInViewCoordinates)
snapshotOptions |= SnapshotOptionsInViewCoordinates;
+ if (wkSnapshotOptions & kWKSnapshotOptionsPaintSelectionRectangle)
+ snapshotOptions |= SnapshotOptionsPaintSelectionRectangle;
return snapshotOptions;
}
+inline WebCore::UserScriptInjectionTime toUserScriptInjectionTime(WKUserScriptInjectionTime wkInjectedTime)
+{
+ switch (wkInjectedTime) {
+ case kWKInjectAtDocumentStart:
+ return WebCore::InjectAtDocumentStart;
+ case kWKInjectAtDocumentEnd:
+ return WebCore::InjectAtDocumentEnd;
+ }
+
+ ASSERT_NOT_REACHED();
+ return WebCore::InjectAtDocumentStart;
+}
+
+inline WebCore::UserContentInjectedFrames toUserContentInjectedFrames(WKUserContentInjectedFrames wkInjectedFrames)
+{
+ switch (wkInjectedFrames) {
+ case kWKInjectInAllFrames:
+ return WebCore::InjectInAllFrames;
+ case kWKInjectInTopFrameOnly:
+ return WebCore::InjectInTopFrameOnly;
+ }
+
+ ASSERT_NOT_REACHED();
+ return WebCore::InjectInAllFrames;
+}
+
} // namespace WebKit
#endif // WKSharedAPICast_h
diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp
index 2268413a0..24c555dc0 100644
--- a/Source/WebKit2/Shared/API/c/WKURL.cpp
+++ b/Source/WebKit2/Shared/API/c/WKURL.cpp
@@ -40,6 +40,11 @@ WKURLRef WKURLCreateWithUTF8CString(const char* string)
return toAPI(WebURL::create(String::fromUTF8(string)).leakRef());
}
+WKURLRef WKURLCreateWithBaseURL(WKURLRef baseURL, const char* relative)
+{
+ return toAPI(WebURL::create(toImpl(baseURL), String::fromUTF8(relative)).leakRef());
+}
+
WKStringRef WKURLCopyString(WKURLRef url)
{
return toCopiedAPI(toImpl(url)->string());
diff --git a/Source/WebKit2/Shared/API/c/WKURL.h b/Source/WebKit2/Shared/API/c/WKURL.h
index 4e9867246..2c0a02cc4 100644
--- a/Source/WebKit2/Shared/API/c/WKURL.h
+++ b/Source/WebKit2/Shared/API/c/WKURL.h
@@ -35,6 +35,7 @@ extern "C" {
WK_EXPORT WKTypeID WKURLGetTypeID();
WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string);
+WK_EXPORT WKURLRef WKURLCreateWithBaseURL(WKURLRef baseURL, const char* relative);
WK_EXPORT WKStringRef WKURLCopyString(WKURLRef url);
WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url);
diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp
index 2d25f282a..875ad3df5 100644
--- a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp
+++ b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp
@@ -51,3 +51,13 @@ int32_t WKURLResponseHTTPStatusCode(WKURLResponseRef responseRef)
{
return toImpl(responseRef)->resourceResponse().httpStatusCode();
}
+
+WKStringRef WKURLResponseCopySuggestedFilename(WKURLResponseRef responseRef)
+{
+ return toCopiedAPI(toImpl(responseRef)->resourceResponse().suggestedFilename());
+}
+
+bool WKURLResponseIsAttachment(WKURLResponseRef responseRef)
+{
+ return toImpl(responseRef)->resourceResponse().isAttachment();
+}
diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.h b/Source/WebKit2/Shared/API/c/WKURLResponse.h
index d4c269340..08f91d4f3 100644
--- a/Source/WebKit2/Shared/API/c/WKURLResponse.h
+++ b/Source/WebKit2/Shared/API/c/WKURLResponse.h
@@ -40,6 +40,10 @@ WK_EXPORT WKStringRef WKURLResponseCopyMIMEType(WKURLResponseRef);
WK_EXPORT int32_t WKURLResponseHTTPStatusCode(WKURLResponseRef);
+WK_EXPORT WKStringRef WKURLResponseCopySuggestedFilename(WKURLResponseRef);
+
+WK_EXPORT bool WKURLResponseIsAttachment(WKURLResponseRef);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp
index e1d4ee7bb..4e40bdf4e 100644
--- a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp
+++ b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp
@@ -38,6 +38,9 @@ using namespace WebKit;
WKURLRef WKURLCreateWithCFURL(CFURLRef cfURL)
{
+ if (!cfURL)
+ return 0;
+
String urlString(CFURLGetString(cfURL));
return toCopiedURLAPI(urlString);
}