[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

tonikitoo at webkit.org tonikitoo at webkit.org
Wed Dec 22 17:59:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 35911715bcdda940793b77f680604122d8c2cfc6
Author: tonikitoo at webkit.org <tonikitoo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 4 05:27:44 2010 +0000

    [GTK+] Populate DumpRenderTreeSupportGtk
    https://bugs.webkit.org/show_bug.cgi?id=48429
    
    Reviewed by Martin Robinson.
    Patch by Antonio Gomes <agomes at rim.com>
    
    WebKit/gtk:
    
    Moved most of the webkit_web_frame* methods defined as private APIs in webkitprivate.h
    to DumpRenderTreeSupportGtk, as static class methods. These methods had
    not gone throught the formal API review process and were only being used by DRT for now.
    
    The essence of each original method name were kept. For example
    webkit_web_frame_get_children(...) was renamed to DumpRenderTreeSupportGtk::getFrameChildren(...),
    and so on.
    
    Also some of the method bodies were changed to return non-glib types (gchar* -> CString).
    
    * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
    (DumpRenderTreeSupportGtk::getFrameChildren):
    (DumpRenderTreeSupportGtk::getInnerText):
    (DumpRenderTreeSupportGtk::dumpRenderTree):
    (DumpRenderTreeSupportGtk::counterValueForElementById):
    (DumpRenderTreeSupportGtk::pageNumberForElementById):
    (DumpRenderTreeSupportGtk::numberOfPagesForFrame):
    (DumpRenderTreeSupportGtk::getPendingUnloadEventCount):
    (DumpRenderTreeSupportGtk::pauseAnimation):
    (DumpRenderTreeSupportGtk::pauseTransition):
    (DumpRenderTreeSupportGtk::pauseSvgAnimation):
    (DumpRenderTreeSupportGtk::markerTextForListItem):
    (DumpRenderTreeSupportGtk::numberOfActiveAnimations):
    (DumpRenderTreeSupportGtk::suspendAnimations):
    (DumpRenderTreeSupportGtk::resumeAnimations):
    (DumpRenderTreeSupportGtk::clearMainFrameName):
    (DumpRenderTreeSupportGtk::getFocusedAccessibleElement):
    * WebCoreSupport/DumpRenderTreeSupportGtk.h:
    * webkit/webkitprivate.h:
    * webkit/webkitwebframe.cpp:
    
    WebKitTools:
    
    Made the previous calls to webkit_web_frame* functions defined as private
    APIs in webkitprivate.h go through DRTSupportGtk.
    
    * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
    (AccessibilityController::focusedElement):
    * DumpRenderTree/gtk/DumpRenderTree.cpp:
    (dumpFramesAsText):
    (resetDefaultsToConsistentValues):
    (dump):
    (webViewDocumentLoadFinished):
    * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
    (LayoutTestController::counterValueForElementById):
    (LayoutTestController::pageNumberForElementById):
    (LayoutTestController::numberOfPages):
    (LayoutTestController::pauseAnimationAtTimeOnElementWithId):
    (LayoutTestController::pauseTransitionAtTimeOnElementWithId):
    (LayoutTestController::sampleSVGAnimationForElementAtTime):
    (LayoutTestController::numberOfActiveAnimations):
    (LayoutTestController::suspendAnimations):
    (LayoutTestController::resumeAnimations):
    (LayoutTestController::markerTextForListItem):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73325 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 74613de..cb2a0b1 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,41 @@
+2010-11-08  Antonio Gomes  <agomes at rim.com>
+
+        Reviewed by Martin Robinson.
+
+        [Gtk] Populate DumpRenderTreeSupportGtk
+        https://bugs.webkit.org/show_bug.cgi?id=48429
+
+        Moved most of the webkit_web_frame* methods defined as private APIs in webkitprivate.h
+        to DumpRenderTreeSupportGtk, as static class methods. These methods had
+        not gone throught the formal API review process and were only being used by DRT for now.
+
+        The essence of each original method name were kept. For example
+        webkit_web_frame_get_children(...) was renamed to DumpRenderTreeSupportGtk::getFrameChildren(...),
+        and so on.
+
+        Also some of the method bodies were changed to return non-glib types (gchar* -> CString).
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::getFrameChildren):
+        (DumpRenderTreeSupportGtk::getInnerText):
+        (DumpRenderTreeSupportGtk::dumpRenderTree):
+        (DumpRenderTreeSupportGtk::counterValueForElementById):
+        (DumpRenderTreeSupportGtk::pageNumberForElementById):
+        (DumpRenderTreeSupportGtk::numberOfPagesForFrame):
+        (DumpRenderTreeSupportGtk::getPendingUnloadEventCount):
+        (DumpRenderTreeSupportGtk::pauseAnimation):
+        (DumpRenderTreeSupportGtk::pauseTransition):
+        (DumpRenderTreeSupportGtk::pauseSvgAnimation):
+        (DumpRenderTreeSupportGtk::markerTextForListItem):
+        (DumpRenderTreeSupportGtk::numberOfActiveAnimations):
+        (DumpRenderTreeSupportGtk::suspendAnimations):
+        (DumpRenderTreeSupportGtk::resumeAnimations):
+        (DumpRenderTreeSupportGtk::clearMainFrameName):
+        (DumpRenderTreeSupportGtk::getFocusedAccessibleElement):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
+        * webkit/webkitprivate.h:
+        * webkit/webkitwebframe.cpp:
+
 2010-12-02  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
