Changeset 120274 in webkit
- Timestamp:
- Jun 13, 2012 9:08:17 PM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r120270 r120274 1 2012-06-13 Hironori Bono <hbono@chromium.org> 2 3 [chromium] Add WebFrame::replaceMisspelledRange 4 https://bugs.webkit.org/show_bug.cgi?id=88618 5 6 Reviewed by Kent Tamura. 7 8 This change adds WebFrame::replaceMisspelledRange, which replaces the range of a 9 misspelled marker with text so Chromium can use it for replacing misspelled 10 words with suggetions. 11 12 * public/WebFrame.h: 13 (WebFrame): 14 * src/WebFrameImpl.cpp: 15 (WebKit::WebFrameImpl::replaceMisspelledRange): 16 (WebKit): 17 * src/WebFrameImpl.h: 18 (WebFrameImpl): 19 1 20 2012-06-13 Xianzhu Wang <wangxianzhu@chromium.org> 2 21 -
trunk/Source/WebKit/chromium/public/WebFrame.h
r119666 r120274 435 435 virtual bool isContinuousSpellCheckingEnabled() const = 0; 436 436 virtual void requestTextChecking(const WebElement&) = 0; 437 virtual void replaceMisspelledRange(const WebString&) = 0; 437 438 438 439 // Selection ----------------------------------------------------------- -
trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp
r120219 r120274 1345 1345 } 1346 1346 1347 void WebFrameImpl::replaceMisspelledRange(const WebString& text) 1348 { 1349 // If this caret selection has two or more markers, this function replace the range covered by the first marker with the specified word as Microsoft Word does. 1350 if (pluginContainerFromFrame(frame())) 1351 return; 1352 RefPtr<Range> caretRange = frame()->selection()->toNormalizedRange(); 1353 if (!caretRange) 1354 return; 1355 Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInRange(caretRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar); 1356 if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset()) 1357 return; 1358 RefPtr<Range> markerRange = TextIterator::rangeFromLocationAndLength(frame()->selection()->rootEditableElementOrDocumentElement(), markers[0]->startOffset(), markers[0]->endOffset() - markers[0]->startOffset()); 1359 if (!markerRange.get() || !frame()->selection()->shouldChangeSelection(markerRange.get())) 1360 return; 1361 frame()->selection()->setSelection(markerRange.get(), CharacterGranularity); 1362 frame()->editor()->replaceSelectionWithText(text, false, true); 1363 } 1364 1347 1365 bool WebFrameImpl::hasSelection() const 1348 1366 { -
trunk/Source/WebKit/chromium/src/WebFrameImpl.h
r119508 r120274 172 172 virtual bool isContinuousSpellCheckingEnabled() const; 173 173 virtual void requestTextChecking(const WebElement&); 174 virtual void replaceMisspelledRange(const WebString&); 174 175 virtual bool hasSelection() const; 175 176 virtual WebRange selectionRange() const;
Note: See TracChangeset
for help on using the changeset viewer.