#endif
}
-static bool
-xwidget_is_web_view (struct xwidget *xw)
-{
-#ifdef USE_GTK
- return xw->widget_osr != NULL && WEBKIT_IS_WEB_VIEW (xw->widget_osr);
-#elif defined NS_IMPL_COCOA
- return nsxwidget_is_web_view (xw);
-#endif
-}
+#define CHECK_WEBKIT_WIDGET(xw) \
+ if (NILP (xw->buffer) || !EQ (xw->type, Qwebkit)) \
+ error ("Not a WebKit widget")
/* Macro that checks xwidget hold webkit web view first. */
#define WEBKIT_FN_INIT() \
CHECK_LIVE_XWIDGET (xwidget); \
struct xwidget *xw = XXWIDGET (xwidget); \
- if (!xwidget_is_web_view (xw)) \
- { \
- fputs ("ERROR xw->widget_osr does not hold a webkit instance\n", \
- stdout); \
- return Qnil; \
- }
+ CHECK_WEBKIT_WIDGET (xw)
DEFUN ("xwidget-webkit-uri",
Fxwidget_webkit_uri, Sxwidget_webkit_uri,
#ifdef USE_GTK
xw = XXWIDGET (xwidget);
+ CHECK_WEBKIT_WIDGET (xw);
+
webview = WEBKIT_WEB_VIEW (xw->widget_osr);
query = ENCODE_UTF_8 (query);
opt = WEBKIT_FIND_OPTIONS_NONE;
CHECK_LIVE_XWIDGET (xwidget);
xw = XXWIDGET (xwidget);
+ CHECK_WEBKIT_WIDGET (xw);
if (!xw->find_text)
error ("Widget has no ongoing search operation");
CHECK_LIVE_XWIDGET (xwidget);
xw = XXWIDGET (xwidget);
+ CHECK_WEBKIT_WIDGET (xw);
if (!xw->find_text)
error ("Widget has no ongoing search operation");
CHECK_LIVE_XWIDGET (xwidget);
xw = XXWIDGET (xwidget);
+ CHECK_WEBKIT_WIDGET (xw);
if (!xw->find_text)
error ("Widget has no ongoing search operation");
base_uri = ENCODE_UTF_8 (base_uri);
text = ENCODE_UTF_8 (text);
xw = XXWIDGET (xwidget);
+ CHECK_WEBKIT_WIDGET (xw);
data = SSDATA (text);
uri = SSDATA (base_uri);