index f237e9d..863ceb9 100644
--- a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
@@ -19,18 +19,37 @@
 #include "config.h"
 #include "DumpRenderTreeSupportGtk.h"
 
+#include "AccessibilityObjectWrapperAtk.h"
+#include "AnimationController.h"
 #include "APICast.h"
+#include "AXObjectCache.h"
 #include "Document.h"
+#include "FrameLoaderClientGtk.h"
+#include "FrameView.h"
+#include "FrameTree.h"
+#include "GraphicsContext.h"
 #include "JSDocument.h"
+#include "JSElement.h"
 #include "JSLock.h"
 #include "JSNodeList.h"
 #include "JSValue.h"
 #include "NodeList.h"
+#include "PlatformString.h"
+#include "PrintContext.h"
+#include "RenderListItem.h"
+#include "RenderView.h"
+#include "RenderTreeAsText.h"
+#if ENABLE(SVG)
+#include "SVGSMILElement.h"
+#endif
 #include "webkitprivate.h"
 #include "webkitwebview.h"
+#include "webkitwebframe.h"
+#include <JavaScriptCore/APICast.h>
 
 using namespace JSC;
 using namespace WebCore;
+using namespace WebKit;
 
 bool DumpRenderTreeSupportGtk::s_drtRun = false;
 bool DumpRenderTreeSupportGtk::s_linksIncludedInTabChain = true;
@@ -77,3 +96,255 @@ JSValueRef DumpRenderTreeSupportGtk::nodesFromRect(JSContextRef context, JSValue
     RefPtr<NodeList> nodes = document->nodesFromRect(x, y, top, right, bottom, left, ignoreClipping);
     return toRef(exec, toJS(exec, jsDocument->globalObject(), nodes.get()));
 }
+
+/**
+ * getFrameChildren:
+ * @frame: a #WebKitWebFrame
+ *
+ * Return value: child frames of @frame
+ */
+GSList* DumpRenderTreeSupportGtk::getFrameChildren(WebKitWebFrame* frame)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return 0;
+
+    GSList* children = 0;
+    for (Frame* child = coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+        FrameLoader* loader = child->loader();
+        WebKit::FrameLoaderClient* client = static_cast<WebKit::FrameLoaderClient*>(loader->client());
+        if (client)
+          children = g_slist_append(children, client->webFrame());
+    }
+
+    return children;
+}
+
+/**
+ * getInnerText:
+ * @frame: a #WebKitWebFrame
+ *
+ * Return value: inner text of @frame
+ */
+CString DumpRenderTreeSupportGtk::getInnerText(WebKitWebFrame* frame)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), CString(""));
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return CString("");
+
+    FrameView* view = coreFrame->view();
+
+    if (view && view->layoutPending())
+        view->layout();
+
+    Element* documentElement = coreFrame->document()->documentElement();
+    return documentElement->innerText().utf8();
+}
+
+/**
+ * dumpRenderTree:
+ * @frame: a #WebKitWebFrame
+ *
+ * Return value: Non-recursive render tree dump of @frame
+ */
+CString DumpRenderTreeSupportGtk::dumpRenderTree(WebKitWebFrame* frame)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), CString(""));
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return CString("");
+
+    FrameView* view = coreFrame->view();
+
+    if (view && view->layoutPending())
+        view->layout();
+
+    return externalRepresentation(coreFrame).utf8();
+}
+
+/**
+ * counterValueForElementById:
+ * @frame: a #WebKitWebFrame
+ * @id: an element ID string
+ *
+ * Return value: The counter value of element @id in @frame
+ */
+CString DumpRenderTreeSupportGtk::counterValueForElementById(WebKitWebFrame* frame, const char* id)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), CString());
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return CString();
+
+    Element* coreElement = coreFrame->document()->getElementById(AtomicString(id));
+    if (!coreElement)
+        return CString();
+
+    return counterValueForElement(coreElement).utf8();
+}
+
+/**
+ * numberForElementById
+ * @frame: a #WebKitWebFrame
+ * @id: an element ID string
+ * @pageWidth: width of a page
+ * @pageHeight: height of a page
+ *
+ * Return value: The number of page where the specified element will be put
+ */
+int DumpRenderTreeSupportGtk::pageNumberForElementById(WebKitWebFrame* frame, const char* id, float pageWidth, float pageHeight)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return -1;
+
+    Element* coreElement = coreFrame->document()->getElementById(AtomicString(id));
+    if (!coreElement)
+        return -1;
+    return PrintContext::pageNumberForElement(coreElement, FloatSize(pageWidth, pageHeight));
+}
+
+/**
+ * numberOfPagesForFrame
+ * @frame: a #WebKitWebFrame
+ * @pageWidth: width of a page
+ * @pageHeight: height of a page
+ *
+ * Return value: The number of pages to be printed.
+ */
+int DumpRenderTreeSupportGtk::numberOfPagesForFrame(WebKitWebFrame* frame, float pageWidth, float pageHeight)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
+
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return -1;
+
+    return PrintContext::numberOfPages(coreFrame, FloatSize(pageWidth, pageHeight));
+}
+
+/**
+ * getPendingUnloadEventCount:
+ * @frame: a #WebKitWebFrame
+ *
+ * Return value: number of pending unload events
+ */
+guint DumpRenderTreeSupportGtk::getPendingUnloadEventCount(WebKitWebFrame* frame)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
+
+    return core(frame)->domWindow()->pendingUnloadEventListeners();
+}
+
+bool DumpRenderTreeSupportGtk::pauseAnimation(WebKitWebFrame* frame, const char* name, double time, const char* element)
+{
+    ASSERT(core(frame));
+    Element* coreElement = core(frame)->document()->getElementById(AtomicString(element));
+    if (!coreElement || !coreElement->renderer())
+        return false;
+    return core(frame)->animation()->pauseAnimationAtTime(coreElement->renderer(), AtomicString(name), time);
+}
+
+bool DumpRenderTreeSupportGtk::pauseTransition(WebKitWebFrame* frame, const char* name, double time, const char* element)
+{
+    ASSERT(core(frame));
+    Element* coreElement = core(frame)->document()->getElementById(AtomicString(element));
+    if (!coreElement || !coreElement->renderer())
+        return false;
+    return core(frame)->animation()->pauseTransitionAtTime(coreElement->renderer(), AtomicString(name), time);
+}
+
+bool DumpRenderTreeSupportGtk::pauseSVGAnimation(WebKitWebFrame* frame, const char* animationId, double time, const char* elementId)
+{
+    ASSERT(core(frame));
+#if ENABLE(SVG)
+    Document* document = core(frame)->document();
+    if (!document || !document->svgExtensions())
+        return false;
+    Element* coreElement = document->getElementById(AtomicString(animationId));
+    if (!coreElement || !SVGSMILElement::isSMILElement(coreElement))
+        return false;
+    return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreElement), time);
+#else
+    return false;
+#endif
+}
+
+CString DumpRenderTreeSupportGtk::markerTextForListItem(WebKitWebFrame* frame, JSContextRef context, JSValueRef nodeObject)
+{
+    JSC::ExecState* exec = toJS(context);
+    Element* element = toElement(toJS(exec, nodeObject));
+    if (!element)
+        return CString();
+
+    return WebCore::markerTextForListItem(element).utf8();
+}
+
+unsigned int DumpRenderTreeSupportGtk::numberOfActiveAnimations(WebKitWebFrame* frame)
+{
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return 0;
+
+    return coreFrame->animation()->numberOfActiveAnimations();
+}
+
+void DumpRenderTreeSupportGtk::suspendAnimations(WebKitWebFrame* frame)
+{
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return;
+
+    return coreFrame->animation()->suspendAnimations();
+}
+
+void DumpRenderTreeSupportGtk::resumeAnimations(WebKitWebFrame* frame)
+{
+    Frame* coreFrame = core(frame);
+    if (!coreFrame)
+        return;
+
+    return coreFrame->animation()->resumeAnimations();
+}
+
+void DumpRenderTreeSupportGtk::clearMainFrameName(WebKitWebFrame* frame)
+{
+    g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame));
+
+    core(frame)->tree()->clearName();
+}
+
+AtkObject* DumpRenderTreeSupportGtk::getFocusedAccessibleElement(WebKitWebFrame* frame)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
+
+#if HAVE(ACCESSIBILITY)
+    if (!AXObjectCache::accessibilityEnabled())
+        AXObjectCache::enableAccessibility();
+
+    WebKitWebFramePrivate* priv = frame->priv;
+    if (!priv->coreFrame || !priv->coreFrame->document())
+        return 0;
+
+    RenderView* root = toRenderView(priv->coreFrame->document()->renderer());
+    if (!root)
+        return 0;
+
+    AtkObject* wrapper =  priv->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
+    if (!wrapper)
+        return 0;
+
+    return webkit_accessible_get_focused_element(WEBKIT_ACCESSIBLE(wrapper));
+#else
+    return 0;
+#endif
+}
+
diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
index 17e9f6d..2a4994d 100644
--- a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
+++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
@@ -19,8 +19,15 @@
 #ifndef DumpRenderTreeSupportGtk_h
 #define DumpRenderTreeSupportGtk_h
 
