Changeset 64737 in webkit


Ignore:
Timestamp:
Aug 5, 2010 5:40:08 AM (14 years ago)
Author:
Simon Hausmann
Message:

[Qt] Clean up the input method handling
https://bugs.webkit.org/show_bug.cgi?id=43545

Reviewed by Tor Arne Vestbø.

WebCore:

Changed input method hint interface to be more efficient by setting
all hints in one shot, like in QWidget.

  • platform/qt/QWebPageClient.h:

WebKit/qt:

Replace the way of individually setting input method hints by
many calls to QWidget::setInputMethodHints with one single call.

This is more efficient by requiring less updates in the input
method hint.

  • WebCoreSupport/EditorClientQt.cpp:

(WebCore::EditorClientQt::setInputMethodState):

  • WebCoreSupport/PageClientQt.cpp:

(WebCore::PageClientQWidget::setInputMethodHints):
(WebCore::PageClientQGraphicsWidget::setInputMethodHints):

  • WebCoreSupport/PageClientQt.h:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64735 r64737  
     12010-08-05  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        [Qt] Clean up the input method handling
     6        https://bugs.webkit.org/show_bug.cgi?id=43545
     7
     8        Changed input method hint interface to be more efficient by setting
     9        all hints in one shot, like in QWidget.
     10
     11        * platform/qt/QWebPageClient.h:
     12
    1132010-08-05  Yury Semikhatsky  <yurys@chromium.org>
    214
  • trunk/WebCore/platform/qt/QWebPageClient.h

    r61342 r64737  
    6060
    6161#if QT_VERSION >= 0x040600
    62     virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0;
     62    virtual void setInputMethodHints(Qt::InputMethodHints hint) = 0;
    6363#endif
    6464
  • trunk/WebKit/qt/ChangeLog

    r64725 r64737  
     12010-08-05  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        [Qt] Clean up the input method handling
     6        https://bugs.webkit.org/show_bug.cgi?id=43545
     7
     8        Replace the way of individually setting input method hints by
     9        many calls to QWidget::setInputMethodHints with one single call.
     10
     11        This is more efficient by requiring less updates in the input
     12        method hint.
     13
     14        * WebCoreSupport/EditorClientQt.cpp:
     15        (WebCore::EditorClientQt::setInputMethodState):
     16        * WebCoreSupport/PageClientQt.cpp:
     17        (WebCore::PageClientQWidget::setInputMethodHints):
     18        (WebCore::PageClientQGraphicsWidget::setInputMethodHints):
     19        * WebCoreSupport/PageClientQt.h:
     20
    1212010-08-05  David Leong  <david.leong@nokia.com>
    222
  • trunk/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r64725 r64737  
    597597    if (webPageClient) {
    598598#if QT_VERSION >= 0x040600
    599         // Make sure to reset input method hint
    600         webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, false);
    601         webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, false);
    602         webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, false);
    603         webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, false);
    604         webPageClient->setInputMethodHint(Qt::ImhHiddenText, false);
     599        Qt::InputMethodHints hints;
    605600
    606601        HTMLInputElement* inputElement = 0;
     
    612607        if (inputElement) {
    613608            // Set input method hints for "number", "tel", "email", "url" and "password" input elements.
    614             webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField());
    615             webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField());
    616             webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField());
    617             webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField());
     609            if (inputElement->isTelephoneField())
     610                hints |= Qt::ImhDialableCharactersOnly;
     611            if (inputElement->isNumberField())
     612                hints |= Qt::ImhDigitsOnly;
     613            if (inputElement->isEmailField())
     614                hints |= Qt::ImhEmailCharactersOnly;
     615            if (inputElement->isUrlField())
     616                hints |= Qt::ImhUrlCharactersOnly;
    618617            // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag
    619618            // for password fields. The Qt platform is responsible for determining which widget
    620619            // will receive input method events for password fields.
    621             bool isPasswordField = inputElement->isPasswordField();
    622             webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField);
    623             if (isPasswordField)
     620            if (inputElement->isPasswordField()) {
    624621                active = true;
     622                hints |= Qt::ImhHiddenText;
     623            }
    625624        }
    626625
    627626#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
    628627        // disables auto-uppercase and predictive text for mobile devices
    629         webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true);
    630         webPageClient->setInputMethodHint(Qt::ImhNoPredictiveText, true);
     628        hints |= Qt::ImhNoAutoUppercase;
     629        hints |= Qt::ImhNoPredictiveText;
    631630#endif // Q_WS_MAEMO_5 || Q_WS_MAEMO_6 || Q_OS_SYMBIAN
     631       webPageClient->setInputMethodHints(hints);
    632632#endif // QT_VERSION check
    633633        webPageClient->setInputMethodEnabled(active);
  • trunk/WebKit/qt/WebCoreSupport/PageClientQt.cpp

    r63740 r64737  
    5050
    5151#if QT_VERSION >= 0x040600
    52 void PageClientQWidget::setInputMethodHint(Qt::InputMethodHint hint, bool enable)
    53 {
    54     if (enable)
    55         view->setInputMethodHints(view->inputMethodHints() | hint);
    56     else
    57         view->setInputMethodHints(view->inputMethodHints() & ~hint);
     52void PageClientQWidget::setInputMethodHints(Qt::InputMethodHints hints)
     53{
     54    view->setInputMethodHints(hints);
    5855}
    5956#endif
     
    234231
    235232#if QT_VERSION >= 0x040600
    236 void PageClientQGraphicsWidget::setInputMethodHint(Qt::InputMethodHint hint, bool enable)
    237 {
    238     if (enable)
    239         view->setInputMethodHints(view->inputMethodHints() | hint);
    240     else
    241         view->setInputMethodHints(view->inputMethodHints() & ~hint);
     233void PageClientQGraphicsWidget::setInputMethodHints(Qt::InputMethodHints hints)
     234{
     235    view->setInputMethodHints(hints);
    242236}
    243237#endif
  • trunk/WebKit/qt/WebCoreSupport/PageClientQt.h

    r63740 r64737  
    6060    virtual bool inputMethodEnabled() const;
    6161#if QT_VERSION >= 0x040600
    62     virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable);
     62    virtual void setInputMethodHints(Qt::InputMethodHints hints);
    6363#endif
    6464
     
    148148    virtual bool inputMethodEnabled() const;
    149149#if QT_VERSION >= 0x040600
    150     virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable);
     150    virtual void setInputMethodHints(Qt::InputMethodHints hints);
    151151#endif
    152152
Note: See TracChangeset for help on using the changeset viewer.