diff options
Diffstat (limited to 'Source/WebKit2/Shared')
140 files changed, 1730 insertions, 119 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKArray.cpp b/Source/WebKit2/Shared/API/c/WKArray.cpp index 9e20b7e..3cc98b8 100644 --- a/Source/WebKit2/Shared/API/c/WKArray.cpp +++ b/Source/WebKit2/Shared/API/c/WKArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKArray.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index f906f9f..1db647a 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +33,10 @@ #include <WebKit2/WKBaseWin.h> #endif +#if defined(BUILDING_GTK__) +#include <WebKit2/WKBaseGtk.h> +#endif + /* WebKit2 shared types */ typedef uint32_t WKTypeID; @@ -49,6 +54,7 @@ typedef const struct OpaqueWKContextMenuItem* WKContextMenuItemRef; typedef const struct OpaqueWKData* WKDataRef; typedef const struct OpaqueWKDouble* WKDoubleRef; typedef const struct OpaqueWKError* WKErrorRef; +typedef const struct OpaqueWKGraphicsContext* WKGraphicsContextRef; typedef const struct OpaqueWKImage* WKImageRef; typedef const struct OpaqueWKSecurityOrigin* WKSecurityOriginRef; typedef const struct OpaqueWKSerializedScriptValue* WKSerializedScriptValueRef; @@ -92,6 +98,8 @@ typedef const struct OpaqueWKBundleBackForwardListItem* WKBundleBackForwardListI typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef; typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef; typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef; +typedef const struct OpaqueWKBundleInspector* WKBundleInspectorRef; +typedef const struct OpaqueWKBundleNavigationAction* WKBundleNavigationActionRef; typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef; typedef const struct OpaqueWKBundlePage* WKBundlePageRef; typedef const struct OpaqueWKBundlePageGroup* WKBundlePageGroupRef; @@ -99,8 +107,6 @@ typedef const struct OpaqueWKBundlePageOverlay* WKBundlePageOverlayRef; typedef const struct OpaqueWKBundleRangeHandle* WKBundleRangeHandleRef; typedef const struct OpaqueWKBundleScriptWorld* WKBundleScriptWorldRef; -/* These rules should stay the same as in JavaScriptCore/API/JSBase.h */ - #undef WK_EXPORT #if defined(WK_NO_EXPORT) #define WK_EXPORT diff --git a/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp b/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp index c5a3ad9..45ec627 100644 --- a/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp +++ b/Source/WebKit2/Shared/API/c/WKCertificateInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKCertificateInfo.h" #include "WebCertificateInfo.h" diff --git a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp index a4eaa53..c04aab1 100644 --- a/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp +++ b/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKContextMenuItem.h" #include "MutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKData.cpp b/Source/WebKit2/Shared/API/c/WKData.cpp index aefe795..b8253aa 100644 --- a/Source/WebKit2/Shared/API/c/WKData.cpp +++ b/Source/WebKit2/Shared/API/c/WKData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKData.h" #include "WebData.h" diff --git a/Source/WebKit2/Shared/API/c/WKDictionary.cpp b/Source/WebKit2/Shared/API/c/WKDictionary.cpp index 6b336bf..dc423de 100644 --- a/Source/WebKit2/Shared/API/c/WKDictionary.cpp +++ b/Source/WebKit2/Shared/API/c/WKDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKDictionary.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKError.cpp b/Source/WebKit2/Shared/API/c/WKError.cpp index 395cf3a..148bd62 100644 --- a/Source/WebKit2/Shared/API/c/WKError.cpp +++ b/Source/WebKit2/Shared/API/c/WKError.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKError.h" #include "WebError.h" diff --git a/Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp b/Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp new file mode 100644 index 0000000..5d80dfa --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKGraphicsContext.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKGraphicsContext.h" + +#include "WKSharedAPICast.h" +#include "WebGraphicsContext.h" + +using namespace WebKit; + +WKTypeID WKGraphicsContextGetTypeID() +{ + return toAPI(WebGraphicsContext::APIType); +} diff --git a/Source/WebKit2/Shared/API/c/WKGraphicsContext.h b/Source/WebKit2/Shared/API/c/WKGraphicsContext.h new file mode 100644 index 0000000..c9d0a52 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKGraphicsContext.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGraphicsContext_h +#define WKGraphicsContext_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGraphicsContextGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGraphicsContext_h */ diff --git a/Source/WebKit2/Shared/API/c/WKImage.cpp b/Source/WebKit2/Shared/API/c/WKImage.cpp index 0bf21df..23278b3 100644 --- a/Source/WebKit2/Shared/API/c/WKImage.cpp +++ b/Source/WebKit2/Shared/API/c/WKImage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKImage.h" #include "WKSharedAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKMutableArray.cpp b/Source/WebKit2/Shared/API/c/WKMutableArray.cpp index 56bd72f..1ae65c1 100644 --- a/Source/WebKit2/Shared/API/c/WKMutableArray.cpp +++ b/Source/WebKit2/Shared/API/c/WKMutableArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKMutableArray.h" #include "MutableArray.h" diff --git a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp index df9f5a7..0d96ca1 100644 --- a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp +++ b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKMutableDictionary.h" #include "MutableDictionary.h" diff --git a/Source/WebKit2/Shared/API/c/WKNumber.cpp b/Source/WebKit2/Shared/API/c/WKNumber.cpp index 4a413e1..f2cf0f8 100644 --- a/Source/WebKit2/Shared/API/c/WKNumber.cpp +++ b/Source/WebKit2/Shared/API/c/WKNumber.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKNumber.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp index 761cbf8..ef51335 100644 --- a/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp +++ b/Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKSecurityOrigin.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp index 4c642f0..f45c388 100644 --- a/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp +++ b/Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKSerializedScriptValue.h" #include "WKSerializedScriptValuePrivate.h" diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h index 6dc80e8..ac3b420 100644 --- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h +++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h @@ -41,6 +41,8 @@ #include "WebNumber.h" #include "WebString.h" #include "WebURL.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" #include <WebCore/ContextMenuItem.h> #include <WebCore/FloatRect.h> #include <WebCore/FrameLoaderTypes.h> @@ -56,6 +58,7 @@ class MutableDictionary; class WebCertificateInfo; class WebContextMenuItem; class WebData; +class WebGraphicsContext; class WebImage; class WebSecurityOrigin; class WebSerializedScriptValue; @@ -78,6 +81,7 @@ WK_ADD_API_MAPPING(WKDataRef, WebData) WK_ADD_API_MAPPING(WKDictionaryRef, ImmutableDictionary) WK_ADD_API_MAPPING(WKDoubleRef, WebDouble) WK_ADD_API_MAPPING(WKErrorRef, WebError) +WK_ADD_API_MAPPING(WKGraphicsContextRef, WebGraphicsContext) WK_ADD_API_MAPPING(WKImageRef, WebImage) WK_ADD_API_MAPPING(WKMutableArrayRef, MutableArray) WK_ADD_API_MAPPING(WKMutableDictionaryRef, MutableDictionary) @@ -172,6 +176,16 @@ inline ProxyingRefPtr<WebError> toAPI(const WebCore::ResourceError& error) return ProxyingRefPtr<WebError>(WebError::create(error)); } +inline ProxyingRefPtr<WebURLRequest> toAPI(const WebCore::ResourceRequest& request) +{ + return ProxyingRefPtr<WebURLRequest>(WebURLRequest::create(request)); +} + +inline ProxyingRefPtr<WebURLResponse> toAPI(const WebCore::ResourceResponse& response) +{ + return ProxyingRefPtr<WebURLResponse>(WebURLResponse::create(response)); +} + /* Geometry conversions */ inline WebCore::FloatRect toFloatRect(const WKRect& wkRect) diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp index 14f40fa..72841a4 100644 --- a/Source/WebKit2/Shared/API/c/WKString.cpp +++ b/Source/WebKit2/Shared/API/c/WKString.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKString.h" #include "WKStringPrivate.h" diff --git a/Source/WebKit2/Shared/API/c/WKType.cpp b/Source/WebKit2/Shared/API/c/WKType.cpp index a499737..f0e4ea8 100644 --- a/Source/WebKit2/Shared/API/c/WKType.cpp +++ b/Source/WebKit2/Shared/API/c/WKType.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKType.h" #include "APIObject.h" diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp index 0060b34..6b7e567 100644 --- a/Source/WebKit2/Shared/API/c/WKURL.cpp +++ b/Source/WebKit2/Shared/API/c/WKURL.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURL.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp index 6ea66ec..433db05 100644 --- a/Source/WebKit2/Shared/API/c/WKURLRequest.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLRequest.h" #include "WKAPICast.h" @@ -41,3 +42,8 @@ WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef url) { return toAPI(WebURLRequest::create(KURL(KURL(), toImpl(url)->string())).leakRef()); } + +WKURLRef WKURLRequestCopyURL(WKURLRequestRef requestRef) +{ + return toCopiedURLAPI(toImpl(requestRef)->url()); +} diff --git a/Source/WebKit2/Shared/API/c/WKURLRequest.h b/Source/WebKit2/Shared/API/c/WKURLRequest.h index d78968d..7d146f2 100644 --- a/Source/WebKit2/Shared/API/c/WKURLRequest.h +++ b/Source/WebKit2/Shared/API/c/WKURLRequest.h @@ -36,6 +36,8 @@ WK_EXPORT WKTypeID WKURLRequestGetTypeID(); WK_EXPORT WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef); +WK_EXPORT WKURLRef WKURLRequestCopyURL(WKURLRequestRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp index 12537bd..7d8d68b 100644 --- a/Source/WebKit2/Shared/API/c/WKURLResponse.cpp +++ b/Source/WebKit2/Shared/API/c/WKURLResponse.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLResponse.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp index 3eb24c4..f09610f 100644 --- a/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp +++ b/Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKUserContentURLPattern.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp index b89110e..9a49e5a 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKStringCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKStringCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp index a4627ce..e1d4ee7 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp index 98c801a..7422fd2 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLRequestCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLRequestCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp index 36d3f00..42473c8 100644 --- a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp +++ b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKURLResponseCF.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp new file mode 100644 index 0000000..aa7a77e --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "config.h" +#include "WKGraphicsContextCG.h" + +#include "WKSharedAPICast.h" +#include "WebGraphicsContext.h" + +using namespace WebKit; + +CGContextRef WKGraphicsContextGetCGContext(WKGraphicsContextRef graphicsContextRef) +{ + return toImpl(graphicsContextRef)->platformContext(); +} diff --git a/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h new file mode 100644 index 0000000..06e9df0 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/cg/WKGraphicsContextCG.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGraphicsContextCG_h +#define WKGraphicsContextCG_h + +#include <CoreGraphics/CGContext.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT CGContextRef WKGraphicsContextGetCGContext(WKGraphicsContextRef graphicsContext); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGraphicsContextCG_h */ diff --git a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp index 34a8bf1..61b5f17 100644 --- a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp +++ b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKImageCG.h" #include "ShareableBitmap.h" diff --git a/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h b/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h new file mode 100644 index 0000000..8f34ed3 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/gtk/WKBaseGtk.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKBaseGtk_h +#define WKBaseGtk_h + +#ifndef WKBase_h +#error "Please #include \"WKBase.h\" instead of this file directly." +#endif + +typedef const struct OpaqueWKView* WKViewRef; + +#endif /* WKBaseGtk_h */ diff --git a/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp new file mode 100644 index 0000000..69695f1 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 Igalia SL All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "config.h" +#include "WKGraphicsContextGtk.h" + +#include "WKSharedAPICast.h" +#include "WebGraphicsContext.h" + +using namespace WebKit; + +cairo_t* WKGraphicsContextGetGtkContext(WKGraphicsContextRef graphicsContextRef) +{ + return toImpl(graphicsContextRef)->platformContext(); +} diff --git a/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h new file mode 100644 index 0000000..25fcfc4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/gtk/WKGraphicsContextGtk.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Igalia SL All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKGraphicsContextGtk_h +#define WKGraphicsContextGtk_h + +#include <WebKit2/WKBase.h> + +#include <cairo.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT cairo_t* WKGraphicsContextGetGtkContext(WKGraphicsContextRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGraphicsContextGtk_h */ diff --git a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm index 2ffc1f5..a2f348d 100644 --- a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm +++ b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKCertificateInfoMac.h" +#import "config.h" +#import "WKCertificateInfoMac.h" -#include "WKAPICast.h" -#include "WebCertificateInfo.h" +#import "WKAPICast.h" +#import "WebCertificateInfo.h" using namespace WebKit; diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm index 7cc69fa..081bbd7 100644 --- a/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm +++ b/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKURLRequestNS.h" +#import "config.h" +#import "WKURLRequestNS.h" -#include "WKAPICast.h" -#include "WebURLRequest.h" +#import "WKAPICast.h" +#import "WebURLRequest.h" using namespace WebKit; diff --git a/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm index 79b874d..f19883e 100644 --- a/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm +++ b/Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WKURLResponseNS.h" +#import "config.h" +#import "WKURLResponseNS.h" -#include "WKAPICast.h" -#include "WebURLResponse.h" +#import "WKAPICast.h" +#import "WebURLResponse.h" using namespace WebKit; diff --git a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp index f4c7bb2..ada20ef 100644 --- a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp +++ b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKCertificateInfoWin.h" #include "WKAPICast.h" diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h index 70ed0ba..10149b0 100644 --- a/Source/WebKit2/Shared/APIObject.h +++ b/Source/WebKit2/Shared/APIObject.h @@ -44,6 +44,7 @@ public: TypeData, TypeDictionary, TypeError, + TypeGraphicsContext, TypeImage, TypeProtectionSpace, TypeSecurityOrigin, @@ -85,6 +86,8 @@ public: TypeBundleBackForwardListItem, TypeBundleFrame, TypeBundleHitTestResult, + TypeBundleInspector, + TypeBundleNavigationAction, TypeBundleNodeHandle, TypeBundlePage, TypeBundlePageGroup, diff --git a/Source/WebKit2/Shared/ChildProcess.cpp b/Source/WebKit2/Shared/ChildProcess.cpp index 06217fd..d45f4f2 100644 --- a/Source/WebKit2/Shared/ChildProcess.cpp +++ b/Source/WebKit2/Shared/ChildProcess.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ChildProcess.h" #if !OS(WINDOWS) @@ -47,13 +48,13 @@ NO_RETURN static void watchdogCallback() _exit(EXIT_FAILURE); } -void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue* workQueue, CoreIPC::Connection*) +void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue& workQueue, CoreIPC::Connection*) { // If the connection has been closed and we haven't responded in the main thread for 10 seconds // the process will exit forcibly. static const double watchdogDelay = 10.0; - workQueue->scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay); + workQueue.scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/ChildProcess.h b/Source/WebKit2/Shared/ChildProcess.h index 8c5e8e3..7286d52 100644 --- a/Source/WebKit2/Shared/ChildProcess.h +++ b/Source/WebKit2/Shared/ChildProcess.h @@ -36,8 +36,7 @@ protected: ChildProcess(); ~ChildProcess(); -private: - void didCloseOnConnectionWorkQueue(WorkQueue*, CoreIPC::Connection*); + static void didCloseOnConnectionWorkQueue(WorkQueue&, CoreIPC::Connection*); }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/ImmutableArray.cpp b/Source/WebKit2/Shared/ImmutableArray.cpp index 2be62fd..67b2a34 100644 --- a/Source/WebKit2/Shared/ImmutableArray.cpp +++ b/Source/WebKit2/Shared/ImmutableArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ImmutableArray.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/ImmutableDictionary.cpp b/Source/WebKit2/Shared/ImmutableDictionary.cpp index 488da2d..1af988e 100644 --- a/Source/WebKit2/Shared/ImmutableDictionary.cpp +++ b/Source/WebKit2/Shared/ImmutableDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ImmutableDictionary.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/LayerTreeContext.h b/Source/WebKit2/Shared/LayerTreeContext.h new file mode 100644 index 0000000..e2938aa --- /dev/null +++ b/Source/WebKit2/Shared/LayerTreeContext.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LayerTreeContext_h +#define LayerTreeContext_h + +#if USE(ACCELERATED_COMPOSITING) + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class LayerTreeContext { +public: + LayerTreeContext(); + ~LayerTreeContext(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, LayerTreeContext&); + + bool isEmpty() const; + +#if PLATFORM(MAC) + uint32_t contextID; +#endif +}; + +bool operator==(const LayerTreeContext&, const LayerTreeContext&); + +inline bool operator!=(const LayerTreeContext& a, const LayerTreeContext& b) +{ + return !(a == b); +} + +}; + +#endif // USE(ACCELERATED_COMPOSITING) + +#endif // LayerTreeContext_h diff --git a/Source/WebKit2/Shared/MutableArray.cpp b/Source/WebKit2/Shared/MutableArray.cpp index 00f718e..0f3138f 100644 --- a/Source/WebKit2/Shared/MutableArray.cpp +++ b/Source/WebKit2/Shared/MutableArray.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "MutableArray.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/MutableDictionary.cpp b/Source/WebKit2/Shared/MutableDictionary.cpp index c151dd6..222caf3 100644 --- a/Source/WebKit2/Shared/MutableDictionary.cpp +++ b/Source/WebKit2/Shared/MutableDictionary.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "MutableDictionary.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h index 9c4e480..cdf1aef 100644 --- a/Source/WebKit2/Shared/NativeWebKeyboardEvent.h +++ b/Source/WebKit2/Shared/NativeWebKeyboardEvent.h @@ -30,11 +30,7 @@ #if PLATFORM(MAC) #include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSView; -#else -class NSView; -#endif +OBJC_CLASS NSView; #elif PLATFORM(QT) #include <QKeyEvent> #endif diff --git a/Source/WebKit2/Shared/OriginAndDatabases.cpp b/Source/WebKit2/Shared/OriginAndDatabases.cpp index 4db7bf0..7286e5e 100644 --- a/Source/WebKit2/Shared/OriginAndDatabases.cpp +++ b/Source/WebKit2/Shared/OriginAndDatabases.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "OriginAndDatabases.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp index 6d90ce5..51e0e6c 100644 --- a/Source/WebKit2/Shared/PlatformPopupMenuData.cpp +++ b/Source/WebKit2/Shared/PlatformPopupMenuData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PlatformPopupMenuData.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp index 51dd6be..eeb8914 100644 --- a/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPIdentifierData.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp index 013d849..2fd7244 100644 --- a/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp +++ b/Source/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPObjectMessageReceiver.h" +#if ENABLE(PLUGIN_PROCESS) + #include "NPIdentifierData.h" #include "NPRemoteObjectMap.h" #include "NPRuntimeUtilities.h" diff --git a/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp b/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp index e7fc47f..04a6e7d 100644 --- a/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp +++ b/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPObjectProxy.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentCoders.h" #include "Connection.h" #include "NPIdentifierData.h" diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp index 5fea618..bcf2a7c 100644 --- a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp +++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPRemoteObjectMap.h" +#if ENABLE(PLUGIN_PROCESS) + #include "NPObjectMessageReceiver.h" #include "NPObjectProxy.h" #include "NPRuntimeUtilities.h" diff --git a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp index b100589..5e4392b 100644 --- a/Source/WebKit2/Shared/Plugins/NPVariantData.cpp +++ b/Source/WebKit2/Shared/Plugins/NPVariantData.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "NPVariantData.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp index fec00b3..a1f0833 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginModule.h" #include "Module.h" diff --git a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm index 6ecacf0..544def3 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm +++ b/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "NetscapePluginModule.h" +#import "config.h" +#import "NetscapePluginModule.h" -#include <WebCore/WebCoreNSStringExtras.h> -#include <wtf/HashSet.h> +#import <WebCore/WebCoreNSStringExtras.h> +#import <wtf/HashSet.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp b/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp index f969ba4..d6287e3 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginModule.h" #include <WebCore/FileSystem.h> @@ -59,7 +60,7 @@ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoSto if (!versionInfoSize) return false; - OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]); + OwnArrayPtr<char> versionInfoData = adoptArrayPtr(new char[versionInfoSize]); if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get())) return false; diff --git a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp index a02cdad..a651d3b 100644 --- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp +++ b/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NetscapePluginModule.h" #include "PluginDatabase.h" diff --git a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp index c95a825..06014a9 100644 --- a/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(PLUGIN_PROCESS) - +#include "config.h" #include "PluginProcessCreationParameters.h" +#if ENABLE(PLUGIN_PROCESS) + #include "ArgumentCoders.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/PrintInfo.cpp b/Source/WebKit2/Shared/PrintInfo.cpp index 2a9c5e0..23d3ef9 100644 --- a/Source/WebKit2/Shared/PrintInfo.cpp +++ b/Source/WebKit2/Shared/PrintInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PrintInfo.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/PrintInfo.h b/Source/WebKit2/Shared/PrintInfo.h index d6ccd4a..502be93 100644 --- a/Source/WebKit2/Shared/PrintInfo.h +++ b/Source/WebKit2/Shared/PrintInfo.h @@ -28,9 +28,10 @@ #include <wtf/Platform.h> -#ifdef __OBJC__ -@class NSPrintInfo; +#if PLATFORM(MAC) +OBJC_CLASS NSPrintInfo; #else +// FIXME: This should use the windows equivalent. class NSPrintInfo; #endif diff --git a/Source/WebKit2/Shared/SessionState.cpp b/Source/WebKit2/Shared/SessionState.cpp index 109805f..b25289a 100644 --- a/Source/WebKit2/Shared/SessionState.cpp +++ b/Source/WebKit2/Shared/SessionState.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "SessionState.h" namespace CoreIPC { diff --git a/Source/WebKit2/Shared/ShareableBitmap.cpp b/Source/WebKit2/Shared/ShareableBitmap.cpp index 90fa0d8..e89cdb7 100644 --- a/Source/WebKit2/Shared/ShareableBitmap.cpp +++ b/Source/WebKit2/Shared/ShareableBitmap.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include "SharedMemory.h" diff --git a/Source/WebKit2/Shared/UpdateInfo.cpp b/Source/WebKit2/Shared/UpdateInfo.cpp index 182f75b..4afd693 100644 --- a/Source/WebKit2/Shared/UpdateInfo.cpp +++ b/Source/WebKit2/Shared/UpdateInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateInfo.h" #include "WebCoreArgumentCoders.h" @@ -31,7 +32,6 @@ namespace WebKit { void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(timestamp); encoder->encode(viewSize); encoder->encode(scrollRect); encoder->encode(scrollOffset); @@ -42,8 +42,6 @@ void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result) { - if (!decoder->decode(result.timestamp)) - return false; if (!decoder->decode(result.viewSize)) return false; if (!decoder->decode(result.scrollRect)) diff --git a/Source/WebKit2/Shared/UpdateInfo.h b/Source/WebKit2/Shared/UpdateInfo.h index 2ceb164..7b5454e 100644 --- a/Source/WebKit2/Shared/UpdateInfo.h +++ b/Source/WebKit2/Shared/UpdateInfo.h @@ -41,14 +41,11 @@ class UpdateInfo { WTF_MAKE_NONCOPYABLE(UpdateInfo); public: - UpdateInfo() : timestamp(0) { } + UpdateInfo() { } void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, UpdateInfo&); - // The timestamp of this update. - double timestamp; - // The size of the web view. WebCore::IntSize viewSize; diff --git a/Source/WebKit2/Shared/VisitedLinkTable.cpp b/Source/WebKit2/Shared/VisitedLinkTable.cpp index 746ec3e..09b7cc8 100644 --- a/Source/WebKit2/Shared/VisitedLinkTable.cpp +++ b/Source/WebKit2/Shared/VisitedLinkTable.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "VisitedLinkTable.h" #include "SharedMemory.h" diff --git a/Source/WebKit2/Shared/WebBackForwardListItem.cpp b/Source/WebKit2/Shared/WebBackForwardListItem.cpp index 07061e9..5f3ef94 100644 --- a/Source/WebKit2/Shared/WebBackForwardListItem.cpp +++ b/Source/WebKit2/Shared/WebBackForwardListItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebBackForwardListItem.h" #include "DataReference.h" diff --git a/Source/WebKit2/Shared/WebContextMenuItem.cpp b/Source/WebKit2/Shared/WebContextMenuItem.cpp index 55fa70a..a3322bb 100644 --- a/Source/WebKit2/Shared/WebContextMenuItem.cpp +++ b/Source/WebKit2/Shared/WebContextMenuItem.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuItem.h" #include "ImmutableArray.h" diff --git a/Source/WebKit2/Shared/WebContextMenuItemData.cpp b/Source/WebKit2/Shared/WebContextMenuItemData.cpp index aec8fa0..e872047 100644 --- a/Source/WebKit2/Shared/WebContextMenuItemData.cpp +++ b/Source/WebKit2/Shared/WebContextMenuItemData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebContextMenuItemData.h" #include "APIObject.h" diff --git a/Source/WebKit2/Shared/WebError.cpp b/Source/WebKit2/Shared/WebError.cpp index a401d71..88204dd 100644 --- a/Source/WebKit2/Shared/WebError.cpp +++ b/Source/WebKit2/Shared/WebError.cpp @@ -23,7 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ - +#include "config.h" #include "WebError.h" #include <wtf/text/WTFString.h> diff --git a/Source/WebKit2/Shared/WebEvent.cpp b/Source/WebKit2/Shared/WebEvent.cpp index 429622c..f6738fa 100644 --- a/Source/WebKit2/Shared/WebEvent.cpp +++ b/Source/WebKit2/Shared/WebEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h index f048d6e..361aa46 100644 --- a/Source/WebKit2/Shared/WebEvent.h +++ b/Source/WebKit2/Shared/WebEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,13 +55,20 @@ public: KeyDown, KeyUp, RawKeyDown, - Char + Char, + +#if ENABLE(GESTURE_EVENTS) + // WebGestureEvent + GestureScrollBegin, + GestureScrollEnd, +#endif + #if ENABLE(TOUCH_EVENTS) - , + // WebTouchEvent TouchStart, TouchMove, TouchEnd, - TouchCancel + TouchCancel, #endif }; @@ -166,7 +173,7 @@ public: WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Modifiers, double timestamp); #if PLATFORM(MAC) - WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase, Modifiers, double timestamp); + WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase, bool hasPreciseScrollingDeltas, Modifiers, double timestamp); #endif const WebCore::IntPoint position() const { return m_position; } @@ -176,6 +183,7 @@ public: Granularity granularity() const { return static_cast<Granularity>(m_granularity); } #if PLATFORM(MAC) Phase phase() const { return static_cast<Phase>(m_phase); } + bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; } #endif void encode(CoreIPC::ArgumentEncoder*) const; @@ -191,6 +199,7 @@ private: uint32_t m_granularity; // Granularity #if PLATFORM(MAC) uint32_t m_phase; // Phase + bool m_hasPreciseScrollingDeltas; #endif }; @@ -228,8 +237,30 @@ private: bool m_isSystemKey; }; -#if ENABLE(TOUCH_EVENTS) +#if ENABLE(GESTURE_EVENTS) +// FIXME: Move this class to its own header file. +class WebGestureEvent : public WebEvent { +public: + WebGestureEvent() { } + WebGestureEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, Modifiers, double timestamp); + + const WebCore::IntPoint position() const { return m_position; } + const WebCore::IntPoint globalPosition() const { return m_globalPosition; } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, WebGestureEvent&); + +private: + static bool isGestureEventType(Type); + + WebCore::IntPoint m_position; + WebCore::IntPoint m_globalPosition; +}; +#endif // ENABLE(GESTURE_EVENTS) + + +#if ENABLE(TOUCH_EVENTS) // FIXME: Move this class to its own header file. // FIXME: Having "Platform" in the name makes it sound like this event is platform-specific or low- // level in some way. That doesn't seem to be the case. diff --git a/Source/WebKit2/Shared/WebEventConversion.cpp b/Source/WebKit2/Shared/WebEventConversion.cpp index 14c51b7..62147d0 100644 --- a/Source/WebKit2/Shared/WebEventConversion.cpp +++ b/Source/WebKit2/Shared/WebEventConversion.cpp @@ -23,10 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEventConversion.h" #include "WebEvent.h" -#include <WebCore/IntPoint.h> namespace WebKit { @@ -112,6 +112,8 @@ public: m_metaKey = webEvent.metaKey(); #if PLATFORM(MAC) m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase()); + m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas(); + m_timestamp = webEvent.timestamp(); #endif } }; @@ -166,6 +168,34 @@ WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent& webEvent) return WebKit2PlatformKeyboardEvent(webEvent); } +#if ENABLE(GESTURE_EVENTS) +class WebKit2PlatformGestureEvent : public WebCore::PlatformGestureEvent { +public: + WebKit2PlatformGestureEvent(const WebGestureEvent& webEvent) + { + switch (webEvent.type()) { + case WebEvent::GestureScrollBegin: + m_type = PlatformGestureEvent::ScrollBeginType; + break; + case WebEvent::GestureScrollEnd: + m_type = PlatformGestureEvent::ScrollEndType; + break; + default: + ASSERT_NOT_REACHED(); + } + + m_position = webEvent.position(); + m_globalPosition = webEvent.globalPosition(); + m_timestamp = webEvent.timestamp(); + } +}; + +WebCore::PlatformGestureEvent platform(const WebGestureEvent& webEvent) +{ + return WebKit2PlatformGestureEvent(webEvent); +} +#endif + #if ENABLE(TOUCH_EVENTS) class WebKit2PlatformTouchPoint : public WebCore::PlatformTouchPoint { public: diff --git a/Source/WebKit2/Shared/WebEventConversion.h b/Source/WebKit2/Shared/WebEventConversion.h index 8fa0813..1fe87bc 100644 --- a/Source/WebKit2/Shared/WebEventConversion.h +++ b/Source/WebKit2/Shared/WebEventConversion.h @@ -29,6 +29,11 @@ #include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/PlatformMouseEvent.h> #include <WebCore/PlatformWheelEvent.h> + +#if ENABLE(GESTURE_EVENTS) +#include <WebCore/PlatformGestureEvent.h> +#endif + #if ENABLE(TOUCH_EVENTS) #include <WebCore/PlatformTouchEvent.h> #include <WebCore/PlatformTouchPoint.h> @@ -39,17 +44,29 @@ namespace WebKit { class WebMouseEvent; class WebWheelEvent; class WebKeyboardEvent; + +#if ENABLE(GESTURE_EVENTS) +class WebGestureEvent; +#endif + #if ENABLE(TOUCH_EVENTS) class WebTouchEvent; class WebTouchPoint; #endif + WebCore::PlatformMouseEvent platform(const WebMouseEvent&); WebCore::PlatformWheelEvent platform(const WebWheelEvent&); WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent&); + +#if ENABLE(GESTURE_EVENTS) +WebCore::PlatformGestureEvent platform(const WebGestureEvent&); +#endif + #if ENABLE(TOUCH_EVENTS) WebCore::PlatformTouchEvent platform(const WebTouchEvent&); WebCore::PlatformTouchPoint platform(const WebTouchPoint&); #endif + } // namespace WebKit #endif // WebEventConversion_h diff --git a/Source/WebKit2/Shared/WebGeolocationPosition.cpp b/Source/WebKit2/Shared/WebGeolocationPosition.cpp index 9cda350..01fdfb8 100644 --- a/Source/WebKit2/Shared/WebGeolocationPosition.cpp +++ b/Source/WebKit2/Shared/WebGeolocationPosition.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebGeolocationPosition.h" #include "ArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebGestureEvent.cpp b/Source/WebKit2/Shared/WebGestureEvent.cpp new file mode 100644 index 0000000..bbf8f83 --- /dev/null +++ b/Source/WebKit2/Shared/WebGestureEvent.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebEvent.h" + +#if ENABLE(GESTURE_EVENTS) + +#include "Arguments.h" +#include "WebCoreArgumentCoders.h" + +using namespace WebCore; + +namespace WebKit { + +WebGestureEvent::WebGestureEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, Modifiers modifiers, double timestamp) + : WebEvent(type, modifiers, timestamp) + , m_position(position) + , m_globalPosition(globalPosition) +{ + ASSERT(isGestureEventType(type)); +} + +void WebGestureEvent::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + WebEvent::encode(encoder); + + encoder->encode(m_position); + encoder->encode(m_globalPosition); +} + +bool WebGestureEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebGestureEvent& t) +{ + if (!WebEvent::decode(decoder, t)) + return false; + if (!decoder->decode(t.m_position)) + return false; + if (!decoder->decode(t.m_globalPosition)) + return false; + return true; +} + +bool WebGestureEvent::isGestureEventType(Type type) +{ + return type == GestureScrollBegin || type == GestureScrollEnd; +} + +} // namespace WebKit + +#endif // ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit2/Shared/WebGraphicsContext.cpp b/Source/WebKit2/Shared/WebGraphicsContext.cpp new file mode 100644 index 0000000..3d319e4 --- /dev/null +++ b/Source/WebKit2/Shared/WebGraphicsContext.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebGraphicsContext.h" + +using namespace WebCore; + +namespace WebKit { + +WebGraphicsContext::WebGraphicsContext(GraphicsContext* graphicsContext) +#if PLATFORM(CG) + : m_platformContext(graphicsContext->platformContext()) +#elif PLATFORM(GTK) + : m_platformContext(graphicsContext->platformContext()) +#endif +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebGraphicsContext.h b/Source/WebKit2/Shared/WebGraphicsContext.h new file mode 100644 index 0000000..ddb2e34 --- /dev/null +++ b/Source/WebKit2/Shared/WebGraphicsContext.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGraphicsContext_h +#define WebGraphicsContext_h + +#include "APIObject.h" +#include <WebCore/GraphicsContext.h> +#include <wtf/PassRefPtr.h> + +#if PLATFORM(CG) +#include <wtf/RetainPtr.h> +#elif PLATFORM(GTK) +#include "RefPtrCairo.h" +#endif + +namespace WebKit { + +class WebGraphicsContext : public APIObject { +public: + static const Type APIType = TypeGraphicsContext; + + static PassRefPtr<WebGraphicsContext> create(WebCore::GraphicsContext* graphicsContext) + { + return adoptRef(new WebGraphicsContext(graphicsContext)); + } + +#if PLATFORM(CG) + CGContextRef platformContext() { return m_platformContext.get(); } +#elif PLATFORM(GTK) + cairo_t* platformContext() { return m_platformContext.get(); } +#endif + + +private: + explicit WebGraphicsContext(WebCore::GraphicsContext*); + + virtual Type type() const { return APIType; } + +#if PLATFORM(CG) + RetainPtr<CGContextRef> m_platformContext; +#elif PLATFORM(GTK) + RefPtr<cairo_t> m_platformContext; +#endif +}; + +} // namespace WebKit + +#endif // WebGraphicsContext_h diff --git a/Source/WebKit2/Shared/WebImage.cpp b/Source/WebKit2/Shared/WebImage.cpp index 1426690..e245268 100644 --- a/Source/WebKit2/Shared/WebImage.cpp +++ b/Source/WebKit2/Shared/WebImage.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebImage.h" #include "ShareableBitmap.h" diff --git a/Source/WebKit2/Shared/WebKeyboardEvent.cpp b/Source/WebKit2/Shared/WebKeyboardEvent.cpp index 08aaab8..7e65ef1 100644 --- a/Source/WebKit2/Shared/WebKeyboardEvent.cpp +++ b/Source/WebKit2/Shared/WebKeyboardEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebMemorySampler.cpp b/Source/WebKit2/Shared/WebMemorySampler.cpp index 7b5c487..82b2be9 100644 --- a/Source/WebKit2/Shared/WebMemorySampler.cpp +++ b/Source/WebKit2/Shared/WebMemorySampler.cpp @@ -23,10 +23,11 @@ * */ -#if ENABLE(MEMORY_SAMPLER) - +#include "config.h" #include "WebMemorySampler.h" +#if ENABLE(MEMORY_SAMPLER) + #include <wtf/text/CString.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/WebMouseEvent.cpp b/Source/WebKit2/Shared/WebMouseEvent.cpp index fe30290..16e5057 100644 --- a/Source/WebKit2/Shared/WebMouseEvent.cpp +++ b/Source/WebKit2/Shared/WebMouseEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "Arguments.h" diff --git a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp index 821477b..13b3d0b 100644 --- a/Source/WebKit2/Shared/WebOpenPanelParameters.cpp +++ b/Source/WebKit2/Shared/WebOpenPanelParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebOpenPanelParameters.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPageCreationParameters.cpp b/Source/WebKit2/Shared/WebPageCreationParameters.cpp index 5ab1212..45fa5a4 100644 --- a/Source/WebKit2/Shared/WebPageCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebPageCreationParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageCreationParameters.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPageGroupData.cpp b/Source/WebKit2/Shared/WebPageGroupData.cpp index f01f4a6..e8df62f 100644 --- a/Source/WebKit2/Shared/WebPageGroupData.cpp +++ b/Source/WebKit2/Shared/WebPageGroupData.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPageGroupData.h" #include "ArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp index 3954368..e23830f 100644 --- a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp +++ b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(TOUCH_EVENTS) - +#include "config.h" #include "WebEvent.h" +#if ENABLE(TOUCH_EVENTS) + #include "Arguments.h" #include "WebCoreArgumentCoders.h" diff --git a/Source/WebKit2/Shared/WebPopupItem.cpp b/Source/WebKit2/Shared/WebPopupItem.cpp index 3a5f178..a9ac032 100644 --- a/Source/WebKit2/Shared/WebPopupItem.cpp +++ b/Source/WebKit2/Shared/WebPopupItem.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,29 +23,39 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" + #include "WebPopupItem.h" #include "ArgumentCoders.h" #include "Arguments.h" +using namespace WebCore; + namespace WebKit { WebPopupItem::WebPopupItem() : m_type(Item) + , m_textDirection(LTR) + , m_hasTextDirectionOverride(false) , m_isEnabled(true) { } WebPopupItem::WebPopupItem(Type type) : m_type(type) + , m_textDirection(LTR) + , m_hasTextDirectionOverride(false) , m_isEnabled(true) , m_isLabel(false) { } -WebPopupItem::WebPopupItem(Type type, const String& text, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) +WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel) : m_type(type) , m_text(text) + , m_textDirection(textDirection) + , m_hasTextDirectionOverride(hasTextDirectionOverride) , m_toolTip(toolTip) , m_accessibilityText(accessibilityText) , m_isEnabled(isEnabled) @@ -55,21 +65,23 @@ WebPopupItem::WebPopupItem(Type type, const String& text, const String& toolTip, void WebPopupItem::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel)); + encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, static_cast<uint64_t>(m_textDirection), m_hasTextDirectionOverride, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel)); } bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item) { uint32_t type; String text; + uint64_t textDirection; + bool hasTextDirectionOverride; String toolTip; String accessibilityText; bool isEnabled; bool isLabel; - if (!decoder->decode(CoreIPC::Out(type, text, toolTip, accessibilityText, isEnabled, isLabel))) + if (!decoder->decode(CoreIPC::Out(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel))) return false; - item = WebPopupItem(static_cast<Type>(type), text, toolTip, accessibilityText, isEnabled, isLabel); + item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel); return true; } diff --git a/Source/WebKit2/Shared/WebPopupItem.h b/Source/WebKit2/Shared/WebPopupItem.h index c6874f8..85495a3 100644 --- a/Source/WebKit2/Shared/WebPopupItem.h +++ b/Source/WebKit2/Shared/WebPopupItem.h @@ -26,6 +26,7 @@ #ifndef WebPopupItem_h #define WebPopupItem_h +#include <WebCore/TextDirection.h> #include <wtf/text/WTFString.h> namespace CoreIPC { @@ -43,13 +44,15 @@ struct WebPopupItem { WebPopupItem(); WebPopupItem(Type); - WebPopupItem(Type, const String& text, const String& toolTip, const String& accessibilityText, bool isEnabled, bool m_isLabel); + WebPopupItem(Type, const String& text, WebCore::TextDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool m_isLabel); void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, WebPopupItem&); Type m_type; String m_text; + WebCore::TextDirection m_textDirection; + bool m_hasTextDirectionOverride; String m_toolTip; String m_accessibilityText; bool m_isEnabled; diff --git a/Source/WebKit2/Shared/WebPreferencesStore.cpp b/Source/WebKit2/Shared/WebPreferencesStore.cpp index 82b422b..c215782 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.cpp +++ b/Source/WebKit2/Shared/WebPreferencesStore.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebPreferencesStore.h" #include "FontSmoothingLevel.h" diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index e8cf244..c9624df 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -55,6 +55,7 @@ namespace WebKit { macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \ macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \ macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \ + macro(WebGLEnabled, webGLEnabled, Bool, bool, false) \ macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \ macro(TabsToLinks, tabsToLinks, Bool, bool, false) \ macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \ @@ -64,6 +65,7 @@ namespace WebKit { macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \ macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \ macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \ + macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false) \ macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, false) \ \ @@ -91,7 +93,7 @@ namespace WebKit { macro(SerifFontFamily, serifFontFamily, String, String, "Times New Roman") \ \ -#else +#elif PLATFORM(MAC) #define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ macro(StandardFontFamily, standardFontFamily, String, String, "Times") \ @@ -102,6 +104,17 @@ namespace WebKit { macro(SerifFontFamily, serifFontFamily, String, String, "Times") \ \ +#elif PLATFORM(QT) || PLATFORM(GTK) + +#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \ + macro(StandardFontFamily, standardFontFamily, String, String, "Times") \ + macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS") \ + macro(FantasyFontFamily, fantasyFontFamily, String, String, "Impact") \ + macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New") \ + macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \ + macro(SerifFontFamily, serifFontFamily, String, String, "Times") \ + \ + #endif #define FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \ diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp index 77e3a82..89b1009 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.cpp +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebProcessCreationParameters.h" #include "ArgumentCoders.h" @@ -46,6 +47,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con encoder->encode(injectedBundlePath); encoder->encode(injectedBundlePathExtensionHandle); encoder->encode(applicationCacheDirectory); + encoder->encode(databaseDirectory); encoder->encode(urlSchemesRegistererdAsEmptyDocument); encoder->encode(urlSchemesRegisteredAsSecure); encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden); @@ -76,6 +78,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web return false; if (!decoder->decode(parameters.applicationCacheDirectory)) return false; + if (!decoder->decode(parameters.databaseDirectory)) + return false; if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument)) return false; if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure)) diff --git a/Source/WebKit2/Shared/WebProcessCreationParameters.h b/Source/WebKit2/Shared/WebProcessCreationParameters.h index 50d8a90..b157c94 100644 --- a/Source/WebKit2/Shared/WebProcessCreationParameters.h +++ b/Source/WebKit2/Shared/WebProcessCreationParameters.h @@ -53,6 +53,7 @@ struct WebProcessCreationParameters { SandboxExtension::Handle injectedBundlePathExtensionHandle; String applicationCacheDirectory; + String databaseDirectory; Vector<String> urlSchemesRegistererdAsEmptyDocument; Vector<String> urlSchemesRegisteredAsSecure; Vector<String> urlSchemesForWhichDomainRelaxationIsForbidden; diff --git a/Source/WebKit2/Shared/WebSecurityOrigin.h b/Source/WebKit2/Shared/WebSecurityOrigin.h index be684ab..347f83e 100644 --- a/Source/WebKit2/Shared/WebSecurityOrigin.h +++ b/Source/WebKit2/Shared/WebSecurityOrigin.h @@ -52,7 +52,7 @@ public: return adoptRef(new WebSecurityOrigin(securityOrigin.release())); } - const String protocol() const { return m_securityOrigin->domain(); } + const String protocol() const { return m_securityOrigin->protocol(); } const String host() const { return m_securityOrigin->host(); } unsigned short port() const { return m_securityOrigin->port(); } diff --git a/Source/WebKit2/Shared/WebTouchEvent.cpp b/Source/WebKit2/Shared/WebTouchEvent.cpp index f42f48c..2ffca38 100644 --- a/Source/WebKit2/Shared/WebTouchEvent.cpp +++ b/Source/WebKit2/Shared/WebTouchEvent.cpp @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(TOUCH_EVENTS) - +#include "config.h" #include "WebEvent.h" +#if ENABLE(TOUCH_EVENTS) + #include "ArgumentCoders.h" #include "Arguments.h" diff --git a/Source/WebKit2/Shared/WebURLRequest.cpp b/Source/WebKit2/Shared/WebURLRequest.cpp index 1e255c2..586bbb4 100644 --- a/Source/WebKit2/Shared/WebURLRequest.cpp +++ b/Source/WebKit2/Shared/WebURLRequest.cpp @@ -7,6 +7,7 @@ * */ +#include "config.h" #include "WebURLRequest.h" using namespace WebCore; diff --git a/Source/WebKit2/Shared/WebURLRequest.h b/Source/WebKit2/Shared/WebURLRequest.h index 6cb5ba8..ab167b8 100644 --- a/Source/WebKit2/Shared/WebURLRequest.h +++ b/Source/WebKit2/Shared/WebURLRequest.h @@ -59,6 +59,8 @@ public: PlatformRequest platformRequest() const; const WebCore::ResourceRequest& resourceRequest() const { return m_request; } + const String& url() const { return m_request.url(); } + private: explicit WebURLRequest(const WebCore::ResourceRequest&); explicit WebURLRequest(PlatformRequest); diff --git a/Source/WebKit2/Shared/WebURLResponse.cpp b/Source/WebKit2/Shared/WebURLResponse.cpp index 8f8ec14..223b55b 100644 --- a/Source/WebKit2/Shared/WebURLResponse.cpp +++ b/Source/WebKit2/Shared/WebURLResponse.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/WebWheelEvent.cpp b/Source/WebKit2/Shared/WebWheelEvent.cpp index 570b8e0..26f2337 100644 --- a/Source/WebKit2/Shared/WebWheelEvent.cpp +++ b/Source/WebKit2/Shared/WebWheelEvent.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEvent.h" #include "Arguments.h" @@ -39,12 +40,16 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint , m_delta(delta) , m_wheelTicks(wheelTicks) , m_granularity(granularity) +#if PLATFORM(MAC) + , m_phase(PhaseNone) + , m_hasPreciseScrollingDeltas(false) +#endif { ASSERT(isWheelEventType(type)); } #if PLATFORM(MAC) -WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, Modifiers modifiers, double timestamp) +WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, bool hasPreciseScrollingDeltas, Modifiers modifiers, double timestamp) : WebEvent(type, modifiers, timestamp) , m_position(position) , m_globalPosition(globalPosition) @@ -52,6 +57,7 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint , m_wheelTicks(wheelTicks) , m_granularity(granularity) , m_phase(phase) + , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas) { ASSERT(isWheelEventType(type)); } @@ -68,6 +74,7 @@ void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const encoder->encode(m_granularity); #if PLATFORM(MAC) encoder->encode(m_phase); + encoder->encode(m_hasPreciseScrollingDeltas); #endif } @@ -88,6 +95,8 @@ bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t) #if PLATFORM(MAC) if (!decoder->decode(t.m_phase)) return false; + if (!decoder->decode(t.m_hasPreciseScrollingDeltas)) + return false; #endif return true; } diff --git a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp index f5dbbc4..555eab5 100644 --- a/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp +++ b/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp index 4edf46f..936b6b3 100644 --- a/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp +++ b/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ArgumentCodersCF.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp index 08c5dc3..e9ca723 100644 --- a/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp +++ b/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include <WebCore/GraphicsContext.h> diff --git a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp index b84f05c..50c7b57 100644 --- a/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp +++ b/Source/WebKit2/Shared/gtk/ShareableBitmapGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/gtk/UpdateChunk.cpp b/Source/WebKit2/Shared/gtk/UpdateChunk.cpp new file mode 100644 index 0000000..fb3573c --- /dev/null +++ b/Source/WebKit2/Shared/gtk/UpdateChunk.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "UpdateChunk.h" + +#include "WebCoreArgumentCoders.h" +#include <gdk/gdkx.h> + +using namespace WebCore; + +static cairo_format_t imageFormat = CAIRO_FORMAT_ARGB32; + +namespace WebKit { + +UpdateChunk::UpdateChunk() + : m_sharedMemory(0) +{ +} + +UpdateChunk::UpdateChunk(const IntRect& rect) + : m_rect(rect) + , m_sharedMemory(SharedMemory::create(size())) +{ +} + +UpdateChunk::~UpdateChunk() +{ +} + +size_t UpdateChunk::size() const +{ + return cairo_format_stride_for_width(imageFormat, m_rect.width()) * m_rect.height(); +} + +void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(m_rect); + if (!m_sharedMemory) { + encoder->encode(false); + return; + } + + SharedMemory::Handle handle; + if (m_sharedMemory->createHandle(handle, SharedMemory::ReadOnly)) { + encoder->encode(true); + encoder->encode(handle); + } else + encoder->encode(false); + + m_sharedMemory = 0; +} + +bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) +{ + ASSERT_ARG(chunk, chunk.isEmpty()); + + IntRect rect; + if (!decoder->decode(rect)) + return false; + + chunk.m_rect = rect; + + bool hasSharedMemory; + if (!decoder->decode(hasSharedMemory)) + return false; + + if (!hasSharedMemory) { + chunk.m_sharedMemory = 0; + return true; + } + + SharedMemory::Handle handle; + if (!decoder->decode(handle)) + return false; + + chunk.m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly); + return true; +} + +cairo_surface_t* UpdateChunk::createImage() const +{ + ASSERT(m_sharedMemory); + if (!m_sharedMemory) + return 0; + + int stride = cairo_format_stride_for_width(imageFormat, m_rect.width()); + return cairo_image_surface_create_for_data(static_cast<unsigned char*>(m_sharedMemory->data()), + imageFormat, m_rect.width(), m_rect.height(), stride); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/gtk/UpdateChunk.h b/Source/WebKit2/Shared/gtk/UpdateChunk.h new file mode 100644 index 0000000..6242add --- /dev/null +++ b/Source/WebKit2/Shared/gtk/UpdateChunk.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. + * Copyright (C) 2011 Igalia S.L + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UpdateChunk_h +#define UpdateChunk_h + +#include "IntRect.h" +#include "SharedMemory.h" + +#include <cairo.h> + +namespace CoreIPC { +class ArgumentEncoder; +class ArgumentDecoder; +} + +namespace WebKit { + +class UpdateChunk { +public: + UpdateChunk(); + UpdateChunk(const WebCore::IntRect&); + ~UpdateChunk(); + + const WebCore::IntRect& rect() const { return m_rect; } + bool isEmpty() { return m_rect.isEmpty(); } + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&); + + cairo_surface_t* createImage() const; + +private: + size_t size() const; + int m_stride; + WebCore::IntRect m_rect; + mutable RefPtr<SharedMemory> m_sharedMemory; +}; + +} // namespace WebKit + + +#endif // UpdateChunk_h diff --git a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp index 95d6286..515966c 100644 --- a/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp +++ b/Source/WebKit2/Shared/gtk/WebCoreArgumentCodersGtk.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCoreArgumentCoders.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/mac/CommandLineMac.cpp b/Source/WebKit2/Shared/mac/CommandLineMac.cpp index 185aaea..d48a401 100644 --- a/Source/WebKit2/Shared/mac/CommandLineMac.cpp +++ b/Source/WebKit2/Shared/mac/CommandLineMac.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CommandLine.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h new file mode 100644 index 0000000..482f579 --- /dev/null +++ b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CoreAnimationRenderer_h +#define CoreAnimationRenderer_h + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +OBJC_CLASS CALayer; +OBJC_CLASS CARenderer; + +typedef struct _CGLContextObject* CGLContextObj; + +namespace WebKit { + +class CoreAnimationRenderer : public RefCounted<CoreAnimationRenderer> { +public: + class Client { + public: + virtual ~Client() { } + virtual void rendererDidChange(CoreAnimationRenderer*) = 0; + }; + + static PassRefPtr<CoreAnimationRenderer> create(Client*, CGLContextObj, CALayer *); + ~CoreAnimationRenderer(); + + void invalidate(); + + void setBounds(CGRect); + void render(CFTimeInterval frameTime, CVTimeStamp*, CFTimeInterval& nextFrameTime); + +private: + CoreAnimationRenderer(Client*, CGLContextObj, CALayer *); + + static void rendererDidChange(void*); + void rendererDidChange(); + + Client* m_client; + CGLContextObj m_cglContext; + RetainPtr<CARenderer> m_renderer; +}; + +} // namespace WebKit + +#endif // CoreAnimationRenderer_h diff --git a/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm new file mode 100644 index 0000000..97276f6 --- /dev/null +++ b/Source/WebKit2/Shared/mac/CoreAnimationRenderer.mm @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "CoreAnimationRenderer.h" + +#import <WebKitSystemInterface.h> +#import <QuartzCore/QuartzCore.h> +#import <OpenGL/CGLMacro.h> + +// The CGLMacro.h header adds an implicit CGLContextObj parameter to all OpenGL calls, +// which is good because it allows us to make OpenGL calls without saving and restoring the +// current context. The context argument is named "cgl_ctx" by default, so we use the macro +// below to declare this variable. +#define DECLARE_GL_CONTEXT_VARIABLE(name) \ + CGLContextObj cgl_ctx = (name) + +namespace WebKit { + +PassRefPtr<CoreAnimationRenderer> CoreAnimationRenderer::create(Client* client, CGLContextObj cglContextObj, CALayer *layer) +{ + return adoptRef(new CoreAnimationRenderer(client, cglContextObj, layer)); +} + +CoreAnimationRenderer::CoreAnimationRenderer(Client* client, CGLContextObj cglContextObj, CALayer *layer) + : m_client(client) + , m_cglContext(cglContextObj) + , m_renderer([CARenderer rendererWithCGLContext:m_cglContext options:nil]) +{ + [m_renderer.get() setLayer:layer]; + + WKCARendererAddChangeNotificationObserver(m_renderer.get(), rendererDidChange, this); +} + +CoreAnimationRenderer::~CoreAnimationRenderer() +{ + ASSERT(!m_client); +} + +void CoreAnimationRenderer::setBounds(CGRect bounds) +{ + [m_renderer.get() setBounds:bounds]; + + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [[m_renderer.get() layer] setFrame:bounds]; + [CATransaction commit]; +} + +void CoreAnimationRenderer::render(CFTimeInterval frameTime, CVTimeStamp* timeStamp, CFTimeInterval& nextFrameTime) +{ + [m_renderer.get() beginFrameAtTime:frameTime timeStamp:timeStamp]; + [m_renderer.get() render]; + nextFrameTime = [m_renderer.get() nextFrameTime]; + [m_renderer.get() endFrame]; +} + +void CoreAnimationRenderer::invalidate() +{ + ASSERT(m_client); + + WKCARendererRemoveChangeNotificationObserver(m_renderer.get(), rendererDidChange, this); + m_client = 0; +} + +void CoreAnimationRenderer::rendererDidChange(void* context) +{ + static_cast<CoreAnimationRenderer*>(context)->rendererDidChange(); +} + +void CoreAnimationRenderer::rendererDidChange() +{ + ASSERT(m_client); + + m_client->rendererDidChange(this); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm b/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm new file mode 100644 index 0000000..e4ad1ce --- /dev/null +++ b/Source/WebKit2/Shared/mac/LayerTreeContextMac.mm @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LayerTreeContext.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" + +namespace WebKit { + +LayerTreeContext::LayerTreeContext() + : contextID(0) +{ +} + +LayerTreeContext::~LayerTreeContext() +{ +} + +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(contextID); +} + +bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder* decoder, LayerTreeContext& result) +{ + if (!decoder->decode(result.contextID)) + return false; + + return true; +} + +bool LayerTreeContext::isEmpty() const +{ + return !contextID; +} + +bool operator==(const LayerTreeContext& a, const LayerTreeContext& b) +{ + return a.contextID == b.contextID; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm b/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm index d69082d..c9f2a0a 100644 --- a/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm +++ b/Source/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "NativeWebKeyboardEvent.h" #import "WebEventFactory.h" diff --git a/Source/WebKit2/Shared/mac/PasteboardTypes.mm b/Source/WebKit2/Shared/mac/PasteboardTypes.mm index 380e24c..0d48464 100644 --- a/Source/WebKit2/Shared/mac/PasteboardTypes.mm +++ b/Source/WebKit2/Shared/mac/PasteboardTypes.mm @@ -23,7 +23,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "PasteboardTypes.h" + #import <wtf/RetainPtr.h> namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm index 0f3fee7..0c0b737 100644 --- a/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm +++ b/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm @@ -23,12 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "PlatformCertificateInfo.h" +#import "config.h" +#import "PlatformCertificateInfo.h" -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" -#include <WebKitSystemInterface.h> -#include <Security/Security.h> +#import "ArgumentDecoder.h" +#import "ArgumentEncoder.h" +#import <WebKitSystemInterface.h> +#import <Security/Security.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/mac/PrintInfoMac.mm b/Source/WebKit2/Shared/mac/PrintInfoMac.mm index 78cf9df..bb7792c 100644 --- a/Source/WebKit2/Shared/mac/PrintInfoMac.mm +++ b/Source/WebKit2/Shared/mac/PrintInfoMac.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "PrintInfo.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm index 68b5849..54cf5d3 100644 --- a/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm +++ b/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm @@ -23,16 +23,17 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(WEB_PROCESS_SANDBOX) +#import "config.h" +#import "SandboxExtension.h" -#include "SandboxExtension.h" +#if ENABLE(WEB_PROCESS_SANDBOX) -#include "ArgumentDecoder.h" -#include "ArgumentEncoder.h" -#include "DataReference.h" -#include "WebKitSystemInterface.h" -#include <WebCore/FileSystem.h> -#include <wtf/text/CString.h> +#import "ArgumentDecoder.h" +#import "ArgumentEncoder.h" +#import "DataReference.h" +#import "WebKitSystemInterface.h" +#import <WebCore/FileSystem.h> +#import <wtf/text/CString.h> using namespace WebCore; diff --git a/Source/WebKit2/Shared/mac/ShareableSurface.cpp b/Source/WebKit2/Shared/mac/ShareableSurface.cpp new file mode 100644 index 0000000..4c15f5e --- /dev/null +++ b/Source/WebKit2/Shared/mac/ShareableSurface.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ShareableSurface.h" + +#include "ArgumentDecoder.h" +#include "ArgumentEncoder.h" +#include "MachPort.h" +#include <IOSurface/IOSurface.h> +#include <OpenGL/CGLIOSurface.h> +#include <OpenGL/CGLMacro.h> +#include <OpenGL/OpenGL.h> +#include <mach/mach_port.h> + +// The CGLMacro.h header adds an implicit CGLContextObj parameter to all OpenGL calls, +// which is good because it allows us to make OpenGL calls without saving and restoring the +// current context. The context argument is named "cgl_ctx" by default, so we the macro +// below to declare this variable. +#define DECLARE_GL_CONTEXT_VARIABLE(name) \ + CGLContextObj cgl_ctx = (name) + +// It expects a context named " +using namespace WebCore; + +namespace WebKit { + +ShareableSurface::Handle::Handle() + : m_port(MACH_PORT_NULL) +{ +} + +ShareableSurface::Handle::~Handle() +{ + if (m_port != MACH_PORT_NULL) + mach_port_deallocate(mach_task_self(), m_port); +} + +void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder* encoder) const +{ + encoder->encode(CoreIPC::MachPort(m_port, MACH_MSG_TYPE_MOVE_SEND)); + m_port = MACH_PORT_NULL; +} + +bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle) +{ + ASSERT_ARG(handle, handle.m_port == MACH_PORT_NULL); + + CoreIPC::MachPort machPort; + if (!decoder->decode(machPort)) + return false; + + handle.m_port = machPort.port(); + return false; +} + +static RetainPtr<IOSurfaceRef> createIOSurface(const IntSize& size) +{ + int width = size.width(); + int height = size.height(); + + unsigned bytesPerElement = 4; + unsigned long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement); + if (!bytesPerRow) + return 0; + + unsigned long allocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow); + if (!allocSize) + return 0; + + unsigned pixelFormat = 'BGRA'; + + static const size_t numKeys = 6; + const void *keys[numKeys]; + const void *values[numKeys]; + keys[0] = kIOSurfaceWidth; + values[0] = CFNumberCreate(0, kCFNumberIntType, &width); + keys[1] = kIOSurfaceHeight; + values[1] = CFNumberCreate(0, kCFNumberIntType, &height); + keys[2] = kIOSurfacePixelFormat; + values[2] = CFNumberCreate(0, kCFNumberIntType, &pixelFormat); + keys[3] = kIOSurfaceBytesPerElement; + values[3] = CFNumberCreate(0, kCFNumberIntType, &bytesPerElement); + keys[4] = kIOSurfaceBytesPerRow; + values[4] = CFNumberCreate(0, kCFNumberLongType, &bytesPerRow); + keys[5] = kIOSurfaceAllocSize; + values[5] = CFNumberCreate(0, kCFNumberLongType, &allocSize); + + RetainPtr<CFDictionaryRef> dictionary(AdoptCF, CFDictionaryCreate(0, keys, values, numKeys, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + for (unsigned i = 0; i < numKeys; i++) + CFRelease(values[i]); + + return RetainPtr<IOSurfaceRef>(AdoptCF, IOSurfaceCreate(dictionary.get())); +} + +PassRefPtr<ShareableSurface> ShareableSurface::create(CGLContextObj cglContextObj, const IntSize& size) +{ + RetainPtr<IOSurfaceRef> ioSurface = createIOSurface(size); + if (!ioSurface) + return 0; + + return adoptRef(new ShareableSurface(cglContextObj, size, ioSurface.get())); +} + +PassRefPtr<ShareableSurface> ShareableSurface::create(CGLContextObj cglContextObj, const Handle& handle) +{ + ASSERT_ARG(handle, handle.m_port != MACH_PORT_NULL); + + RetainPtr<IOSurfaceRef> ioSurface(AdoptCF, IOSurfaceLookupFromMachPort(handle.m_port)); + if (!ioSurface) + return 0; + + IntSize size = IntSize(IOSurfaceGetWidth(ioSurface.get()), IOSurfaceGetHeight(ioSurface.get())); + + return adoptRef(new ShareableSurface(cglContextObj, size, ioSurface.get())); +} + +ShareableSurface::ShareableSurface(CGLContextObj cglContextObj, const IntSize& size, IOSurfaceRef ioSurface) + : m_cglContextObj(CGLRetainContext(cglContextObj)) + , m_size(size) + , m_textureID(0) + , m_frameBufferObjectID(0) + , m_ioSurface(ioSurface) +{ +} + +ShareableSurface::~ShareableSurface() +{ + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + if (m_textureID) + glDeleteTextures(1, &m_textureID); + + if (m_frameBufferObjectID) + glDeleteFramebuffersEXT(1, &m_frameBufferObjectID); + + CGLReleaseContext(m_cglContextObj); +} + +bool ShareableSurface::createHandle(Handle& handle) +{ + ASSERT_ARG(handle, handle.m_port == MACH_PORT_NULL); + + mach_port_t port = IOSurfaceCreateMachPort(m_ioSurface.get()); + if (port == MACH_PORT_NULL) + return false; + + handle.m_port = port; + return true; +} + +void ShareableSurface::attach() +{ + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + if (!m_frameBufferObjectID) { + // Generate a frame buffer object. + glGenFramebuffersEXT(1, &m_frameBufferObjectID); + + // Associate it with the texture. + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBufferObjectID); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, textureID(), 0); + } else + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBufferObjectID); +} + +void ShareableSurface::detach() +{ + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +} + +unsigned ShareableSurface::textureID() +{ + if (m_textureID) + return m_textureID; + + DECLARE_GL_CONTEXT_VARIABLE(m_cglContextObj); + + // Generate a texture. + glGenTextures(1, &m_textureID); + + // Associate it with our IOSurface. + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, m_textureID); + CGLTexImageIOSurface2D(cgl_ctx, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA8, m_size.width(), m_size.height(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, m_ioSurface.get(), 0); + glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 0); + + return m_textureID; +} + +} // namespace WebKit + diff --git a/Source/WebKit2/Shared/mac/ShareableSurface.h b/Source/WebKit2/Shared/mac/ShareableSurface.h new file mode 100644 index 0000000..dda1364 --- /dev/null +++ b/Source/WebKit2/Shared/mac/ShareableSurface.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ShareableSurface_h +#define ShareableSurface_h + +#include <WebCore/IntSize.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +typedef struct _CGLContextObject* CGLContextObj; +typedef struct __IOSurface* IOSurfaceRef; + +namespace CoreIPC { + class ArgumentDecoder; + class ArgumentEncoder; +} + +namespace WebKit { + +class ShareableSurface : public RefCounted<ShareableSurface> { +public: + class Handle { + WTF_MAKE_NONCOPYABLE(Handle); + + public: + Handle(); + ~Handle(); + + void encode(CoreIPC::ArgumentEncoder*) const; + static bool decode(CoreIPC::ArgumentDecoder*, Handle&); + + private: + friend class ShareableSurface; + + mutable mach_port_t m_port; + }; + + // Create a shareable surface with the given size. Returns 0 on failure. + static PassRefPtr<ShareableSurface> create(CGLContextObj, const WebCore::IntSize&); + + // Create a shareable surface from a handle. Returns 0 on failure. + static PassRefPtr<ShareableSurface> create(CGLContextObj, const Handle&); + + ~ShareableSurface(); + + bool createHandle(Handle&); + + unsigned textureID(); + + void attach(); + void detach(); + +private: + ShareableSurface(CGLContextObj, const WebCore::IntSize&, IOSurfaceRef); + + // The OpenGL context. + CGLContextObj m_cglContextObj; + + // The size of the surface. + WebCore::IntSize m_size; + + // The ID of the texture. + unsigned m_textureID; + + // The frame buffer object ID of the texture; used when the surface is used as a render destination. + unsigned m_frameBufferObjectID; + + RetainPtr<IOSurfaceRef> m_ioSurface; +}; + +} // namespace WebKit + +#endif // ShareableSurface_h diff --git a/Source/WebKit2/Shared/mac/UpdateChunk.cpp b/Source/WebKit2/Shared/mac/UpdateChunk.cpp index a9376db..76206fb 100644 --- a/Source/WebKit2/Shared/mac/UpdateChunk.cpp +++ b/Source/WebKit2/Shared/mac/UpdateChunk.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateChunk.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm index 8ffba8a..63dd20d 100644 --- a/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm +++ b/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm @@ -23,10 +23,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebCoreArgumentCoders.h" +#import "config.h" +#import "WebCoreArgumentCoders.h" -#include "ArgumentCodersCF.h" -#include "WebKitSystemInterface.h" +#import "ArgumentCodersCF.h" +#import "WebKitSystemInterface.h" namespace CoreIPC { diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.h b/Source/WebKit2/Shared/mac/WebEventFactory.h index 7bc8d97..73fbed0 100644 --- a/Source/WebKit2/Shared/mac/WebEventFactory.h +++ b/Source/WebKit2/Shared/mac/WebEventFactory.h @@ -38,6 +38,10 @@ public: static WebMouseEvent createWebMouseEvent(NSEvent *event, NSView *windowView); static WebWheelEvent createWebWheelEvent(NSEvent *event, NSView *windowView); static WebKeyboardEvent createWebKeyboardEvent(NSEvent *event, NSView *windowView); + +#if ENABLE(GESTURE_EVENTS) + static WebGestureEvent createWebGestureEvent(NSEvent *event, NSView *windowView); +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/WebEventFactory.mm b/Source/WebKit2/Shared/mac/WebEventFactory.mm index 46ff906..e31c62e 100644 --- a/Source/WebKit2/Shared/mac/WebEventFactory.mm +++ b/Source/WebKit2/Shared/mac/WebEventFactory.mm @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#import "config.h" #import "WebEventFactory.h" #import "WebKitSystemInterface.h" @@ -188,7 +189,22 @@ static WebWheelEvent::Phase phaseForEvent(NSEvent *event) return WebWheelEvent::PhaseNone; #endif } - + +#if ENABLE(GESTURE_EVENTS) +static WebEvent::Type gestureEventTypeForEvent(NSEvent *event) +{ + switch ([event type]) { + case NSEventTypeBeginGesture: + return WebEvent::GestureScrollBegin; + case NSEventTypeEndGesture: + return WebEvent::GestureScrollEnd; + default: + ASSERT_NOT_REACHED(); + return WebEvent::GestureScrollEnd; + } +} +#endif + static inline String textFromEvent(NSEvent* event) { if ([event type] == NSFlagsChanged) @@ -1020,10 +1036,11 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windo } WebWheelEvent::Phase phase = phaseForEvent(event); + bool hasPreciseScrollingDeltas = continuous; WebEvent::Modifiers modifiers = modifiersForEvent(event); double timestamp = [event timestamp]; - return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, modifiers, timestamp); + return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, hasPreciseScrollingDeltas, modifiers, timestamp); } WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView *) @@ -1044,4 +1061,17 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp); } +#if ENABLE(GESTURE_EVENTS) +WebGestureEvent WebEventFactory::createWebGestureEvent(NSEvent *event, NSView *windowView) +{ + WebEvent::Type type = gestureEventTypeForEvent(event); + NSPoint position = pointForEvent(event, windowView); + NSPoint globalPosition = globalPointForEvent(event); + WebEvent::Modifiers modifiers = modifiersForEvent(event); + double timestamp = [event timestamp]; + + return WebGestureEvent(type, IntPoint(position), IntPoint(globalPosition), modifiers, timestamp); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm b/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm index 5be52d4..ed12cc4 100644 --- a/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm +++ b/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm @@ -23,18 +23,19 @@ * */ -#if ENABLE(MEMORY_SAMPLER) +#import "config.h" +#import "WebMemorySampler.h" -#include "WebMemorySampler.h" +#if ENABLE(MEMORY_SAMPLER) -#include <JavaScriptCore/MemoryStatistics.h> -#include <mach/mach.h> -#include <mach/task.h> -#include <mach/mach_types.h> -#include <malloc/malloc.h> -#include <runtime/JSLock.h> -#include <WebCore/JSDOMWindow.h> -#include <wtf/CurrentTime.h> +#import <JavaScriptCore/MemoryStatistics.h> +#import <mach/mach.h> +#import <mach/task.h> +#import <mach/mach_types.h> +#import <malloc/malloc.h> +#import <runtime/JSLock.h> +#import <WebCore/JSDOMWindow.h> +#import <wtf/CurrentTime.h> using namespace WebCore; using namespace JSC; @@ -115,9 +116,8 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const totalBytesCommitted += fastMallocBytesCommitted; JSLock lock(SilenceAssertionsOnly); - MarkedSpace::Statistics heapMemoryStats = heapStatistics(JSDOMWindow::commonJSGlobalData()); - size_t jscHeapBytesInUse = heapMemoryStats.size - heapMemoryStats.free; - size_t jscHeapBytesCommitted = heapMemoryStats.size; + size_t jscHeapBytesInUse = JSDOMWindow::commonJSGlobalData()->heap.size(); + size_t jscHeapBytesCommitted = JSDOMWindow::commonJSGlobalData()->heap.capacity(); totalBytesInUse += jscHeapBytesInUse; totalBytesCommitted += jscHeapBytesCommitted; diff --git a/Source/WebKit2/Shared/mac/WebURLRequestMac.mm b/Source/WebKit2/Shared/mac/WebURLRequestMac.mm index a7196f7..4eda378 100644 --- a/Source/WebKit2/Shared/mac/WebURLRequestMac.mm +++ b/Source/WebKit2/Shared/mac/WebURLRequestMac.mm @@ -23,7 +23,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebURLRequest.h" +#import "config.h" +#import "WebURLRequest.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/mac/WebURLResponseMac.mm b/Source/WebKit2/Shared/mac/WebURLResponseMac.mm index ff5b6e6..6f44afc 100644 --- a/Source/WebKit2/Shared/mac/WebURLResponseMac.mm +++ b/Source/WebKit2/Shared/mac/WebURLResponseMac.mm @@ -23,7 +23,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "WebURLResponse.h" +#import "config.h" +#import "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/CleanupHandler.cpp b/Source/WebKit2/Shared/qt/CleanupHandler.cpp index 74c1d4c..1ec44d4 100644 --- a/Source/WebKit2/Shared/qt/CleanupHandler.cpp +++ b/Source/WebKit2/Shared/qt/CleanupHandler.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CleanupHandler.h" #include "MappedMemoryPool.h" diff --git a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp index d0d247c..9a2d666 100644 --- a/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp +++ b/Source/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NativeWebKeyboardEvent.h" #include "WebEventFactoryQt.h" diff --git a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp index 184b0f8..36c45a2 100644 --- a/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp +++ b/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "ShareableBitmap.h" #include <QImage> diff --git a/Source/WebKit2/Shared/qt/UpdateChunk.cpp b/Source/WebKit2/Shared/qt/UpdateChunk.cpp index 4d8e62d..772d499 100644 --- a/Source/WebKit2/Shared/qt/UpdateChunk.cpp +++ b/Source/WebKit2/Shared/qt/UpdateChunk.cpp @@ -25,11 +25,11 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateChunk.h" #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" -#include "MappedMemoryPool.h" #include "WebCoreArgumentCoders.h" #include <QIODevice> #include <QImage> @@ -43,28 +43,35 @@ using namespace std; namespace WebKit { UpdateChunk::UpdateChunk() - : m_mappedMemory(0) { } UpdateChunk::UpdateChunk(const IntRect& rect) : m_rect(rect) - , m_mappedMemory(MappedMemoryPool::instance()->mapMemory(size())) + , m_sharedMemory(SharedMemory::create(size())) { } UpdateChunk::~UpdateChunk() { - if (m_mappedMemory) - m_mappedMemory->markFree(); } void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const { encoder->encode(m_rect); - encoder->encode(String(m_mappedMemory->mappedFileName())); + if (!m_sharedMemory) { + encoder->encode(false); + return; + } + + SharedMemory::Handle handle; + if (m_sharedMemory->createHandle(handle, SharedMemory::ReadOnly)) { + encoder->encode(true); + encoder->encode(handle); + } else + encoder->encode(false); - m_mappedMemory = 0; + m_sharedMemory = 0; } bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) @@ -74,16 +81,23 @@ bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk) IntRect rect; if (!decoder->decode(rect)) return false; + chunk.m_rect = rect; - if (chunk.isEmpty()) - return true; // Successfully decoded empty chunk. + bool hasSharedMemory; + if (!decoder->decode(hasSharedMemory)) + return false; - String fileName; - if (!decoder->decode(fileName)) + if (!hasSharedMemory) { + chunk.m_sharedMemory = 0; + return true; + } + + SharedMemory::Handle handle; + if (!decoder->decode(handle)) return false; - chunk.m_mappedMemory = MappedMemoryPool::instance()->mapFile(fileName, chunk.size()); + chunk.m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly); return true; } @@ -101,7 +115,10 @@ size_t UpdateChunk::size() const QImage UpdateChunk::createImage() const { - ASSERT(m_mappedMemory); + ASSERT(m_sharedMemory); + if (!m_sharedMemory) + return QImage(); + QImage::Format format; int bpp; if (QPixmap::defaultDepth() == 16) { @@ -112,7 +129,7 @@ QImage UpdateChunk::createImage() const bpp = 4; } - return QImage(m_mappedMemory->data(), m_rect.width(), m_rect.height(), (m_rect.width() * bpp + 3) & ~0x3, format); + return QImage(reinterpret_cast<unsigned char*>(m_sharedMemory->data()), m_rect.width(), m_rect.height(), (m_rect.width() * bpp + 3) & ~0x3, format); } } // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/UpdateChunk.h b/Source/WebKit2/Shared/qt/UpdateChunk.h index f506ba7..664056a 100644 --- a/Source/WebKit2/Shared/qt/UpdateChunk.h +++ b/Source/WebKit2/Shared/qt/UpdateChunk.h @@ -29,6 +29,7 @@ #include <QImage> #include <WebCore/IntRect.h> +#include "SharedMemory.h" namespace CoreIPC { class ArgumentEncoder; @@ -37,8 +38,6 @@ class ArgumentDecoder; namespace WebKit { -class MappedMemory; - class UpdateChunk { public: UpdateChunk(); @@ -58,7 +57,7 @@ private: WebCore::IntRect m_rect; - mutable MappedMemory* m_mappedMemory; + mutable RefPtr<SharedMemory> m_sharedMemory; }; } // namespace WebKit diff --git a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp index 80ab3f9..44cdbea 100644 --- a/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp +++ b/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCoreArgumentCoders.h" #include "NotImplemented.h" diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp index 39a6455..8edc03c 100644 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEventFactoryQt.h" #include <qgraphicssceneevent.h> #include <QApplication> diff --git a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp index 834353a..717a4cc 100644 --- a/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp +++ b/Source/WebKit2/Shared/qt/WebURLRequestQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLRequest.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp index abc0c29..35625e3 100644 --- a/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp +++ b/Source/WebKit2/Shared/qt/WebURLResponseQt.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLResponse.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/win/CommandLineWin.cpp b/Source/WebKit2/Shared/win/CommandLineWin.cpp index 7d6c9e3..2e2798f 100644 --- a/Source/WebKit2/Shared/win/CommandLineWin.cpp +++ b/Source/WebKit2/Shared/win/CommandLineWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "CommandLine.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp new file mode 100644 index 0000000..f1bf1b4 --- /dev/null +++ b/Source/WebKit2/Shared/win/LayerTreeContextWin.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LayerTreeContext.h" + +#include "NotImplemented.h" + +namespace WebKit { + +LayerTreeContext::LayerTreeContext() +{ + notImplemented(); +} + +LayerTreeContext::~LayerTreeContext() +{ + notImplemented(); +} + +void LayerTreeContext::encode(CoreIPC::ArgumentEncoder*) const +{ + notImplemented(); +} + +bool LayerTreeContext::decode(CoreIPC::ArgumentDecoder*, LayerTreeContext&) +{ + notImplemented(); + return true; +} + +bool LayerTreeContext::isEmpty() const +{ + notImplemented(); + return true; +} + +bool operator==(const LayerTreeContext&, const LayerTreeContext&) +{ + notImplemented(); + return true; +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp index d947b87..37aaf5d 100644 --- a/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp +++ b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "NativeWebKeyboardEvent.h" #include "WebEventFactory.h" diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp index b88a7ef..ade2291 100644 --- a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp +++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "PlatformCertificateInfo.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/win/UpdateChunk.cpp b/Source/WebKit2/Shared/win/UpdateChunk.cpp index 2aabead..236e279 100644 --- a/Source/WebKit2/Shared/win/UpdateChunk.cpp +++ b/Source/WebKit2/Shared/win/UpdateChunk.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UpdateChunk.h" #include "ArgumentDecoder.h" diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp index 95d7de2..684378a 100644 --- a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp +++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebCoreArgumentCoders.h" #if USE(CFNETWORK) diff --git a/Source/WebKit2/Shared/win/WebEventFactory.cpp b/Source/WebKit2/Shared/win/WebEventFactory.cpp index a4081fc..44a67fc 100644 --- a/Source/WebKit2/Shared/win/WebEventFactory.cpp +++ b/Source/WebKit2/Shared/win/WebEventFactory.cpp @@ -24,6 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebEventFactory.h" #include <windowsx.h> diff --git a/Source/WebKit2/Shared/win/WebURLRequestWin.cpp b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp index e64d451..4bbc10c 100644 --- a/Source/WebKit2/Shared/win/WebURLRequestWin.cpp +++ b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLRequest.h" namespace WebKit { diff --git a/Source/WebKit2/Shared/win/WebURLResponseWin.cpp b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp index 3b3f24c..e41c0f3 100644 --- a/Source/WebKit2/Shared/win/WebURLResponseWin.cpp +++ b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WebURLResponse.h" namespace WebKit { |