+
 #include "JSStringRef.h"
 
+#include <atk/atk.h>
+#include <glib.h>
+#include <webkit/webkitdefines.h>
+#include <webkit/webkitwebframe.h>
+#include <wtf/text/CString.h>
+
 class DumpRenderTreeSupportGtk {
 
 public:
@@ -34,6 +41,24 @@ public:
     static bool linksIncludedInFocusChain();
     static JSValueRef nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping);
 
+    // FIXME: Move these to webkitwebframe.h once their API has been discussed.
+    static GSList* getFrameChildren(WebKitWebFrame* frame);
+    static WTF::CString getInnerText(WebKitWebFrame* frame);
+    static WTF::CString dumpRenderTree(WebKitWebFrame* frame);
+    static WTF::CString counterValueForElementById(WebKitWebFrame* frame, const char* id);
+    static int pageNumberForElementById(WebKitWebFrame* frame, const char* id, float pageWidth, float pageHeight);
+    static int numberOfPagesForFrame(WebKitWebFrame* frame, float pageWidth, float pageHeight);
+    static guint getPendingUnloadEventCount(WebKitWebFrame* frame);
+    static bool pauseAnimation(WebKitWebFrame* frame, const char* name, double time, const char* element);
+    static bool pauseTransition(WebKitWebFrame* frame, const char* name, double time, const char* element);
+    static bool pauseSVGAnimation(WebKitWebFrame* frame, const char* animationId, double time, const char* elementId);
+    static WTF::CString markerTextForListItem(WebKitWebFrame* frame, JSContextRef context, JSValueRef nodeObject);
+    static unsigned int numberOfActiveAnimations(WebKitWebFrame* frame);
+    static void suspendAnimations(WebKitWebFrame* frame);
+    static void resumeAnimations(WebKitWebFrame* frame);
+    static void clearMainFrameName(WebKitWebFrame* frame);
+    static AtkObject* getFocusedAccessibleElement(WebKitWebFrame* frame);
+
 private:
     static bool s_drtRun;
     static bool s_linksIncludedInTabChain;
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index e090ed4..c7e71e6 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -338,54 +338,6 @@ extern "C" {
 
     // FIXME: Move these to webkitwebframe.h once their API has been discussed.
 
-    WEBKIT_API GSList*
-    webkit_web_frame_get_children (WebKitWebFrame* frame);
-
-    WEBKIT_API gchar*
-    webkit_web_frame_get_inner_text (WebKitWebFrame* frame);
-
-    WEBKIT_API gchar*
-    webkit_web_frame_dump_render_tree (WebKitWebFrame* frame);
-
-    WEBKIT_API gchar*
-    webkit_web_frame_counter_value_for_element_by_id (WebKitWebFrame* frame, const gchar* id);
-
-    WEBKIT_API int
-    webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
-
-    WEBKIT_API int
-    webkit_web_frame_number_of_pages(WebKitWebFrame* frame, float pageWidth, float pageHeight);
-
-    WEBKIT_API guint
-    webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
-
-    WEBKIT_API bool
-    webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-
-    WEBKIT_API bool
-    webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-
-    WEBKIT_API bool
-    webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId);
-
-    WEBKIT_API gchar*
-    webkit_web_frame_marker_text_for_list_item(WebKitWebFrame* frame, JSContextRef context, JSValueRef nodeObject);
-
-    WEBKIT_API unsigned int
-    webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
-
-    WEBKIT_API void
-    webkit_web_frame_suspend_animations(WebKitWebFrame* frame);
-
-    WEBKIT_API void
-    webkit_web_frame_resume_animations(WebKitWebFrame* frame);
-
-    WEBKIT_API void
-    webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame);
-
-    WEBKIT_API AtkObject*
-    webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame);
-
     WEBKIT_API gchar*
     webkit_web_view_get_selected_text (WebKitWebView* web_view);
 
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index 0e0c3c6..ed10e48 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -742,155 +742,6 @@ WebKitWebDataSource* webkit_web_frame_get_provisional_data_source(WebKitWebFrame
     return webkit_web_frame_get_data_source_from_core_loader(coreFrame->loader()->provisionalDocumentLoader());
 }
 
