Diff
Modified: trunk/Source/WebKit2/CMakeLists.txt (110084 => 110085)
--- trunk/Source/WebKit2/CMakeLists.txt 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/CMakeLists.txt 2012-03-07 20:23:37 UTC (rev 110085)
@@ -155,6 +155,7 @@
Shared/WebPopupItem.cpp
Shared/WebPreferencesStore.cpp
Shared/WebProcessCreationParameters.cpp
+ Shared/WebRenderObject.cpp
Shared/WebTouchEvent.cpp
Shared/WebURLRequest.cpp
Shared/WebURLResponse.cpp
@@ -173,6 +174,7 @@
Shared/API/c/WKMutableArray.cpp
Shared/API/c/WKMutableDictionary.cpp
Shared/API/c/WKNumber.cpp
+ Shared/API/c/WKRenderObject.cpp
Shared/API/c/WKSecurityOrigin.cpp
Shared/API/c/WKSerializedScriptValue.cpp
Shared/API/c/WKString.cpp
Modified: trunk/Source/WebKit2/ChangeLog (110084 => 110085)
--- trunk/Source/WebKit2/ChangeLog 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/ChangeLog 2012-03-07 20:23:37 UTC (rev 110085)
@@ -1,3 +1,57 @@
+2012-03-07 Dan Bernstein <m...@apple.com>
+
+ <rdar://problem/8494396> WebKit2 lacks API for obtaining a representation of the render tree of a page, like WebRenderNode
+ https://bugs.webkit.org/show_bug.cgi?id=80230
+
+ Reviewed by Beth Dakin.
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+
+ * Shared/API/c/WKBase.h: Added a type definition of WKRenderObjectRef.
+
+ * Shared/API/c/WKRenderObject.cpp: Added.
+ (WKRenderObjectGetTypeID): Added. Returns the WKRenderObject type ID.
+ (WKRenderObjectCopyName): Added this getter wrapper.
+ (WKRenderObjectGetAbsolutePosition): Ditto.
+ (WKRenderObjectGetFrameRect): Ditto.
+ (WKRenderObjectGetChildren): Ditto.
+
+ * Shared/API/c/WKRenderObject.h: Added.
+
+ * Shared/APIObject.h: Added TypeRenderObject to the APIObject::Type enum.
+ * Shared/UserMessageCoders.h:
+ (WebKit::UserMessageEncoder::baseEncode): Added WebRenderObject encoding.
+ (WebKit::UserMessageDecoder::baseDecode): Added WebRenderObject decoding.
+ * Shared/WebRenderObject.cpp: Added.
+ (WebKit::WebRenderObject::create): Added. Creates a WebRenderObject for the page’s main
+ frame content renderer.
+ (WebKit::WebRenderObject::WebRenderObject): Added. Constructs a WebRenderObject with the
+ name, metrics and children of the given RenderObject, following the rules used in WebKit1
+ WebRenderNode. In particular, a RenderWidget representing a frame gets the frame’s content
+ renderer as a child.
+
+ * Shared/WebRenderObject.h: Added.
+ (WebKit::WebRenderObject::create):
+ (WebKit::WebRenderObject::children):
+ (WebKit::WebRenderObject::name):
+ (WebKit::WebRenderObject::absolutePosition):
+ (WebKit::WebRenderObject::frameRect):
+ (WebKit::WebRenderObject::WebRenderObject):
+
+ * Target.pri:
+
+ * UIProcess/API/C/WKAPICast.h: Added a mapping between WKRenderObjectRef and WebRenderObject.
+
+ * WebKit2.xcodeproj/project.pbxproj: Added WebRenderObject.{cpp,h} and WKRenderObject.{cpp.h}.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageCopyRenderTree): Added this bundle API for getting the render tree.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+
+ * win/WebKit2.vcproj:
+
2012-03-07 Kenneth Rohde Christiansen <kenn...@webkit.org>
Pinch zoom acts weirdly on nytimes.com while loading
Modified: trunk/Source/WebKit2/GNUmakefile.am (110084 => 110085)
--- trunk/Source/WebKit2/GNUmakefile.am 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/GNUmakefile.am 2012-03-07 20:23:37 UTC (rev 110085)
@@ -19,6 +19,7 @@
$(WebKit2)/Shared/API/c/WKMutableDictionary.h \
$(WebKit2)/Shared/API/c/WKNumber.h \
$(WebKit2)/Shared/API/c/WKPageLoadTypes.h \
+ $(WebKit2)/Shared/API/c/WKRenderObject.h \
$(WebKit2)/Shared/API/c/WKSecurityOrigin.h \
$(WebKit2)/Shared/API/c/WKSerializedScriptValue.h \
$(WebKit2)/Shared/API/c/WKSerializedScriptValuePrivate.h \
@@ -288,6 +289,8 @@
Source/WebKit2/Shared/API/c/WKNumber.cpp \
Source/WebKit2/Shared/API/c/WKNumber.h \
Source/WebKit2/Shared/API/c/WKPageLoadTypes.h \
+ Source/WebKit2/Shared/API/c/WKRenderObject.cpp \
+ Source/WebKit2/Shared/API/c/WKRenderObject.h \
Source/WebKit2/Shared/API/c/WKSecurityOrigin.cpp \
Source/WebKit2/Shared/API/c/WKSecurityOrigin.h \
Source/WebKit2/Shared/API/c/WKSerializedScriptValue.cpp \
@@ -435,6 +438,8 @@
Source/WebKit2/Shared/WebPreferencesStore.h \
Source/WebKit2/Shared/WebProcessCreationParameters.cpp \
Source/WebKit2/Shared/WebProcessCreationParameters.h \
+ Source/WebKit2/Shared/WebRenderObject.cpp \
+ Source/WebKit2/Shared/WebRenderObject.h \
Source/WebKit2/Shared/WebSecurityOrigin.h \
Source/WebKit2/Shared/WebSerializedScriptValue.h \
Source/WebKit2/Shared/WebString.h \
Modified: trunk/Source/WebKit2/Shared/API/c/WKBase.h (110084 => 110085)
--- trunk/Source/WebKit2/Shared/API/c/WKBase.h 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/Shared/API/c/WKBase.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -59,6 +59,7 @@
typedef const struct OpaqueWKImage* WKImageRef;
typedef const struct OpaqueWKPointRef* WKPointRef;
typedef const struct OpaqueWKRectRef* WKRectRef;
+typedef const struct OpaqueWKRenderObject* WKRenderObjectRef;
typedef const struct OpaqueWKSecurityOrigin* WKSecurityOriginRef;
typedef const struct OpaqueWKSerializedScriptValue* WKSerializedScriptValueRef;
typedef const struct OpaqueWKSizeRef* WKSizeRef;
Added: trunk/Source/WebKit2/Shared/API/c/WKRenderObject.cpp (0 => 110085)
--- trunk/Source/WebKit2/Shared/API/c/WKRenderObject.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/WKRenderObject.cpp 2012-03-07 20:23:37 UTC (rev 110085)
@@ -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());
+}
Added: trunk/Source/WebKit2/Shared/API/c/WKRenderObject.h (0 => 110085)
--- trunk/Source/WebKit2/Shared/API/c/WKRenderObject.h (rev 0)
+++ trunk/Source/WebKit2/Shared/API/c/WKRenderObject.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -0,0 +1,47 @@
+/*
+ * 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 WKRenderObject_h
+#define WKRenderObject_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKGeometry.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKRenderObjectGetTypeID();
+
+WK_EXPORT WKStringRef WKRenderObjectCopyName(WKRenderObjectRef renderObject);
+WK_EXPORT WKPoint WKRenderObjectGetAbsolutePosition(WKRenderObjectRef renderObject);
+WK_EXPORT WKRect WKRenderObjectGetFrameRect(WKRenderObjectRef renderObject);
+WK_EXPORT WKArrayRef WKRenderObjectGetChildren(WKRenderObjectRef renderObject);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKRenderObject_h
Modified: trunk/Source/WebKit2/Shared/APIObject.h (110084 => 110085)
--- trunk/Source/WebKit2/Shared/APIObject.h 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/Shared/APIObject.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -48,6 +48,7 @@
TypeGraphicsContext,
TypeImage,
TypeProtectionSpace,
+ TypeRenderObject,
TypeSecurityOrigin,
TypeSerializedScriptValue,
TypeString,
Modified: trunk/Source/WebKit2/Shared/UserMessageCoders.h (110084 => 110085)
--- trunk/Source/WebKit2/Shared/UserMessageCoders.h 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/Shared/UserMessageCoders.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -38,6 +38,7 @@
#include "WebGeometry.h"
#include "WebImage.h"
#include "WebNumber.h"
+#include "WebRenderObject.h"
#include "WebSerializedScriptValue.h"
#include "WebString.h"
#include "WebURL.h"
@@ -56,6 +57,7 @@
// - WebData -> WebData
// - WebDouble -> WebDouble
// - WebImage -> WebImage
+// - WebRenderObject -> WebRenderObject
// - WebUInt64 -> WebUInt64
// - WebURL -> WebURL
// - WebURLRequest -> WebURLRequest
@@ -139,6 +141,14 @@
encoder->encode(rectObject->rect().size.height);
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 +348,26 @@
coder.m_root = WebRect::create(WKRectMake(x, y, width, height));
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))
Added: trunk/Source/WebKit2/Shared/WebRenderObject.cpp (0 => 110085)
--- trunk/Source/WebKit2/Shared/WebRenderObject.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/WebRenderObject.cpp 2012-03-07 20:23:37 UTC (rev 110085)
@@ -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
Added: trunk/Source/WebKit2/Shared/WebRenderObject.h (0 => 110085)
--- trunk/Source/WebKit2/Shared/WebRenderObject.h (rev 0)
+++ trunk/Source/WebKit2/Shared/WebRenderObject.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -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
Modified: trunk/Source/WebKit2/Target.pri (110084 => 110085)
--- trunk/Source/WebKit2/Target.pri 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/Target.pri 2012-03-07 20:23:37 UTC (rev 110085)
@@ -49,6 +49,7 @@
Shared/API/c/WKMutableDictionary.h \
Shared/API/c/WKNumber.h \
Shared/API/c/WKPageLoadTypes.h \
+ Shared/API/c/WKRenderObject.h \
Shared/API/c/WKSecurityOrigin.h \
Shared/API/c/WKSerializedScriptValue.h \
Shared/API/c/WKSharedAPICast.h \
@@ -112,6 +113,7 @@
Shared/WebPopupItem.h \
Shared/WebPreferencesStore.h \
Shared/WebProcessCreationParameters.h \
+ Shared/WebRenderObject.h \
Shared/WebURLRequest.h \
Shared/WebURLResponse.h \
Shared/WebUserContentURLPattern.h \
@@ -393,6 +395,7 @@
Shared/API/c/WKImage.cpp \
Shared/API/c/WKMutableDictionary.cpp \
Shared/API/c/WKNumber.cpp \
+ Shared/API/c/WKRenderObject.cpp \
Shared/API/c/WKSecurityOrigin.cpp \
Shared/API/c/WKSerializedScriptValue.cpp \
Shared/API/c/WKString.cpp \
@@ -455,6 +458,7 @@
Shared/WebPopupItem.cpp \
Shared/WebPreferencesStore.cpp \
Shared/WebProcessCreationParameters.cpp \
+ Shared/WebRenderObject.cpp \
Shared/WebTouchEvent.cpp \
Shared/WebURLRequest.cpp \
Shared/WebURLResponse.cpp \
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (110084 => 110085)
--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -83,6 +83,7 @@
class WebPluginSiteDataManager;
class WebPreferences;
class WebProtectionSpace;
+class WebRenderObject;
class WebTextChecker;
WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy)
@@ -119,6 +120,7 @@
WK_ADD_API_MAPPING(WKPluginSiteDataManagerRef, WebPluginSiteDataManager)
WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
+WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject)
WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
#if ENABLE(INSPECTOR)
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (110084 => 110085)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2012-03-07 20:23:37 UTC (rev 110085)
@@ -315,6 +315,10 @@
33D3A3CA1339617900709BE4 /* WebMediaCacheManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33D3A3C61339617900709BE4 /* WebMediaCacheManagerProxyMessageReceiver.cpp */; };
33D3A3CB1339617900709BE4 /* WebMediaCacheManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 33D3A3C71339617900709BE4 /* WebMediaCacheManagerProxyMessages.h */; };
33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */; };
+ 3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3760881C150413E900FC82C7 /* WebRenderObject.cpp */; };
+ 3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760881D150413E900FC82C7 /* WebRenderObject.h */; };
+ 37608822150414F700FC82C7 /* WKRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37608820150414F700FC82C7 /* WKRenderObject.cpp */; };
+ 37608823150414F700FC82C7 /* WKRenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 37608821150414F700FC82C7 /* WKRenderObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
3788A05C14743C90006319E5 /* WKBrowsingContextControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3788A05B14743C90006319E5 /* WKBrowsingContextControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
37C4E9F6131C6E7E0029BD5A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = B396EA5512E0ED2D00F4FEB7 /* config.h */; };
37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1325,6 +1329,10 @@
33D3A3C61339617900709BE4 /* WebMediaCacheManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMediaCacheManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
33D3A3C71339617900709BE4 /* WebMediaCacheManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMediaCacheManagerProxyMessages.h; sourceTree = "<group>"; };
33F9D5B81312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = WebResourceCacheManagerCFNet.cpp; path = ResourceCache/cf/WebResourceCacheManagerCFNet.cpp; sourceTree = "<group>"; };
+ 3760881C150413E900FC82C7 /* WebRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebRenderObject.cpp; sourceTree = "<group>"; };
+ 3760881D150413E900FC82C7 /* WebRenderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebRenderObject.h; sourceTree = "<group>"; };
+ 37608820150414F700FC82C7 /* WKRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKRenderObject.cpp; sourceTree = "<group>"; };
+ 37608821150414F700FC82C7 /* WKRenderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRenderObject.h; sourceTree = "<group>"; };
3788A05B14743C90006319E5 /* WKBrowsingContextControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextControllerPrivate.h; sourceTree = "<group>"; };
37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
510031F61379CACB00C8DFE4 /* WebProcessShim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = WebProcessShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -2415,6 +2423,8 @@
BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */,
BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */,
BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */,
+ 3760881C150413E900FC82C7 /* WebRenderObject.cpp */,
+ 3760881D150413E900FC82C7 /* WebRenderObject.h */,
F634445512A885C8000612D8 /* WebSecurityOrigin.h */,
A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */,
BCF04C8E11FF9F6E00F86A58 /* WebString.h */,
@@ -3491,6 +3501,8 @@
BC4075E5124FF0270068F20A /* WKNumber.cpp */,
BC4075E6124FF0270068F20A /* WKNumber.h */,
BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */,
+ 37608820150414F700FC82C7 /* WKRenderObject.cpp */,
+ 37608821150414F700FC82C7 /* WKRenderObject.h */,
F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */,
F634445B12A885E9000612D8 /* WKSecurityOrigin.h */,
BC4075E7124FF0270068F20A /* WKSerializedScriptValue.cpp */,
@@ -4151,6 +4163,8 @@
E17BF99614D0A73E00A5A069 /* NetscapeSandboxFunctions.h in Headers */,
BCE0937814FB128C001138D9 /* LayerHostingContext.h in Headers */,
296BD85D15019BC30071F424 /* StringUtilities.h in Headers */,
+ 3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
+ 37608823150414F700FC82C7 /* WKRenderObject.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -4891,6 +4905,8 @@
E17BF99814D0AA8300A5A069 /* NetscapeSandboxFunctions.mm in Sources */,
BCE0937714FB128C001138D9 /* LayerHostingContext.mm in Sources */,
296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */,
+ 3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */,
+ 37608822150414F700FC82C7 /* WKRenderObject.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (110084 => 110085)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2012-03-07 20:23:37 UTC (rev 110085)
@@ -34,6 +34,7 @@
#include "WebFullScreenManager.h"
#include "WebImage.h"
#include "WebPage.h"
+#include "WebRenderObject.h"
#include "WebURL.h"
#include "WebURLRequest.h"
@@ -328,6 +329,11 @@
return toImpl(pageRef)->renderTreeSize();
}
+WKRenderObjectRef WKBundlePageCopyRenderTree(WKBundlePageRef pageRef)
+{
+ return toAPI(WebRenderObject::create(toImpl(pageRef)).leakRef());
+}
+
void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold)
{
toImpl(page)->setPaintedObjectsCounterThreshold(threshold);
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (110084 => 110085)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h 2012-03-07 20:23:37 UTC (rev 110085)
@@ -55,6 +55,8 @@
WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page);
+WK_EXPORT WKRenderObjectRef WKBundlePageCopyRenderTree(WKBundlePageRef page);
+
// FIXME: This is temporary. Ultimately WebKit should choose the threshold itself.
WK_EXPORT void WKBundlePageSetPaintedObjectsCounterThreshold(WKBundlePageRef page, uint64_t threshold);
Modified: trunk/Source/WebKit2/win/WebKit2.vcproj (110084 => 110085)
--- trunk/Source/WebKit2/win/WebKit2.vcproj 2012-03-07 20:10:31 UTC (rev 110084)
+++ trunk/Source/WebKit2/win/WebKit2.vcproj 2012-03-07 20:23:37 UTC (rev 110085)
@@ -787,6 +787,14 @@
>
</File>
<File
+ RelativePath="..\Shared\WebRenderObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Shared\WebRenderObject.h"
+ >
+ </File>
+ <File
RelativePath="..\Shared\WebSecurityOrigin.h"
>
</File>
@@ -970,6 +978,14 @@
>
</File>
<File
+ RelativePath="..\Shared\API\c\WKRenderObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Shared\API\c\WKRenderObject.h"
+ >
+ </File>
+ <File
RelativePath="..\Shared\API\c\WKSecurityOrigin.cpp"
>
</File>