Title: [105489] trunk/Source/WebKit/chromium
- Revision
- 105489
- Author
- [email protected]
- Date
- 2012-01-20 00:42:30 -0800 (Fri, 20 Jan 2012)
Log Message
[chromium] WebFrame should have an interface to invoke spellchecking in arbitrarily.
https://bugs.webkit.org/show_bug.cgi?id=73971
Patch by Shinya Kawanaka <[email protected]> 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.
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (105488 => 105489)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-01-20 08:26:49 UTC (rev 105488)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-01-20 08:42:30 UTC (rev 105489)
@@ -1,3 +1,22 @@
+2012-01-20 Shinya Kawanaka <[email protected]>
+
+ [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 <[email protected]>
Cleanup: make constant variable names in fileapi/ conform to WebKit's coding guideline
Modified: trunk/Source/WebKit/chromium/public/WebFrame.h (105488 => 105489)
--- trunk/Source/WebKit/chromium/public/WebFrame.h 2012-01-20 08:26:49 UTC (rev 105488)
+++ trunk/Source/WebKit/chromium/public/WebFrame.h 2012-01-20 08:42:30 UTC (rev 105489)
@@ -418,8 +418,8 @@
// Spell-checking support.
virtual void enableContinuousSpellChecking(bool) = 0;
virtual bool isContinuousSpellCheckingEnabled() const = 0;
+ virtual void requestTextChecking(const WebElement&) = 0;
-
// Selection -----------------------------------------------------------
virtual bool hasSelection() const = 0;
Modified: trunk/Source/WebKit/chromium/public/WebNode.h (105488 => 105489)
--- trunk/Source/WebKit/chromium/public/WebNode.h 2012-01-20 08:26:49 UTC (rev 105488)
+++ trunk/Source/WebKit/chromium/public/WebNode.h 2012-01-20 08:42:30 UTC (rev 105489)
@@ -42,6 +42,7 @@
class WebDOMEventListener;
class WebDOMEventListenerPrivate;
class WebDocument;
+class WebElement;
class WebFrame;
class WebNodeList;
@@ -109,6 +110,7 @@
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.
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (105488 => 105489)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-01-20 08:26:49 UTC (rev 105488)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-01-20 08:42:30 UTC (rev 105489)
@@ -106,6 +106,7 @@
#include "IconURL.h"
#include "InspectorController.h"
#include "KURL.h"
+#include "Node.h"
#include "Page.h"
#include "PageOverlay.h"
#include "painting/GraphicsContextBuilder.h"
@@ -133,6 +134,7 @@
#include "SecurityPolicy.h"
#include "Settings.h"
#include "SkiaUtils.h"
+#include "SpellChecker.h"
#include "SubstituteData.h"
#include "TextAffinity.h"
#include "TextIterator.h"
@@ -1294,6 +1296,16 @@
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());
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (105488 => 105489)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2012-01-20 08:26:49 UTC (rev 105488)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2012-01-20 08:42:30 UTC (rev 105489)
@@ -158,6 +158,7 @@
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;
Modified: trunk/Source/WebKit/chromium/src/WebNode.cpp (105488 => 105489)
--- trunk/Source/WebKit/chromium/src/WebNode.cpp 2012-01-20 08:26:49 UTC (rev 105488)
+++ trunk/Source/WebKit/chromium/src/WebNode.cpp 2012-01-20 08:42:30 UTC (rev 105489)
@@ -42,6 +42,7 @@
#include "WebDOMEvent.h"
#include "WebDOMEventListener.h"
#include "WebDocument.h"
+#include "WebElement.h"
#include "WebFrameImpl.h"
#include "WebNodeList.h"
#include "platform/WebString.h"
@@ -207,6 +208,11 @@
return WebNodeList(m_private->getElementsByTagName(tag));
}
+WebElement WebNode::rootEditableElement() const
+{
+ return WebElement(m_private->rootEditableElement());
+}
+
bool WebNode::hasNonEmptyBoundingBox() const
{
return m_private->hasNonEmptyBoundingBox();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes