https://bugs.webkit.org/show_bug.cgi?id=73971
Patch by Shinya Kawanaka <shinyak@google.com> on 2012-01-20
Reviewed by Darin Fisher.
This interface is necessary to recheck spelling of an arbitrary element.
* public/WebFrame.h:
* public/WebNode.h:
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::requestTextChecking):
Requests spellchecking for the element having current selection.
* src/WebFrameImpl.h:
* src/WebNode.cpp:
(WebKit::WebNode::rootEditableElement):
Takes a root editable element from Node.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105489
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-20 Shinya Kawanaka <shinyak@google.com>
+
+ [chromium] WebFrame should have an interface to invoke spellchecking in arbitrarily.
+ https://bugs.webkit.org/show_bug.cgi?id=73971
+
+ Reviewed by Darin Fisher.
+
+ This interface is necessary to recheck spelling of an arbitrary element.
+
+ * public/WebFrame.h:
+ * public/WebNode.h:
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::requestTextChecking):
+ Requests spellchecking for the element having current selection.
+ * src/WebFrameImpl.h:
+ * src/WebNode.cpp:
+ (WebKit::WebNode::rootEditableElement):
+ Takes a root editable element from Node.
+
2012-01-19 Kinuko Yasuda <kinuko@chromium.org>
Cleanup: make constant variable names in fileapi/ conform to WebKit's coding guideline
// Spell-checking support.
virtual void enableContinuousSpellChecking(bool) = 0;
virtual bool isContinuousSpellCheckingEnabled() const = 0;
-
+ virtual void requestTextChecking(const WebElement&) = 0;
// Selection -----------------------------------------------------------
class WebDOMEventListener;
class WebDOMEventListenerPrivate;
class WebDocument;
+class WebElement;
class WebFrame;
class WebNodeList;
WEBKIT_EXPORT bool dispatchEvent(const WebDOMEvent&);
WEBKIT_EXPORT void simulateClick();
WEBKIT_EXPORT WebNodeList getElementsByTagName(const WebString&) const;
+ WEBKIT_EXPORT WebElement rootEditableElement() const;
// Returns true if the node has a non-empty bounding box in layout.
// This does not 100% guarantee the user can see it, but is pretty close.
#include "IconURL.h"
#include "InspectorController.h"
#include "KURL.h"
+#include "Node.h"
#include "Page.h"
#include "PageOverlay.h"
#include "painting/GraphicsContextBuilder.h"
#include "SecurityPolicy.h"
#include "Settings.h"
#include "SkiaUtils.h"
+#include "SpellChecker.h"
#include "SubstituteData.h"
#include "TextAffinity.h"
#include "TextIterator.h"
return frame()->editor()->isContinuousSpellCheckingEnabled();
}
+void WebFrameImpl::requestTextChecking(const WebElement& webElem)
+{
+ if (webElem.isNull())
+ return;
+
+ RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(webElem.constUnwrap<Element>()));
+
+ frame()->editor()->spellChecker()->requestCheckingFor(SpellCheckRequest::create(TextCheckingTypeSpelling | TextCheckingTypeGrammar, rangeToCheck, rangeToCheck));
+}
+
bool WebFrameImpl::hasSelection() const
{
WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
virtual bool isCommandEnabled(const WebString&) const;
virtual void enableContinuousSpellChecking(bool);
virtual bool isContinuousSpellCheckingEnabled() const;
+ virtual void requestTextChecking(const WebElement&);
virtual bool hasSelection() const;
virtual WebRange selectionRange() const;
virtual WebString selectionAsText() const;
#include "WebDOMEvent.h"
#include "WebDOMEventListener.h"
#include "WebDocument.h"
+#include "WebElement.h"
#include "WebFrameImpl.h"
#include "WebNodeList.h"
#include "platform/WebString.h"
return WebNodeList(m_private->getElementsByTagName(tag));
}
+WebElement WebNode::rootEditableElement() const
+{
+ return WebElement(m_private->rootEditableElement());
+}
+
bool WebNode::hasNonEmptyBoundingBox() const
{
return m_private->hasNonEmptyBoundingBox();