diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
commit | dd91e772430dc294e3bf478c119ef8d43c0a3358 (patch) | |
tree | 6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebKit2/Shared | |
parent | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff) | |
download | qtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz |
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebKit2/Shared')
-rw-r--r-- | Source/WebKit2/Shared/API/c/WKBase.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/Shared/API/c/WKRenderLayer.cpp | 121 | ||||
-rw-r--r-- | Source/WebKit2/Shared/API/c/WKRenderLayer.h | 70 | ||||
-rw-r--r-- | Source/WebKit2/Shared/API/c/WKRenderObject.cpp | 60 | ||||
-rw-r--r-- | Source/WebKit2/Shared/API/c/WKRenderObject.h (renamed from Source/WebKit2/Shared/ContextMenuState.h) | 44 | ||||
-rw-r--r-- | Source/WebKit2/Shared/APIClientTraits.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/Shared/APIObject.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/Shared/LayerTreeContext.h | 7 | ||||
-rw-r--r-- | Source/WebKit2/Shared/UserMessageCoders.h | 96 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebHitTestResult.h | 14 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebLayerTreeInfo.cpp | 3 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebLayerTreeInfo.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebRenderLayer.cpp | 136 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebRenderLayer.h | 114 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebRenderObject.cpp | 92 | ||||
-rw-r--r-- | Source/WebKit2/Shared/WebRenderObject.h | 81 | ||||
-rw-r--r-- | Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp | 1 |
17 files changed, 815 insertions, 32 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h index adbce6d68..c8656e4a3 100644 --- a/Source/WebKit2/Shared/API/c/WKBase.h +++ b/Source/WebKit2/Shared/API/c/WKBase.h @@ -59,6 +59,8 @@ typedef const struct OpaqueWKGraphicsContext* WKGraphicsContextRef; typedef const struct OpaqueWKImage* WKImageRef; typedef const struct OpaqueWKPointRef* WKPointRef; typedef const struct OpaqueWKRectRef* WKRectRef; +typedef const struct OpaqueWKRenderLayer* WKRenderLayerRef; +typedef const struct OpaqueWKRenderObject* WKRenderObjectRef; typedef const struct OpaqueWKSecurityOrigin* WKSecurityOriginRef; typedef const struct OpaqueWKSerializedScriptValue* WKSerializedScriptValueRef; typedef const struct OpaqueWKSizeRef* WKSizeRef; diff --git a/Source/WebKit2/Shared/API/c/WKRenderLayer.cpp b/Source/WebKit2/Shared/API/c/WKRenderLayer.cpp new file mode 100644 index 000000000..7c2765100 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKRenderLayer.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2012 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 "WKRenderLayer.h" + +#include "WKAPICast.h" +#include "WebRenderLayer.h" + +using namespace WebCore; +using namespace WebKit; + +WKTypeID WKRenderLayerGetTypeID() +{ + return toAPI(WebRenderLayer::APIType); +} + +WKStringRef WKRenderLayerCopyRendererName(WKRenderLayerRef renderLayerRef) +{ + return toCopiedAPI(toImpl(renderLayerRef)->renderObjectName()); +} + +WKStringRef WKRenderLayerCopyElementTagName(WKRenderLayerRef renderLayerRef) +{ + WebRenderLayer* renderLayer = toImpl(renderLayerRef); + if (!renderLayer->elementTagName().isNull()) + return toCopiedAPI(toImpl(renderLayerRef)->elementTagName()); + + return 0; +} + +WKStringRef WKRenderLayerCopyElementID(WKRenderLayerRef renderLayerRef) +{ + WebRenderLayer* renderLayer = toImpl(renderLayerRef); + if (!renderLayer->elementID().isNull()) + return toCopiedAPI(toImpl(renderLayerRef)->elementID()); + + return 0; +} + +WKArrayRef WKRenderLayerGetElementClassNames(WKRenderLayerRef renderLayerRef) +{ + return toAPI(toImpl(renderLayerRef)->elementClassNames()); +} + +WKRect WKRenderLayerGetAbsoluteBounds(WKRenderLayerRef renderLayerRef) +{ + IntRect bounds = toImpl(renderLayerRef)->absoluteBoundingBox(); + return WKRectMake(bounds.x(), bounds.y(), bounds.width(), bounds.height()); +} + +bool WKRenderLayerIsClipping(WKRenderLayerRef renderLayerRef) +{ + return toImpl(renderLayerRef)->isClipping(); +} + +bool WKRenderLayerIsClipped(WKRenderLayerRef renderLayerRef) +{ + return toImpl(renderLayerRef)->isClipped(); +} + +bool WKRenderLayerIsReflection(WKRenderLayerRef renderLayerRef) +{ + return toImpl(renderLayerRef)->isReflection(); +} + +WKCompositingLayerType WKRenderLayerGetCompositingLayerType(WKRenderLayerRef renderLayerRef) +{ + switch (toImpl(renderLayerRef)->compositingLayerType()) { + case WebRenderLayer::None: + return kWKCompositingLayerTypeNone; + case WebRenderLayer::Normal: + return kWKCompositingLayerTypeNormal; + case WebRenderLayer::Tiled: + return kWKCompositingLayerTypeTiled; + case WebRenderLayer::Media: + return kWKCompositingLayerTypeMedia; + case WebRenderLayer::Container: + return kWKCompositingLayerTypeContainer; + } + + ASSERT_NOT_REACHED(); + return kWKCompositingLayerTypeNone; +} + +WKArrayRef WKRenderLayerGetNegativeZOrderList(WKRenderLayerRef renderLayerRef) +{ + return toAPI(toImpl(renderLayerRef)->negativeZOrderList()); +} + +WKArrayRef WKRenderLayerGetNormalFlowList(WKRenderLayerRef renderLayerRef) +{ + return toAPI(toImpl(renderLayerRef)->normalFlowList()); +} + +WKArrayRef WKRenderLayerGetPositiveZOrderList(WKRenderLayerRef renderLayerRef) +{ + return toAPI(toImpl(renderLayerRef)->positiveZOrderList()); +} diff --git a/Source/WebKit2/Shared/API/c/WKRenderLayer.h b/Source/WebKit2/Shared/API/c/WKRenderLayer.h new file mode 100644 index 000000000..6683d87b4 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKRenderLayer.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2012 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 WKRenderLayer_h +#define WKRenderLayer_h + + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKRenderLayerGetTypeID(); + +WK_EXPORT WKStringRef WKRenderLayerCopyRendererName(WKRenderLayerRef renderLayer); + +WK_EXPORT WKStringRef WKRenderLayerCopyElementTagName(WKRenderLayerRef renderLayer); +WK_EXPORT WKStringRef WKRenderLayerCopyElementID(WKRenderLayerRef renderLayer); +WK_EXPORT WKArrayRef WKRenderLayerGetElementClassNames(WKRenderLayerRef renderLayer); + +WK_EXPORT WKRect WKRenderLayerGetAbsoluteBounds(WKRenderLayerRef renderLayer); + +WK_EXPORT bool WKRenderLayerIsClipping(WKRenderLayerRef renderLayer); +WK_EXPORT bool WKRenderLayerIsClipped(WKRenderLayerRef renderLayer); +WK_EXPORT bool WKRenderLayerIsReflection(WKRenderLayerRef renderLayer); + +enum WKCompositingLayerType { + kWKCompositingLayerTypeNone, + kWKCompositingLayerTypeNormal, + kWKCompositingLayerTypeTiled, + kWKCompositingLayerTypeMedia, + kWKCompositingLayerTypeContainer +}; +typedef enum WKCompositingLayerType WKCompositingLayerType; + +WK_EXPORT WKCompositingLayerType WKRenderLayerGetCompositingLayerType(WKRenderLayerRef renderLayer); + +WK_EXPORT WKArrayRef WKRenderLayerGetNegativeZOrderList(WKRenderLayerRef renderLayer); +WK_EXPORT WKArrayRef WKRenderLayerGetNormalFlowList(WKRenderLayerRef renderLayer); +WK_EXPORT WKArrayRef WKRenderLayerGetPositiveZOrderList(WKRenderLayerRef renderLayer); + +#ifdef __cplusplus +} +#endif + +#endif // WKRenderLayer_h diff --git a/Source/WebKit2/Shared/API/c/WKRenderObject.cpp b/Source/WebKit2/Shared/API/c/WKRenderObject.cpp new file mode 100644 index 000000000..1c7274985 --- /dev/null +++ b/Source/WebKit2/Shared/API/c/WKRenderObject.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2012 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 "WKRenderObject.h" + +#include "WKAPICast.h" +#include "WebRenderObject.h" + +using namespace WebCore; +using namespace WebKit; + +WKTypeID WKRenderObjectGetTypeID() +{ + return toAPI(WebRenderObject::APIType); +} + +WKStringRef WKRenderObjectCopyName(WKRenderObjectRef renderObjectRef) +{ + return toCopiedAPI(toImpl(renderObjectRef)->name()); +} + +WKPoint WKRenderObjectGetAbsolutePosition(WKRenderObjectRef renderObjectRef) +{ + IntPoint absolutePosition = toImpl(renderObjectRef)->absolutePosition(); + return WKPointMake(absolutePosition.x(), absolutePosition.y()); +} + +WKRect WKRenderObjectGetFrameRect(WKRenderObjectRef renderObjectRef) +{ + IntRect frameRect = toImpl(renderObjectRef)->frameRect(); + return WKRectMake(frameRect.x(), frameRect.y(), frameRect.width(), frameRect.height()); +} + +WKArrayRef WKRenderObjectGetChildren(WKRenderObjectRef renderObjectRef) +{ + return toAPI(toImpl(renderObjectRef)->children().get()); +} diff --git a/Source/WebKit2/Shared/ContextMenuState.h b/Source/WebKit2/Shared/API/c/WKRenderObject.h index 9e1487b29..51d1e22db 100644 --- a/Source/WebKit2/Shared/ContextMenuState.h +++ b/Source/WebKit2/Shared/API/c/WKRenderObject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2012 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,35 +23,25 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ContextMenuState_h -#define ContextMenuState_h +#ifndef WKRenderObject_h +#define WKRenderObject_h -#include "WebCoreArgumentCoders.h" -#include <wtf/text/WTFString.h> +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> -namespace WebKit { +#ifdef __cplusplus +extern "C" { +#endif -struct ContextMenuState { - String absoluteLinkURLString; - String absoluteImageURLString; +WK_EXPORT WKTypeID WKRenderObjectGetTypeID(); - void encode(CoreIPC::ArgumentEncoder* encoder) const - { - encoder->encode(absoluteLinkURLString); - encoder->encode(absoluteImageURLString); - } +WK_EXPORT WKStringRef WKRenderObjectCopyName(WKRenderObjectRef renderObject); +WK_EXPORT WKPoint WKRenderObjectGetAbsolutePosition(WKRenderObjectRef renderObject); +WK_EXPORT WKRect WKRenderObjectGetFrameRect(WKRenderObjectRef renderObject); +WK_EXPORT WKArrayRef WKRenderObjectGetChildren(WKRenderObjectRef renderObject); - static bool decode(CoreIPC::ArgumentDecoder* decoder, ContextMenuState& result) - { - if (!decoder->decode(result.absoluteLinkURLString)) - return false; - if (!decoder->decode(result.absoluteImageURLString)) - return false; - - return true; - } -}; +#ifdef __cplusplus +} +#endif -} // namespace WebKit - -#endif // ContextMenuState_h +#endif // WKRenderObject_h diff --git a/Source/WebKit2/Shared/APIClientTraits.h b/Source/WebKit2/Shared/APIClientTraits.h index 27c81e4db..0f60fb1d5 100644 --- a/Source/WebKit2/Shared/APIClientTraits.h +++ b/Source/WebKit2/Shared/APIClientTraits.h @@ -45,7 +45,7 @@ template<> struct APIClientTraits<WKBundlePageResourceLoadClient> { }; template<> struct APIClientTraits<WKPageContextMenuClient> { - static const size_t interfaceSizesByVersion[2]; + static const size_t interfaceSizesByVersion[3]; }; template<> struct APIClientTraits<WKPageLoaderClient> { diff --git a/Source/WebKit2/Shared/APIObject.h b/Source/WebKit2/Shared/APIObject.h index 183cea0a4..d6cc03043 100644 --- a/Source/WebKit2/Shared/APIObject.h +++ b/Source/WebKit2/Shared/APIObject.h @@ -48,6 +48,8 @@ public: TypeGraphicsContext, TypeImage, TypeProtectionSpace, + TypeRenderLayer, + TypeRenderObject, TypeSecurityOrigin, TypeSerializedScriptValue, TypeString, diff --git a/Source/WebKit2/Shared/LayerTreeContext.h b/Source/WebKit2/Shared/LayerTreeContext.h index 2db584e57..f33fa9772 100644 --- a/Source/WebKit2/Shared/LayerTreeContext.h +++ b/Source/WebKit2/Shared/LayerTreeContext.h @@ -33,6 +33,13 @@ namespace CoreIPC { namespace WebKit { +enum LayerHostingMode { + LayerHostingModeDefault, +#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER) + LayerHostingModeInWindowServer +#endif +}; + class LayerTreeContext { public: LayerTreeContext(); diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h index df3860805..9672f28df 100644 --- a/Source/WebKit2/Shared/UserMessageCoders.h +++ b/Source/WebKit2/Shared/UserMessageCoders.h @@ -38,6 +38,8 @@ #include "WebGeometry.h" #include "WebImage.h" #include "WebNumber.h" +#include "WebRenderLayer.h" +#include "WebRenderObject.h" #include "WebSerializedScriptValue.h" #include "WebString.h" #include "WebURL.h" @@ -56,6 +58,8 @@ namespace WebKit { // - WebData -> WebData // - WebDouble -> WebDouble // - WebImage -> WebImage +// - WebRenderLayer -> WebRenderLayer +// - WebRenderObject -> WebRenderObject // - WebUInt64 -> WebUInt64 // - WebURL -> WebURL // - WebURLRequest -> WebURLRequest @@ -139,6 +143,30 @@ public: encoder->encode(rectObject->rect().size.height); return true; } + case APIObject::TypeRenderLayer: { + WebRenderLayer* renderLayer = static_cast<WebRenderLayer*>(m_root); + encoder->encode(renderLayer->renderObjectName()); + encoder->encode(renderLayer->elementTagName()); + encoder->encode(renderLayer->elementID()); + encoder->encode(Owner(renderLayer->elementClassNames())); + encoder->encode(renderLayer->isReflection()); + encoder->encode(renderLayer->isClipping()); + encoder->encode(renderLayer->isClipped()); + encoder->encode(static_cast<uint32_t>(renderLayer->compositingLayerType())); + encoder->encode(renderLayer->absoluteBoundingBox()); + encoder->encode(Owner(renderLayer->negativeZOrderList())); + encoder->encode(Owner(renderLayer->normalFlowList())); + encoder->encode(Owner(renderLayer->positiveZOrderList())); + return true; + } + case APIObject::TypeRenderObject: { + WebRenderObject* renderObject = static_cast<WebRenderObject*>(m_root); + encoder->encode(renderObject->name()); + encoder->encode(renderObject->absolutePosition()); + encoder->encode(renderObject->frameRect()); + encoder->encode(Owner(renderObject->children().get())); + return true; + } case APIObject::TypeURL: { WebURL* urlObject = static_cast<WebURL*>(m_root); encoder->encode(urlObject->string()); @@ -338,6 +366,74 @@ public: coder.m_root = WebRect::create(WKRectMake(x, y, width, height)); break; } + case APIObject::TypeRenderLayer: { + String renderObjectName; + String elementTagName; + String elementID; + RefPtr<APIObject> elementClassNames; + bool isReflection; + bool isClipping; + bool isClipped; + uint32_t compositingLayerTypeAsUInt32; + WebCore::IntRect absoluteBoundingBox; + RefPtr<APIObject> negativeZOrderList; + RefPtr<APIObject> normalFlowList; + RefPtr<APIObject> positiveZOrderList; + + if (!decoder->decode(renderObjectName)) + return false; + if (!decoder->decode(elementTagName)) + return false; + if (!decoder->decode(elementID)) + return false; + Owner classNamesCoder(coder, elementClassNames); + if (!decoder->decode(classNamesCoder)) + return false; + if (!decoder->decodeBool(isReflection)) + return false; + if (!decoder->decodeBool(isClipping)) + return false; + if (!decoder->decodeBool(isClipped)) + return false; + if (!decoder->decodeUInt32(compositingLayerTypeAsUInt32)) + return false; + if (!decoder->decode(absoluteBoundingBox)) + return false; + Owner negativeZOrderListCoder(coder, negativeZOrderList); + if (!decoder->decode(negativeZOrderListCoder)) + return false; + Owner normalFlowListCoder(coder, normalFlowList); + if (!decoder->decode(normalFlowListCoder)) + return false; + Owner positiveZOrderListCoder(coder, positiveZOrderList); + if (!decoder->decode(positiveZOrderListCoder)) + return false; + coder.m_root = WebRenderLayer::create(renderObjectName, elementTagName, elementID, static_pointer_cast<MutableArray>(elementClassNames), + isReflection, isClipping, isClipped, static_cast<WebRenderLayer::CompositingLayerType>(compositingLayerTypeAsUInt32), + absoluteBoundingBox, static_pointer_cast<MutableArray>(negativeZOrderList), static_pointer_cast<MutableArray>(normalFlowList), + static_pointer_cast<MutableArray>(positiveZOrderList)); + break; + } + case APIObject::TypeRenderObject: { + String name; + WebCore::IntPoint absolutePosition; + WebCore::IntRect frameRect; + RefPtr<APIObject> children; + + if (!decoder->decode(name)) + return false; + if (!decoder->decode(absolutePosition)) + return false; + if (!decoder->decode(frameRect)) + return false; + Owner messageCoder(coder, children); + if (!decoder->decode(messageCoder)) + return false; + if (children->type() != APIObject::TypeArray) + return false; + coder.m_root = WebRenderObject::create(name, absolutePosition, frameRect, WTF::static_pointer_cast<MutableArray>(children)); + break; + } case APIObject::TypeURL: { String string; if (!decoder->decode(string)) diff --git a/Source/WebKit2/Shared/WebHitTestResult.h b/Source/WebKit2/Shared/WebHitTestResult.h index 9bf63fca1..d16dcddd4 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.h +++ b/Source/WebKit2/Shared/WebHitTestResult.h @@ -49,6 +49,20 @@ public: String linkLabel; String linkTitle; + Data() + { + } + + explicit Data(const WebCore::HitTestResult& hitTestResult) + : absoluteImageURL(hitTestResult.absoluteImageURL().string()) + , absolutePDFURL(hitTestResult.absolutePDFURL().string()) + , absoluteLinkURL(hitTestResult.absoluteLinkURL().string()) + , absoluteMediaURL(hitTestResult.absoluteMediaURL().string()) + , linkLabel(hitTestResult.textContent()) + , linkTitle(hitTestResult.titleDisplayString()) + { + } + void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, WebHitTestResult::Data&); }; diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.cpp b/Source/WebKit2/Shared/WebLayerTreeInfo.cpp index 164f3c0db..bbf26cd75 100644 --- a/Source/WebKit2/Shared/WebLayerTreeInfo.cpp +++ b/Source/WebKit2/Shared/WebLayerTreeInfo.cpp @@ -19,8 +19,7 @@ #include "config.h" -#if USE(ACCELERATED_COMPOSITING) - +#if USE(UI_SIDE_COMPOSITING) #include "WebLayerTreeInfo.h" #include "Arguments.h" diff --git a/Source/WebKit2/Shared/WebLayerTreeInfo.h b/Source/WebKit2/Shared/WebLayerTreeInfo.h index 54e1cb5ba..723cafd4e 100644 --- a/Source/WebKit2/Shared/WebLayerTreeInfo.h +++ b/Source/WebKit2/Shared/WebLayerTreeInfo.h @@ -20,7 +20,7 @@ #ifndef WebLayerTreeInfo_h #define WebLayerTreeInfo_h -#if USE(ACCELERATED_COMPOSITING) +#if USE(UI_SIDE_COMPOSITING) #include "ArgumentDecoder.h" #include "ArgumentEncoder.h" diff --git a/Source/WebKit2/Shared/WebRenderLayer.cpp b/Source/WebKit2/Shared/WebRenderLayer.cpp new file mode 100644 index 000000000..586f1362e --- /dev/null +++ b/Source/WebKit2/Shared/WebRenderLayer.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2012 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 "WebRenderLayer.h" + +#include "WebPage.h" +#include "WebString.h" +#include <WebCore/Frame.h> +#include <WebCore/FrameLoaderClient.h> +#include <WebCore/RenderLayer.h> +#include <WebCore/RenderLayerBacking.h> +#include <WebCore/RenderView.h> +#include <WebCore/StyledElement.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebRenderLayer> WebRenderLayer::create(WebPage* page) +{ + Frame* mainFrame = page->mainFrame(); + if (!mainFrame) + return 0; + + if (!mainFrame->loader()->client()->hasHTMLView()) + return 0; + + RenderView* contentRenderer = mainFrame->contentRenderer(); + if (!contentRenderer) + return 0; + + RenderLayer* rootLayer = contentRenderer->layer(); + if (!rootLayer) + return 0; + + return adoptRef(new WebRenderLayer(rootLayer)); +} + +PassRefPtr<MutableArray> WebRenderLayer::createArrayFromLayerList(Vector<RenderLayer*>* list) +{ + if (!list || !list->size()) + return 0; + + RefPtr<MutableArray> array = MutableArray::create(); + for (size_t i = 0; i < list->size(); ++i) { + RefPtr<WebRenderLayer> layer = adoptRef(new WebRenderLayer(list->at(i))); + array->append(layer.get()); + } + + return array.release(); +} + +WebRenderLayer::WebRenderLayer(RenderLayer* layer) +{ + RenderBoxModelObject* renderer = layer->renderer(); + + m_renderObjectName = renderer->renderName(); + + if (Node* node = renderer->node()) { + if (node->isElementNode()) { + Element* element = toElement(node); + m_elementTagName = element->tagName(); + m_elementID = element->getIdAttribute(); + if (element->isStyledElement() && element->hasClass()) { + StyledElement* styledElement = static_cast<StyledElement*>(element); + if (size_t classNameCount = styledElement->classNames().size()) { + m_elementClassNames = MutableArray::create(); + for (size_t i = 0; i < classNameCount; ++i) + m_elementClassNames->append(WebString::create(styledElement->classNames()[i]).get()); + } + } + + } + } + + m_isReflection = layer->isReflection(); + +#if USE(ACCELERATED_COMPOSITING) + if (layer->isComposited()) { + RenderLayerBacking* backing = layer->backing(); + m_isClipping = backing->hasClippingLayer(); + m_isClipped = backing->hasAncestorClippingLayer(); + switch (backing->compositingLayerType()) { + case NormalCompositingLayer: + m_compositingLayerType = Normal; + break; + case TiledCompositingLayer: + m_compositingLayerType = Tiled; + break; + case MediaCompositingLayer: + m_compositingLayerType = Media; + break; + case ContainerCompositingLayer: + m_compositingLayerType = Container; + break; + } + } else { +#endif + m_isClipping = false; + m_isClipped = false; + m_compositingLayerType = None; +#if USE(ACCELERATED_COMPOSITING) + } +#endif + + m_absoluteBoundingBox = layer->absoluteBoundingBox(); + + m_negativeZOrderList = createArrayFromLayerList(layer->negZOrderList()); + m_normalFlowList = createArrayFromLayerList(layer->normalFlowList()); + m_positiveZOrderList = createArrayFromLayerList(layer->posZOrderList()); +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebRenderLayer.h b/Source/WebKit2/Shared/WebRenderLayer.h new file mode 100644 index 000000000..f3323bc40 --- /dev/null +++ b/Source/WebKit2/Shared/WebRenderLayer.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2012 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 WebRenderLayer_h +#define WebRenderLayer_h + +#include "APIObject.h" +#include "MutableArray.h" +#include <WebCore/IntRect.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + class RenderLayer; +} + +namespace WebKit { + +class WebPage; + +class WebRenderLayer : public APIObject { +public: + static const Type APIType = TypeRenderLayer; + + enum CompositingLayerType { None, Normal, Tiled, Media, Container }; + + static PassRefPtr<WebRenderLayer> create(WebPage*); + static PassRefPtr<WebRenderLayer> create(const String& renderObjectName, const String& elementTagName, const String& elementID, PassRefPtr<MutableArray> elementClassNames, + bool isReflection, bool isClipping, bool isClipped, CompositingLayerType type, WebCore::IntRect absoluteBoundingBox, + PassRefPtr<MutableArray> negativeZOrderList, PassRefPtr<MutableArray> normalFlowList, PassRefPtr<MutableArray> positiveZOrderList) + { + return adoptRef(new WebRenderLayer(renderObjectName, elementTagName, elementID, elementClassNames, isReflection, isClipping, isClipped, + type, absoluteBoundingBox, negativeZOrderList, normalFlowList, positiveZOrderList)); + } + + ImmutableArray* negativeZOrderList() const { return m_negativeZOrderList.get(); } + ImmutableArray* normalFlowList() const { return m_normalFlowList.get(); } + ImmutableArray* positiveZOrderList() const { return m_positiveZOrderList.get(); } + + const String& renderObjectName() const { return m_renderObjectName; } + const String& elementTagName() const { return m_elementTagName; } + const String& elementID() const { return m_elementID; } + ImmutableArray* elementClassNames() const { return m_elementClassNames.get(); } + bool isReflection() const { return m_isReflection; } + bool isClipping() const { return m_isClipping; } + bool isClipped() const { return m_isClipped; } + CompositingLayerType compositingLayerType() const { return m_compositingLayerType; } + WebCore::IntRect absoluteBoundingBox() const { return m_absoluteBoundingBox; } + +private: + WebRenderLayer(WebCore::RenderLayer*); + WebRenderLayer(const String& renderObjectName, const String& elementTagName, const String& elementID, PassRefPtr<MutableArray> elementClassNames, + bool isReflection, bool isClipping, bool isClipped, CompositingLayerType type, WebCore::IntRect absoluteBoundingBox, + PassRefPtr<MutableArray> negativeZOrderList, PassRefPtr<MutableArray> normalFlowList, PassRefPtr<MutableArray> positiveZOrderList) + : m_renderObjectName(renderObjectName) + , m_elementTagName(elementTagName) + , m_elementID(elementID) + , m_elementClassNames(elementClassNames) + , m_isReflection(isReflection) + , m_isClipping(isClipping) + , m_isClipped(isClipped) + , m_compositingLayerType(type) + , m_absoluteBoundingBox(absoluteBoundingBox) + , m_negativeZOrderList(negativeZOrderList) + , m_normalFlowList(normalFlowList) + , m_positiveZOrderList(positiveZOrderList) + { + } + + virtual Type type() const OVERRIDE { return APIType; } + + static PassRefPtr<MutableArray> createArrayFromLayerList(Vector<WebCore::RenderLayer*>*); + + String m_renderObjectName; + String m_elementTagName; + String m_elementID; + RefPtr<MutableArray> m_elementClassNames; + bool m_isReflection; + bool m_isClipping; + bool m_isClipped; + CompositingLayerType m_compositingLayerType; + WebCore::IntRect m_absoluteBoundingBox; + + RefPtr<MutableArray> m_negativeZOrderList; + RefPtr<MutableArray> m_normalFlowList; + RefPtr<MutableArray> m_positiveZOrderList; +}; + +} // namespace WebKit + +#endif // WebRenderLayer_h diff --git a/Source/WebKit2/Shared/WebRenderObject.cpp b/Source/WebKit2/Shared/WebRenderObject.cpp new file mode 100644 index 000000000..6f3bcffd3 --- /dev/null +++ b/Source/WebKit2/Shared/WebRenderObject.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2012 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 "WebRenderObject.h" + +#include "WebPage.h" +#include <WebCore/Frame.h> +#include <WebCore/FrameLoaderClient.h> +#include <WebCore/RenderText.h> +#include <WebCore/RenderView.h> +#include <WebCore/RenderWidget.h> + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebRenderObject> WebRenderObject::create(WebPage* page) +{ + Frame* mainFrame = page->mainFrame(); + if (!mainFrame) + return 0; + + if (!mainFrame->loader()->client()->hasHTMLView()) + return 0; + + RenderView* contentRenderer = mainFrame->contentRenderer(); + if (!contentRenderer) + return 0; + + return adoptRef(new WebRenderObject(contentRenderer)); +} + +WebRenderObject::WebRenderObject(RenderObject* renderer) +{ + m_name = renderer->renderName(); + + // FIXME: broken with transforms + m_absolutePosition = flooredIntPoint(renderer->localToAbsolute(FloatPoint())); + + if (renderer->isBox()) + m_frameRect = toRenderBox(renderer)->frameRect(); + else if (renderer->isText()) { + m_frameRect = toRenderText(renderer)->linesBoundingBox(); + m_frameRect.setX(toRenderText(renderer)->firstRunX()); + m_frameRect.setY(toRenderText(renderer)->firstRunY()); + } else if (renderer->isRenderInline()) + m_frameRect = toRenderBoxModelObject(renderer)->borderBoundingBox(); + + m_children = MutableArray::create(); + for (RenderObject* coreChild = renderer->firstChild(); coreChild; coreChild = coreChild->nextSibling()) { + RefPtr<WebRenderObject> child = adoptRef(new WebRenderObject(coreChild)); + m_children->append(child.get()); + } + + if (!renderer->isWidget()) + return; + + Widget* widget = toRenderWidget(renderer)->widget(); + if (!widget || !widget->isFrameView()) + return; + + FrameView* frameView = static_cast<FrameView*>(widget); + if (RenderView* coreContentRenderer = frameView->frame()->contentRenderer()) { + RefPtr<WebRenderObject> contentRenderer = adoptRef(new WebRenderObject(coreContentRenderer)); + m_children->append(contentRenderer.get()); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/Shared/WebRenderObject.h b/Source/WebKit2/Shared/WebRenderObject.h new file mode 100644 index 000000000..1fcb03ca1 --- /dev/null +++ b/Source/WebKit2/Shared/WebRenderObject.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2012 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 WebRenderObject_h +#define WebRenderObject_h + +#include "APIObject.h" +#include "MutableArray.h" +#include <WebCore/IntRect.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + class RenderObject; +} + +namespace WebKit { + +class WebPage; + +class WebRenderObject : public APIObject { +public: + static const Type APIType = TypeRenderObject; + + static PassRefPtr<WebRenderObject> create(WebPage*); + static PassRefPtr<WebRenderObject> create(const String& name, WebCore::IntPoint absolutePosition, WebCore::IntRect frameRect, PassRefPtr<MutableArray> children) + { + return adoptRef(new WebRenderObject(name, absolutePosition, frameRect, children)); + } + + RefPtr<ImmutableArray> children() const { return m_children; } + + const String& name() const { return m_name; } + WebCore::IntPoint absolutePosition() const { return m_absolutePosition; } + WebCore::IntRect frameRect() const { return m_frameRect; } + +private: + WebRenderObject(WebCore::RenderObject*); + WebRenderObject(const String& name, WebCore::IntPoint absolutePosition, WebCore::IntRect frameRect, PassRefPtr<MutableArray> children) + : m_children(children) + , m_name(name) + , m_absolutePosition(absolutePosition) + , m_frameRect(frameRect) + { + } + + virtual Type type() const OVERRIDE { return APIType; } + + RefPtr<MutableArray> m_children; + + String m_name; + WebCore::IntPoint m_absolutePosition; + WebCore::IntRect m_frameRect; +}; + +} // namespace WebKit + +#endif // WebRenderObject_h diff --git a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp index 4eaff2c7e..4812602f9 100644 --- a/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp +++ b/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "WebEventFactoryQt.h" -#include <qgraphicssceneevent.h> #include <QApplication> #include <QKeyEvent> #include <QTransform> |