diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
commit | 43a42f108af6bcbd91f2672731c3047c26213af1 (patch) | |
tree | 7fa092e5f5d873c72f2486a70e26be26f7a38bec /Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp | |
parent | d9cf437c840c6eb7417bdd97e6c40979255d3158 (diff) | |
download | qtwebkit-43a42f108af6bcbd91f2672731c3047c26213af1.tar.gz |
Imported WebKit commit 302e7806bff028bd1167a1ec7c86a1ee00ecfb49 (http://svn.webkit.org/repository/webkit/trunk@132067)
New snapshot that fixes build without QtWidgets
Diffstat (limited to 'Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp')
-rw-r--r-- | Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index e2ea590a9..07397011b 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -188,7 +188,7 @@ static BlackBerryInputType convertInputType(const HTMLInputElement* inputElement return InputTypeText; } -static int inputStyle(BlackBerryInputType type, const Element* element) +static int64_t inputStyle(BlackBerryInputType type, const Element* element) { switch (type) { case InputTypeEmail: @@ -242,6 +242,26 @@ static int inputStyle(BlackBerryInputType type, const Element* element) return DEFAULT_STYLE; } +static VirtualKeyboardType convertInputTypeToVKBType(BlackBerryInputType inputType) +{ + switch (inputType) { + case InputTypeURL: + return VKBTypeUrl; + case InputTypeEmail: + return VKBTypeEmail; + case InputTypeTelephone: + return VKBTypePhone; + case InputTypePassword: + return VKBTypePassword; + case InputTypeNumber: + case InputTypeHexadecimal: + return VKBTypePin; + default: + // All other types are text based use default keyboard. + return VKBTypeDefault; + } +} + static VirtualKeyboardType convertStringToKeyboardType(const AtomicString& string) { DEFINE_STATIC_LOCAL(AtomicString, Default, ("default")); @@ -812,6 +832,9 @@ void InputHandler::setElementFocused(Element* element) m_currentFocusElementTextEditMask = inputStyle(type, element); VirtualKeyboardType keyboardType = keyboardTypeAttribute(element); + if (keyboardType == VKBTypeNotSet) + keyboardType = convertInputTypeToVKBType(type); + VirtualKeyboardEnterKeyType enterKeyType = keyboardEnterKeyTypeAttribute(element); if (enterKeyType == VKBEnterKeyNotSet && type != InputTypeTextArea) { @@ -823,7 +846,7 @@ void InputHandler::setElementFocused(Element* element) } FocusLog(LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d, Keyboard Type=%d, Enter Key=%d", type, m_currentFocusElementTextEditMask, keyboardType, enterKeyType); - m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask, keyboardType, enterKeyType); + m_webPage->m_client->inputFocusGained(m_currentFocusElementTextEditMask, keyboardType, enterKeyType); handleInputLocaleChanged(m_webPage->m_webSettings->isWritingDirectionRTL()); @@ -1036,6 +1059,10 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) if (!(Platform::Settings::instance()->allowedScrollAdjustmentForInputFields() & scrollType)) return; + // Fixed position elements cannot be scrolled into view. + if (DOMSupport::isFixedPositionOrHasFixedPositionAncestor(m_currentFocusElement->renderer())) + return; + Frame* elementFrame = m_currentFocusElement->document()->frame(); if (!elementFrame) return; @@ -1084,7 +1111,9 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) m_focusZoomScale = m_webPage->currentScale(); m_focusZoomLocation = selectionFocusRect.location(); } - m_webPage->zoomAboutPoint(s_minimumTextHeightInPixels / fontHeight, m_focusZoomLocation); + double zoomScaleRequired = static_cast<double>(s_minimumTextHeightInPixels) / fontHeight; + m_webPage->zoomAboutPoint(zoomScaleRequired, m_focusZoomLocation); + InputLog(LogLevelInfo, "InputHandler::ensureFocusTextElementVisible zooming in to %f at point %d, %d", zoomScaleRequired, m_focusZoomLocation.x(), m_focusZoomLocation.y()); } else { m_focusZoomScale = 0.0; m_focusZoomLocation = WebCore::IntPoint(); @@ -1157,6 +1186,7 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) scrollLocation = scrollLocation.shrunkTo(maximumScrollPosition); mainFrameView->setScrollPosition(scrollLocation); mainFrameView->setConstrainsScrollingToContentEdge(true); + InputLog(LogLevelInfo, "InputHandler::ensureFocusTextElementVisible scrolling to point %d, %d", scrollLocation.x(), scrollLocation.y()); } } m_webPage->resumeBackingStore(); |