Changeset 87823 in webkit
- Timestamp:
- Jun 1, 2011 10:41:25 AM (13 years ago)
- Location:
- trunk/Source/WebKit/gtk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/gtk/ChangeLog
r87766 r87823 1 2011-06-01 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Utility methods for UA spellchecking 6 https://bugs.webkit.org/show_bug.cgi?id=61788 7 8 Adds a couple of utility methods needed to implement some aspects 9 of spell checking support in a browser. 10 11 * webkit/webkitwebframe.cpp: 12 (webkit_web_frame_replace_selection): method to replace the current 13 selection with a string of text. 14 (webkit_web_frame_get_range_for_word_around_caret): returns the DOM 15 range for the word where the caret/selection currently is. 16 * webkit/webkitwebframe.h: declare new methods. 17 1 18 2011-05-31 Martin Robinson <mrobinson@igalia.com> 2 19 -
trunk/Source/WebKit/gtk/webkit/webkitwebframe.cpp
r82962 r87823 32 32 #include "AnimationController.h" 33 33 #include "DOMObjectCache.h" 34 #include "DocumentFragment.h" 34 35 #include "DocumentLoader.h" 35 36 #include "DocumentLoaderGtk.h" 36 37 #include "FrameLoader.h" 37 38 #include "FrameLoaderClientGtk.h" 39 #include "FrameSelection.h" 38 40 #include "FrameTree.h" 39 41 #include "FrameView.h" … … 50 52 #include "RenderTreeAsText.h" 51 53 #include "RenderView.h" 54 #include "ReplaceSelectionCommand.h" 52 55 #include "ScriptController.h" 53 56 #include "SubstituteData.h" 57 #include "TextIterator.h" 58 #include "markup.h" 59 #include "webkit/WebKitDOMRangePrivate.h" 54 60 #include "webkitenumtypes.h" 55 61 #include "webkitglobalsprivate.h" … … 975 981 } 976 982 983 /** 984 * webkit_web_frame_replace_selection: 985 * @frame: a #WebKitWeFrame 986 * @text: the text to insert in place of the current selection 987 * 988 * Replaces the current selection in @frame, if any, with @text. 989 * 990 * Since: 1.5.1 991 **/ 992 void webkit_web_frame_replace_selection(WebKitWebFrame* frame, const char* text) 993 { 994 Frame* coreFrame = core(frame); 995 RefPtr<DocumentFragment> fragment = createFragmentFromText( 996 coreFrame->selection()->toNormalizedRange().get(), text); 997 applyCommand(ReplaceSelectionCommand::create(coreFrame->document(), fragment.get(), 998 ReplaceSelectionCommand::SmartReplace | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting)); 999 } 1000 1001 /** 1002 * webkit_web_frame_get_range_for_word_around_caret: 1003 * @frame: a #WebKitWebFrame 1004 * 1005 * Returns a #WebKitDOMRange for the word where the caret is currently 1006 * positioned. 1007 * 1008 * Returns: a #WebKitDOMRange spanning the word where the caret 1009 * currently is positioned. If there is no caret %NULL will be 1010 * returned. 1011 * 1012 * Since: 1.5.1. 1013 **/ 1014 WebKitDOMRange* webkit_web_frame_get_range_for_word_around_caret(WebKitWebFrame* frame) 1015 { 1016 g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); 1017 1018 Frame* coreFrame = core(frame); 1019 FrameSelection* selection = coreFrame->selection(); 1020 if (selection->isNone() || selection->isRange()) 1021 return 0; 1022 VisibleSelection visibleSelection(selection->selection().visibleStart()); 1023 visibleSelection.expandUsingGranularity(WordGranularity); 1024 1025 return kit(visibleSelection.firstRange().get()); 1026 } 1027 977 1028 namespace WebKit { 978 1029 -
trunk/Source/WebKit/gtk/webkit/webkitwebframe.h
r51825 r87823 28 28 29 29 #include <webkit/webkitdefines.h> 30 #include <webkit/webkitdomdefines.h> 30 31 #include <webkit/webkitnetworkrequest.h> 31 32 #include <webkit/webkitwebdatasource.h> … … 176 177 webkit_web_frame_get_network_response (WebKitWebFrame *frame); 177 178 179 WEBKIT_API void 180 webkit_web_frame_replace_selection (WebKitWebFrame *frame, 181 const char *text); 182 183 WEBKIT_API WebKitDOMRange* 184 webkit_web_frame_get_range_for_word_around_caret (WebKitWebFrame *frame); 185 178 186 G_END_DECLS 179 187
Note: See TracChangeset
for help on using the changeset viewer.