-/**
- * webkit_web_frame_get_children:
- * @frame: a #WebKitWebFrame
- *
- * Return value: child frames of @frame
- */
-GSList* webkit_web_frame_get_children(WebKitWebFrame* frame)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
-
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return NULL;
-
-    GSList* children = NULL;
-    for (Frame* child = coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
-        FrameLoader* loader = child->loader();
-        WebKit::FrameLoaderClient* client = static_cast<WebKit::FrameLoaderClient*>(loader->client());
-        if (client)
-          children = g_slist_append(children, client->webFrame());
-    }
-
-    return children;
-}
-
-/**
- * webkit_web_frame_get_inner_text:
- * @frame: a #WebKitWebFrame
- *
- * Return value: inner text of @frame
- */
-gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
-
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return g_strdup("");
-
-    FrameView* view = coreFrame->view();
-
-    if (view && view->layoutPending())
-        view->layout();
-
-    Element* documentElement = coreFrame->document()->documentElement();
-    String string =  documentElement->innerText();
-    return g_strdup(string.utf8().data());
-}
-
-/**
- * webkit_web_frame_dump_render_tree:
- * @frame: a #WebKitWebFrame
- *
- * Return value: Non-recursive render tree dump of @frame
- */
-gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
-
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return g_strdup("");
-
-    FrameView* view = coreFrame->view();
-
-    if (view && view->layoutPending())
-        view->layout();
-
-    String string = externalRepresentation(coreFrame);
-    return g_strdup(string.utf8().data());
-}
-
-/**
- * webkit_web_frame_counter_value_for_element_by_id:
- * @frame: a #WebKitWebFrame
- * @id: an element ID string
- *
- * Return value: The counter value of element @id in @frame
- */
-gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
-
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return 0;
-
-    Element* coreElement = coreFrame->document()->getElementById(AtomicString(id));
-    if (!coreElement)
-        return 0;
-    String counterValue = counterValueForElement(coreElement);
-    return g_strdup(counterValue.utf8().data());
-}
-
-/**
- * webkit_web_frame_page_number_for_element_by_id
- * @frame: a #WebKitWebFrame
- * @id: an element ID string
- * @pageWidth: width of a page
- * @pageHeight: height of a page
- *
- * Return value: The number of page where the specified element will be put
- */
-int webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
-
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return -1;
-
-    Element* coreElement = coreFrame->document()->getElementById(AtomicString(id));
-    if (!coreElement)
-        return -1;
-    return PrintContext::pageNumberForElement(coreElement, FloatSize(pageWidth, pageHeight));
-}
-
-/**
- * webkit_web_frame_number_of_pages
- * @frame: a #WebKitWebFrame
- * @pageWidth: width of a page
- * @pageHeight: height of a page
- *
- * Return value: The number of pages to be printed.
- */
-int webkit_web_frame_number_of_pages(WebKitWebFrame* frame, float pageWidth, float pageHeight)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
-
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return -1;
-
-    return PrintContext::numberOfPages(coreFrame, FloatSize(pageWidth, pageHeight));
-}
-
-/**
- * webkit_web_frame_get_pending_unload_event_count:
- * @frame: a #WebKitWebFrame
- *
- * Return value: number of pending unload events
- */
-guint webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
-
-    return core(frame)->domWindow()->pendingUnloadEventListeners();
-}
-
 static void begin_print_callback(GtkPrintOperation* op, GtkPrintContext* context, gpointer user_data)
 {
     PrintContext* printContext = reinterpret_cast<PrintContext*>(user_data);
@@ -1001,81 +852,6 @@ void webkit_web_frame_print(WebKitWebFrame* frame)
     }
 }
 
