⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 126925 in webkit


Ignore:
Timestamp:
Aug 28, 2012, 1:46:57 PM (14 years ago)
Author:
commit-queue@webkit.org
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 <nghanavatian@rim.com> 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):

Location:
trunk/Source/WebKit/blackberry
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/ChangeLog

    r126914 r126925  
     12012-08-28  Nima Ghanavatian  <nghanavatian@rim.com>
     2
     3        [BlackBerry] Spellcheck should be enabled if undefined in content.
     4        https://bugs.webkit.org/show_bug.cgi?id=95139
     5
     6        Currently we only enable spellcheck if it is defined as such in
     7        the web content explicitly.
     8        Making this change to enable by default, and only turn off if it is
     9        explicitly set, or if we expect the field to be a username, email or
     10        url.
     11
     12        Internally reviewed by Mike Fenton.
     13
     14        Reviewed by Rob Buis.
     15
     16        * WebKitSupport/InputHandler.cpp:
     17        (BlackBerry::WebKit::InputHandler::requestCheckingOfString):
     18        (BlackBerry::WebKit::InputHandler::setElementFocused):
     19        (BlackBerry::WebKit::InputHandler::unlockSequenceMap):
     20        (WebKit):
     21        (BlackBerry::WebKit::InputHandler::shouldSpellCheckElement):
     22        * WebKitSupport/InputHandler.h:
     23        (InputHandler):
     24
    1252012-08-28  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    226
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

    r126883 r126925  
    542542    }
    543543
    544     // Check if field explicitly asked for spellchecking.
    545     if (DOMSupport::elementSupportsSpellCheck(m_currentFocusElement.get()) != DOMSupport::On) {
     544    // Check if the field should be spellchecked.
     545    if (!shouldSpellCheckElement(m_currentFocusElement.get())) {
    546546        spellCheckingRequestCancelled(sequenceId, true /* isSequenceId */);
    547547        return;
     
    843843#endif
    844844
    845     // Check if the field explicitly asks for spellchecking.
    846     if (DOMSupport::elementSupportsSpellCheck(element) != DOMSupport::On)
     845    // Check if the field should be spellchecked.
     846    if (!shouldSpellCheckElement(element))
    847847        return;
    848848
     
    854854    SpellingLog(LogLevelInfo, "InputHandler::setElementFocused Spellchecking the field increased the total time to focus to %f seconds.", timer.elapsed());
    855855#endif
     856}
     857
     858bool InputHandler::shouldSpellCheckElement(const Element* element) const
     859{
     860    DOMSupport::AttributeState spellCheckAttr = DOMSupport::elementSupportsSpellCheck(element);
     861
     862    // Explicitly set to off.
     863    if (spellCheckAttr == DOMSupport::Off)
     864        return false;
     865
     866    // 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.
     867    if (spellCheckAttr == DOMSupport::Default && (m_currentFocusElementTextEditMask & NO_AUTO_TEXT))
     868        return false;
     869
     870    return true;
    856871}
    857872
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h

    r126883 r126925  
    200200    void cancelAllSpellCheckingRequests();
    201201    WebCore::SpellChecker* getSpellChecker();
     202    bool shouldSpellCheckElement(const WebCore::Element*) const;
    202203
    203204    WebPagePrivate* m_webPage;
Note: See TracChangeset for help on using the changeset viewer.