diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp index 1edcdc6..8a7676b 100644 --- a/WebCore/editing/Editor.cpp +++ b/WebCore/editing/Editor.cpp @@ -220,6 +220,14 @@ bool Editor::isSelectTrailingWhitespaceEnabled() return client() && client()->isSelectTrailingWhitespaceEnabled(); } +int Editor::numEnclosedBlockquotes() +{ + SelectionController* sel = m_frame->selection(); + Position start = sel->selection().start(); + + return WebCore::numEnclosingMailBlockquotes(start); +} + bool Editor::deleteWithDirection(SelectionController::EDirection direction, TextGranularity granularity, bool killRing, bool isTypingAction) { if (!canEdit()) diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h index 2f67723..dc6a7b9 100644 --- a/WebCore/editing/Editor.h +++ b/WebCore/editing/Editor.h @@ -269,6 +269,7 @@ public: PassRefPtr nextVisibleRange(Range*, const String&, bool forward, bool caseFlag, bool wrapFlag); void addToKillRing(Range*, bool prepend); + int numEnclosedBlockquotes (); private: Frame* m_frame; OwnPtr m_deleteButtonController; diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index e2b10b6..51e824c 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -429,6 +429,38 @@ void webkit_web_frame_load_string(WebKitWebFrame* frame, const gchar* content, c coreFrame->loader()->load(ResourceRequest(url), substituteData, false); } +/* + * Get HTML Document String + */ +char *webkit_web_frame_get_string(WebKitWebFrame* frame) +{ + Frame* coreFrame = core(frame); + String foo = coreFrame->document()->body()->outerHTML(); + return g_strdup(foo.utf8().data()); +} + +/* + * Insert new line into the webkit editor quoted data + */ +gboolean +webkit_web_frame_is_cursor_at_blockquote (WebKitWebFrame *frame) +{ + Frame* coreFrame = core(frame); + + return coreFrame->editor()->numEnclosedBlockquotes() != 0; +} + +/* + * Insert new line into the webkit editor quoted data + */ +void +webkit_web_frame_break_quote (WebKitWebFrame *frame) +{ + Frame* coreFrame = core(frame); + + coreFrame->editor()->command("InsertNewlineInQuotedContent").execute(); +} + /** * webkit_web_frame_load_request: * @frame: a #WebKitWebFrame @@ -610,6 +642,15 @@ gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame) return g_strdup(string.utf8().data()); } +int +webkit_web_frame_get_height (WebKitWebFrame *frame) +{ + Frame* coreFrame = core(frame); + FrameView* view = coreFrame->view(); + + return view->contentsHeight(); +} + #if GTK_CHECK_VERSION(2,10,0) static void begin_print(GtkPrintOperation* op, GtkPrintContext* context, gpointer user_data) diff --git a/WebKit/gtk/webkit/webkitwebframe.h b/WebKit/gtk/webkit/webkitwebframe.h index 7e24565..4328c0e 100644 --- a/WebKit/gtk/webkit/webkitwebframe.h +++ b/WebKit/gtk/webkit/webkitwebframe.h @@ -84,6 +84,12 @@ WEBKIT_API void webkit_web_frame_load_uri (WebKitWebFrame *frame, const gchar *uri); +WEBKIT_API gchar * +webkit_web_frame_get_string (WebKitWebFrame *frame); +WEBKIT_API gboolean +webkit_web_frame_is_cursor_at_blockquote (WebKitWebFrame *frame); +WEBKIT_API void +webkit_web_frame_break_quote (WebKitWebFrame *frame); WEBKIT_API void webkit_web_frame_load_string (WebKitWebFrame *frame, const gchar *content, @@ -107,7 +113,8 @@ webkit_web_frame_find_frame (WebKitWebFrame *frame, WEBKIT_API JSGlobalContextRef webkit_web_frame_get_global_context (WebKitWebFrame *frame); - +WEBKIT_API int +webkit_web_frame_get_height (WebKitWebFrame *frame); G_END_DECLS #endif