-bool webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element)
-{
-    ASSERT(core(frame));
-    Element* coreElement = core(frame)->document()->getElementById(AtomicString(element));
-    if (!coreElement || !coreElement->renderer())
-        return false;
-    return core(frame)->animation()->pauseAnimationAtTime(coreElement->renderer(), AtomicString(name), time);
-}
-
-bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element)
-{
-    ASSERT(core(frame));
-    Element* coreElement = core(frame)->document()->getElementById(AtomicString(element));
-    if (!coreElement || !coreElement->renderer())
-        return false;
-    return core(frame)->animation()->pauseTransitionAtTime(coreElement->renderer(), AtomicString(name), time);
-}
-
-bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId)
-{
-    ASSERT(core(frame));
-#if ENABLE(SVG)
-    Document* document = core(frame)->document();
-    if (!document || !document->svgExtensions())
-        return false;
-    Element* coreElement = document->getElementById(AtomicString(animationId));
-    if (!coreElement || !SVGSMILElement::isSMILElement(coreElement))
-        return false;
-    return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreElement), time);
-#else
-    return false;
-#endif
-}
-
-gchar* webkit_web_frame_marker_text_for_list_item(WebKitWebFrame* frame, JSContextRef context, JSValueRef nodeObject)
-{
-    JSC::ExecState* exec = toJS(context);
-    Element* element = toElement(toJS(exec, nodeObject));
-    if (!element)
-        return 0;
-
-    return g_strdup(markerTextForListItem(element).utf8().data());
-}
-
-unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
-{
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return 0;
-
-    AnimationController* controller = coreFrame->animation();
-    if (!controller)
-        return 0;
-
-    return controller->numberOfActiveAnimations();
-}
-
-void webkit_web_frame_suspend_animations(WebKitWebFrame* frame)
-{
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return;
-
-    coreFrame->animation()->suspendAnimations();
-}
-
-void webkit_web_frame_resume_animations(WebKitWebFrame* frame)
-{
-    Frame* coreFrame = core(frame);
-    if (!coreFrame)
-        return;
-
-    coreFrame->animation()->resumeAnimations();
-}
-
 gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame)
 {
     Frame* coreFrame = core(frame);
@@ -1100,13 +876,6 @@ WebKitLoadStatus webkit_web_frame_get_load_status(WebKitWebFrame* frame)
     return priv->loadStatus;
 }
 
-void webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame)
-{
-    g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame));
-
-    core(frame)->tree()->clearName();
-}
-
 void webkit_gc_collect_javascript_objects()
 {
     gcController().garbageCollectNow();
@@ -1124,32 +893,6 @@ gsize webkit_gc_count_javascript_objects()
 
 }
 
-AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame)
-{
-    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
-
-#if HAVE(ACCESSIBILITY)
-    if (!AXObjectCache::accessibilityEnabled())
-        AXObjectCache::enableAccessibility();
-
-    WebKitWebFramePrivate* priv = frame->priv;
-    if (!priv->coreFrame || !priv->coreFrame->document())
-        return NULL;
-
-    RenderView* root = toRenderView(priv->coreFrame->document()->renderer());
-    if (!root)
-        return NULL;
-
-    AtkObject* wrapper =  priv->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
-    if (!wrapper)
-        return NULL;
-
-    return webkit_accessible_get_focused_element(WEBKIT_ACCESSIBLE(wrapper));
-#else
-    return NULL;
-#endif
-}
-
 GtkPolicyType webkit_web_frame_get_horizontal_scrollbar_policy(WebKitWebFrame* frame)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), GTK_POLICY_AUTOMATIC);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f35a4ea..f5c7de9 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,32 @@
+2010-11-08  Antonio Gomes  <agomes at rim.com>
+
+        Reviewed by Martin Robinson.
+
+        [Gtk] Populate DumpRenderTreeSupportGtk
+        https://bugs.webkit.org/show_bug.cgi?id=48429
+
+        Made the previous calls to webkit_web_frame* functions defined as private
+        APIs in webkitprivate.h go through DRTSupportGtk.
+
+        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
+        (AccessibilityController::focusedElement):
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (dumpFramesAsText):
+        (resetDefaultsToConsistentValues):
+        (dump):
+        (webViewDocumentLoadFinished):
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::counterValueForElementById):
+        (LayoutTestController::pageNumberForElementById):
+        (LayoutTestController::numberOfPages):
+        (LayoutTestController::pauseAnimationAtTimeOnElementWithId):
+        (LayoutTestController::pauseTransitionAtTimeOnElementWithId):
+        (LayoutTestController::sampleSVGAnimationForElementAtTime):
+        (LayoutTestController::numberOfActiveAnimations):
+        (LayoutTestController::suspendAnimations):
+        (LayoutTestController::resumeAnimations):
+        (LayoutTestController::markerTextForListItem):
+
 2010-12-03  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
index ab9f021..589e53c 100644
--- a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
@@ -29,15 +29,12 @@
 
 #include "AccessibilityUIElement.h"
 #include "DumpRenderTree.h"
+#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
 
 #include <atk/atk.h>
 #include <gtk/gtk.h>
 #include <webkit/webkit.h>
 
-extern "C" {
-extern AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame*);
-}
-
 AccessibilityController::AccessibilityController()
 {
 }
@@ -54,7 +51,7 @@ AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
 
 AccessibilityUIElement AccessibilityController::focusedElement()
 {
-    AtkObject* accessible =  webkit_web_frame_get_focused_accessible_element(mainFrame);
+    AtkObject* accessible =  DumpRenderTreeSupportGtk::getFocusedAccessibleElement(mainFrame);
     if (!accessible)
         return 0;
 
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index a1fcbc8..beb79fe 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -63,13 +63,9 @@ extern "C" {
 extern G_CONST_RETURN gchar* webkit_web_history_item_get_target(WebKitWebHistoryItem*);
 extern gboolean webkit_web_history_item_is_target_item(WebKitWebHistoryItem*);
 extern GList* webkit_web_history_item_get_children(WebKitWebHistoryItem*);
-extern GSList* webkit_web_frame_get_children(WebKitWebFrame* frame);
-extern gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame);
-extern gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame);
-extern guint webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame);
 extern void webkit_web_settings_add_extra_plugin_directory(WebKitWebView* view, const gchar* directory);
 extern gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame);
-extern void webkit_web_frame_clear_main_frame_name(WebKitWebFrame* frame);
+extern void webkit_web_view_set_group_name(WebKitWebView* view, const gchar* groupName);
 extern void webkit_reset_origin_access_white_lists();
 }
 
@@ -251,17 +247,16 @@ static gchar* dumpFramesAsText(WebKitWebFrame* frame)
     // Add header for all but the main frame.
     bool isMainFrame = (webkit_web_view_get_main_frame(webView) == frame);
 
-    gchar* innerText = webkit_web_frame_get_inner_text(frame);
+    CString innerText = DumpRenderTreeSupportGtk::getInnerText(frame);
     if (isMainFrame)
-        result = g_strdup_printf("%s\n", innerText);
+        result = g_strdup_printf("%s\n", innerText.data());
     else {
         const gchar* frameName = webkit_web_frame_get_name(frame);
-        result = g_strdup_printf("\n--------\nFrame: '%s'\n--------\n%s\n", frameName, innerText);
+        result = g_strdup_printf("\n--------\nFrame: '%s'\n--------\n%s\n", frameName, innerText.data());
     }
-    g_free(innerText);
 
     if (gLayoutTestController->dumpChildFramesAsText()) {
-        GSList* children = webkit_web_frame_get_children(frame);
+        GSList* children = DumpRenderTreeSupportGtk::getFrameChildren(frame);
         for (GSList* child = children; child; child = g_slist_next(child))
             appendString(result, dumpFramesAsText(static_cast<WebKitWebFrame* >(child->data)));
         g_slist_free(children);
@@ -420,7 +415,7 @@ static void resetDefaultsToConsistentValues()
                  "editing-behavior", WEBKIT_EDITING_BEHAVIOR_MAC,
                  NULL);
 
-    webkit_web_frame_clear_main_frame_name(mainFrame);
+    DumpRenderTreeSupportGtk::clearMainFrameName(mainFrame);
 
     WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
     g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL);
@@ -517,7 +512,7 @@ void dump()
             while (gtk_events_pending())
                 gtk_main_iteration();
 
-            result = webkit_web_frame_dump_render_tree(mainFrame);
+            result = g_strdup(DumpRenderTreeSupportGtk::dumpRenderTree(mainFrame).data());
         }
 
         if (!result) {
@@ -745,7 +740,7 @@ static void webViewDocumentLoadFinished(WebKitWebView* view, WebKitWebFrame* fra
         printf("%s - didFinishDocumentLoadForFrame\n", frameName);
         g_free(frameName);
     } else if (!done) {
-        guint pendingFrameUnloadEvents = webkit_web_frame_get_pending_unload_event_count(frame);
+        guint pendingFrameUnloadEvents = DumpRenderTreeSupportGtk::getPendingUnloadEventCount(frame);
         if (pendingFrameUnloadEvents) {
             char* frameName = getFrameNameSuitableForTestResult(view, frame);
             printf("%s - has %u onunload handler(s)\n", frameName, pendingFrameUnloadEvents);
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 4ad7833..7d61c60 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -49,20 +49,10 @@
 #include <wtf/gobject/GOwnPtr.h>
 
 extern "C" {
-bool webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
-unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
-void webkit_web_frame_suspend_animations(WebKitWebFrame* frame);
-void webkit_web_frame_resume_animations(WebKitWebFrame* frame);
 void webkit_application_cache_set_maximum_size(unsigned long long size);
 unsigned int webkit_worker_thread_count(void);
 void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
-gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id);
-int webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight);
-int webkit_web_frame_number_of_pages(WebKitWebFrame* frame, float pageWidth, float pageHeight);
 void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
-gchar* webkit_web_frame_marker_text_for_list_item(WebKitWebFrame* frame, JSContextRef context, JSValueRef nodeObject);
 void webkit_web_view_execute_core_command_by_name(WebKitWebView* webView, const gchar* name, const gchar* value);
 gboolean webkit_web_view_is_command_enabled(WebKitWebView* webView, const gchar* name);
 }
@@ -119,11 +109,11 @@ void LayoutTestController::display()
 JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
 {
     gchar* idGChar = JSStringCopyUTF8CString(id);
-    gchar* counterValueGChar = webkit_web_frame_counter_value_for_element_by_id(mainFrame, idGChar);
+    CString counterValueGChar = DumpRenderTreeSupportGtk::counterValueForElementById(mainFrame, idGChar);
     g_free(idGChar);
-    if (!counterValueGChar)
+    if (counterValueGChar.isNull())
         return 0;
-    JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueGChar));
+    JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueGChar.data()));
     return counterValue;
 }
 
