Title: [126925] trunk/Source/WebKit/blackberry
- Revision
- 126925
- Author
- [email protected]
- Date
- 2012-08-28 13:46:57 -0700 (Tue, 28 Aug 2012)
Log Message
[BlackBerry] Spellcheck should be enabled if undefined in content.
https://bugs.webkit.org/show_bug.cgi?id=95139
Currently we only enable spellcheck if it is defined as such in
the web content explicitly.
Making this change to enable by default, and only turn off if it is
explicitly set, or if we expect the field to be a username, email or
url.
Internally reviewed by Mike Fenton.
Patch by Nima Ghanavatian <[email protected]> on 2012-08-28
Reviewed by Rob Buis.
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::requestCheckingOfString):
(BlackBerry::WebKit::InputHandler::setElementFocused):
(BlackBerry::WebKit::InputHandler::unlockSequenceMap):
(WebKit):
(BlackBerry::WebKit::InputHandler::shouldSpellCheckElement):
* WebKitSupport/InputHandler.h:
(InputHandler):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (126924 => 126925)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-28 20:44:58 UTC (rev 126924)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-28 20:46:57 UTC (rev 126925)
@@ -1,3 +1,27 @@
+2012-08-28 Nima Ghanavatian <[email protected]>
+
+ [BlackBerry] Spellcheck should be enabled if undefined in content.
+ https://bugs.webkit.org/show_bug.cgi?id=95139
+
+ Currently we only enable spellcheck if it is defined as such in
+ the web content explicitly.
+ Making this change to enable by default, and only turn off if it is
+ explicitly set, or if we expect the field to be a username, email or
+ url.
+
+ Internally reviewed by Mike Fenton.
+
+ Reviewed by Rob Buis.
+
+ * WebKitSupport/InputHandler.cpp:
+ (BlackBerry::WebKit::InputHandler::requestCheckingOfString):
+ (BlackBerry::WebKit::InputHandler::setElementFocused):
+ (BlackBerry::WebKit::InputHandler::unlockSequenceMap):
+ (WebKit):
+ (BlackBerry::WebKit::InputHandler::shouldSpellCheckElement):
+ * WebKitSupport/InputHandler.h:
+ (InputHandler):
+
2012-08-28 Caio Marcelo de Oliveira Filho <[email protected]>
Rename first/second to key/value in HashMap iterators
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (126924 => 126925)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-08-28 20:44:58 UTC (rev 126924)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-08-28 20:46:57 UTC (rev 126925)
@@ -541,8 +541,8 @@
return;
}
- // Check if field explicitly asked for spellchecking.
- if (DOMSupport::elementSupportsSpellCheck(m_currentFocusElement.get()) != DOMSupport::On) {
+ // Check if the field should be spellchecked.
+ if (!shouldSpellCheckElement(m_currentFocusElement.get())) {
spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */);
return;
}
@@ -842,8 +842,8 @@
SpellingLog(LogLevelInfo, "InputHandler::setElementFocused Focusing the field took %f seconds.", timer.elapsed());
#endif
- // Check if the field explicitly asks for spellchecking.
- if (DOMSupport::elementSupportsSpellCheck(element) != DOMSupport::On)
+ // Check if the field should be spellchecked.
+ if (!shouldSpellCheckElement(element))
return;
// Spellcheck the field in its entirety.
@@ -855,6 +855,21 @@
#endif
}
+bool InputHandler::shouldSpellCheckElement(const Element* element) const
+{
+ DOMSupport::AttributeState spellCheckAttr = DOMSupport::elementSupportsSpellCheck(element);
+
+ // Explicitly set to off.
+ if (spellCheckAttr == DOMSupport::Off)
+ return false;
+
+ // Undefined and part of a set of cases which we do not wish to check. This includes user names and email addresses, so we are piggybacking on NoAutocomplete cases.
+ if (spellCheckAttr == DOMSupport::Default && (m_currentFocusElementTextEditMask & NO_AUTO_TEXT))
+ return false;
+
+ return true;
+}
+
void InputHandler::spellCheckBlock(VisibleSelection& visibleSelection, TextCheckingProcessType textCheckingProcessType)
{
if (!isActiveTextEdit())
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (126924 => 126925)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-08-28 20:44:58 UTC (rev 126924)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-08-28 20:46:57 UTC (rev 126925)
@@ -199,6 +199,7 @@
PassRefPtr<WebCore::Range> getRangeForSpellCheckWithFineGranularity(WebCore::VisiblePosition startPosition, WebCore::VisiblePosition endPosition);
void cancelAllSpellCheckingRequests();
WebCore::SpellChecker* getSpellChecker();
+ bool shouldSpellCheckElement(const WebCore::Element*) const;
WebPagePrivate* m_webPage;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes