I attached a patch where the function
webkit_web_frame_click_element_by_id(WebKitWebFrame *frame, char *id)
does exactly what you want.

Greets,
Luka

Dne 12.11.2008 (sre) ob 11:58 +0100 je Deshpande, Raghavendra
zapisal(a):
> Hi All,
> 
>  
> 
>     In Gtk-Webkit browser,  we are facing issues with respect to
> accessing DOM elements directly, without using getElementById() from
> inside javascripts. We have many XHTML pages written already, without
> using getElementById() and all the pages are perfectly working fine in
> Opera. 
> 
>  
> 
> As “Chrome” is built using webkit, I tried testing the pages on
> ‘Chrome’. To my surprise, the same files worked fine in ‘Chrome’.
> 
>  
> 
> Then, I tried with Safari, (latest nightly updated), the behavior is
> same as Gtk-Webkit. It throws, “Can’t  find variable: DOM element
> name”
> 
>  
> 
> Have any of you faced such an issue?, Is there any fix for it?
> 
> As we can’t change the pages now, Is there any temporary hack?
> 
>  
> 
> Warm Regards,
> 
> Raghavendra
> 
>  
> 
>  
> 
> 
> 
> 
> ______________________________________________________________________
> The information contained in this message may be confidential and
> legally protected under applicable law. The message is intended solely
> for the addressee(s). If you are not the intended recipient, you are
> hereby notified that any use, forwarding, dissemination, or
> reproduction of this message is strictly prohibited and may be
> unlawful. If you are not the intended recipient, please contact the
> sender by return e-mail and destroy all copies of the original
> message.
> _______________________________________________
> webkit-dev mailing list
> [email protected]
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
diff -uNr WebKit/WebCore/rendering/RenderObject.cpp WebKit-visionect/WebCore/rendering/RenderObject.cpp
--- WebKit/WebCore/rendering/RenderObject.cpp	2008-10-16 14:22:22.527094396 +0200
+++ WebKit-visionect/WebCore/rendering/RenderObject.cpp	2008-10-16 15:26:07.683098259 +0200
@@ -65,6 +65,8 @@
 #include <stdio.h>
 #include <wtf/RefCountedLeakCounter.h>
 
+#include <gtk/gtk.h>
+
 using namespace std;
 
 namespace WebCore {
@@ -1836,6 +1838,13 @@
     if (view->printing())
         return; // Don't repaint if we're printing.
     view->repaintViewRectangle(absoluteClippedOverflowRect(), immediate);
+
+	FrameView *frame;
+	GtkWidget *widget;
+	frame = view->frameView();
+
+	widget = frame->hostWindow()->platformWindow();
+	g_signal_emit_by_name(G_OBJECT(widget), "update-requested");
 }
 
 void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
diff -uNr WebKit/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp WebKit-visionect/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
--- WebKit/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2008-10-16 14:21:44.423171151 +0200
+++ WebKit-visionect/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2008-10-16 15:04:06.491589320 +0200
@@ -265,14 +265,14 @@
         return;
 
     GdkRectangle rect = windowRect;
-    GdkWindow* window = GTK_WIDGET(m_webView)->window;
+    //GdkWindow* window = GTK_WIDGET(m_webView)->window;
 
-    if (window) {
+    //if (window) {
         // No double buffer.  Just always assume we need to invalidate.
-        gdk_window_invalidate_rect(window, &rect, true);
-        if (immediate)
-            gdk_window_process_updates(window, true);
-    }
+        //gdk_window_invalidate_rect(window, &rect, true);
+        //if (immediate)
+        //    gdk_window_process_updates(window, true);
+    //}
 }
 
 void ChromeClient::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect& clipRect)
diff -uNr WebKit/WebKit/gtk/webkit/webkitwebframe.cpp WebKit-visionect/WebKit/gtk/webkit/webkitwebframe.cpp
--- WebKit/WebKit/gtk/webkit/webkitwebframe.cpp	2008-10-16 14:21:44.679089223 +0200
+++ WebKit-visionect/WebKit/gtk/webkit/webkitwebframe.cpp	2008-10-16 15:01:21.351880925 +0200
@@ -72,6 +72,61 @@
 
 G_DEFINE_TYPE(WebKitWebFrame, webkit_web_frame, G_TYPE_OBJECT)
 
+/* 
+ * Luka Napotnik <[EMAIL PROTECTED]>
+ *
+ * Added support to force rendering frames on a cairo surface.
+ * From clutter code:
+ * (http://svn.o-hand.com/view/clutter/trunk/clutter-webkit/webkit-frame-show-cairo.patch?rev=2031&view=markup)
+ */
+
+void webkit_web_frame_show(WebKitWebFrame* frame, cairo_t* cr)
+{
+    g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame));
+    g_return_if_fail(cr);
+
+    Frame* m_frame = core(frame);
+
+    double x1, y1, x2, y2;
+
+    GraphicsContext ctx(cr);
+    cairo_fill_extents(cr, &x1, &y1, &x2, &y2);
+    IntRect pageRect = IntRect(x1, y1, x2 - x1, y2 - y1);
+    ctx.save();
+    ctx.clip(pageRect);
+    if (m_frame->contentRenderer()) {
+        m_frame->view()->layoutIfNeededRecursive();
+        m_frame->view()->paint(&ctx, pageRect);
+    }
+    ctx.restore();
+    cairo_new_path(cr);
+}
+
+/*
+ * Luka Napotnik <[EMAIL PROTECTED]>
+ *
+ * Find a HTML element and create a click event on it.
+ * Returns TRUE on success, otherwise returns FALSE
+ */
+gboolean webkit_web_frame_click_element_by_id(WebKitWebFrame *frame, char *id)
+{
+	AtomicString element_id = id;
+	HTMLElement *html_element;
+
+	Frame* m_frame = core(frame);
+	Document *document = m_frame->document();
+	Element *element = document->getElementById(element_id);
+	
+	if (element == 0)
+		return FALSE;
+
+	html_element = static_cast <HTMLElement *> (element);
+	html_element->click();
+
+	return TRUE;
+}
+
+
 static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
 {
     WebKitWebFrame* frame = WEBKIT_WEB_FRAME(object);
diff -uNr WebKit/WebKit/gtk/webkit/webkitwebframe.h WebKit-visionect/WebKit/gtk/webkit/webkitwebframe.h
--- WebKit/WebKit/gtk/webkit/webkitwebframe.h	2008-10-16 14:21:44.679089223 +0200
+++ WebKit-visionect/WebKit/gtk/webkit/webkitwebframe.h	2008-10-16 15:01:48.359090121 +0200
@@ -26,6 +26,7 @@
 
 #include <webkit/webkitdefines.h>
 #include <webkit/webkitnetworkrequest.h>
+#include <cairo.h>
 
 G_BEGIN_DECLS
 
@@ -58,6 +59,13 @@
 WEBKIT_API GType
 webkit_web_frame_get_type           (void);
 
+WEBKIT_API void
+webkit_web_frame_show(WebKitWebFrame* frame, cairo_t* cr);
+
+WEBKIT_API gboolean
+webkit_web_frame_click_element_by_id(WebKitWebFrame *frame, char *id);
+
+
 WEBKIT_API WebKitWebFrame *
 webkit_web_frame_new                (WebKitWebView        *web_view);
 
diff -uNr WebKit/WebKit/gtk/webkit/webkitwebview.cpp WebKit-visionect/WebKit/gtk/webkit/webkitwebview.cpp
--- WebKit/WebKit/gtk/webkit/webkitwebview.cpp	2008-10-16 14:21:44.683111750 +0200
+++ WebKit-visionect/WebKit/gtk/webkit/webkitwebview.cpp	2008-10-16 15:02:42.143090529 +0200
@@ -90,6 +90,7 @@
     COPY_CLIPBOARD,
     PASTE_CLIPBOARD,
     CUT_CLIPBOARD,
+    UPDATE_REQUESTED,
     LAST_SIGNAL
 };
 
@@ -1107,6 +1108,22 @@
             g_cclosure_marshal_VOID__VOID,
             G_TYPE_NONE, 0);
 
+    /**
+     * WebKitWebView::update-requested:
+     * @web_view: the object which received the signal
+     *
+     * The ::update-requested signal is emitted whenever the Web view
+     * GdkWindow needs to be updated.
+     */
+
+	webkit_web_view_signals[UPDATE_REQUESTED] = g_signal_new("update-requested",
+            G_TYPE_FROM_CLASS(webViewClass),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            G_STRUCT_OFFSET(WebKitWebViewClass, update_requested),
+            NULL, NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
+
     /*
      * implementations of virtual methods
      */
diff -uNr WebKit/WebKit/gtk/webkit/webkitwebview.h WebKit-visionect/WebKit/gtk/webkit/webkitwebview.h
--- WebKit/WebKit/gtk/webkit/webkitwebview.h	2008-10-16 14:21:44.699100956 +0200
+++ WebKit-visionect/WebKit/gtk/webkit/webkitwebview.h	2008-10-16 15:02:57.723089981 +0200
@@ -102,6 +102,7 @@
     void                       (* cut_clipboard)          (WebKitWebView        *web_view);
     void                       (* copy_clipboard)         (WebKitWebView        *web_view);
     void                       (* paste_clipboard)        (WebKitWebView        *web_view);
+    void                       (* update_requested)       (WebKitWebView        *web_view);
 
     /*
      * internal

Attachment: signature.asc
Description: To je digitalno podpisan del sporočila

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to