@@ -153,14 +143,14 @@ JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
 int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidth, float pageHeight)
 {
     gchar* idGChar = JSStringCopyUTF8CString(id);
-    int pageNumber = webkit_web_frame_page_number_for_element_by_id(mainFrame, idGChar, pageWidth, pageHeight);
+    int pageNumber = DumpRenderTreeSupportGtk::pageNumberForElementById(mainFrame, idGChar, pageWidth, pageHeight);
     g_free(idGChar);
     return pageNumber;
 }
 
 int LayoutTestController::numberOfPages(float pageWidth, float pageHeight)
 {
-    return webkit_web_frame_number_of_pages(mainFrame, pageWidth, pageHeight);
+    return DumpRenderTreeSupportGtk::numberOfPagesForFrame(mainFrame, pageWidth, pageHeight);
 }
 
 JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
@@ -627,7 +617,7 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima
 {    
     gchar* name = JSStringCopyUTF8CString(animationName);
     gchar* element = JSStringCopyUTF8CString(elementId);
-    bool returnValue = webkit_web_frame_pause_animation(mainFrame, name, time, element);
+    bool returnValue = DumpRenderTreeSupportGtk::pauseAnimation(mainFrame, name, time, element);
     g_free(name);
     g_free(element);
     return returnValue;
@@ -637,7 +627,7 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop
 {    
     gchar* name = JSStringCopyUTF8CString(propertyName);
     gchar* element = JSStringCopyUTF8CString(elementId);
-    bool returnValue = webkit_web_frame_pause_transition(mainFrame, name, time, element);
+    bool returnValue = DumpRenderTreeSupportGtk::pauseTransition(mainFrame, name, time, element);
     g_free(name);
     g_free(element);
     return returnValue;
@@ -647,7 +637,7 @@ bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animat
 {    
     gchar* name = JSStringCopyUTF8CString(animationId);
     gchar* element = JSStringCopyUTF8CString(elementId);
-    bool returnValue = webkit_web_frame_pause_svg_animation(mainFrame, name, time, element);
+    bool returnValue = DumpRenderTreeSupportGtk::pauseSVGAnimation(mainFrame, name, time, element);
     g_free(name);
     g_free(element);
     return returnValue;
@@ -655,17 +645,17 @@ bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animat
 
 unsigned LayoutTestController::numberOfActiveAnimations() const
 {
-    return webkit_web_frame_number_of_active_animations(mainFrame);
+    return DumpRenderTreeSupportGtk::numberOfActiveAnimations(mainFrame);
 }
 
 void LayoutTestController::suspendAnimations() const
 {
-    webkit_web_frame_suspend_animations(mainFrame);
+    DumpRenderTreeSupportGtk::suspendAnimations(mainFrame);
 }
 
 void LayoutTestController::resumeAnimations() const
 {
-    webkit_web_frame_resume_animations(mainFrame);
+    DumpRenderTreeSupportGtk::resumeAnimations(mainFrame);
 }
 
 void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value)
@@ -798,12 +788,11 @@ void LayoutTestController::setWebViewEditable(bool)
 
 JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
 {
-    gchar* markerTextGChar = webkit_web_frame_marker_text_for_list_item(mainFrame, context, nodeObject);
-    if (!markerTextGChar)
+    CString markerTextGChar = DumpRenderTreeSupportGtk::markerTextForListItem(mainFrame, context, nodeObject);
+    if (markerTextGChar.isNull())
         return 0;
 
-    JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(markerTextGChar));
-    g_free(markerTextGChar);
+    JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(markerTextGChar.data()));
     return markerText;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list