Changeset 110630 in webkit
- Timestamp:
- Mar 13, 2012, 3:57:43 PM (15 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 7 edited
-
Api/WebPage.cpp (modified) (2 diffs)
-
Api/WebPageClient.h (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
WebCoreSupport/EditorClientBlackBerry.cpp (modified) (1 diff)
-
WebKitSupport/InputHandler.cpp (modified) (9 diffs)
-
WebKitSupport/InputHandler.h (modified) (3 diffs)
-
WebKitSupport/TouchEventHandler.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/Api/WebPage.cpp
r110595 r110630 842 842 toggleTextReflowIfEnabledForBlockZoomOnly(); 843 843 #endif 844 845 // Notify InputHandler of state change. 846 m_inputHandler->enableInputMode(false); 844 847 845 848 // Set the scroll to origin here and notify the client since we'll be … … 3529 3532 3530 3533 if (mouseEvent.eventType() == MouseEventPressed) { 3534 m_inputHandler->enableInputMode(); 3531 3535 if (m_inputHandler->willOpenPopupForNode(node)) { 3532 3536 // Do not allow any human generated mouse or keyboard events to select <option>s in the list box -
trunk/Source/WebKit/blackberry/Api/WebPageClient.h
r109959 r110630 130 130 virtual void hideTapHighlight() = 0; 131 131 132 virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle , bool waitForExplicitKeyboardShowCall) = 0;132 virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle) = 0; 133 133 virtual void inputFocusLost() = 0; 134 134 virtual void inputTextChanged() = 0; -
trunk/Source/WebKit/blackberry/ChangeLog
r110595 r110630 1 2012-03-13 Mike Fenton <mifenton@rim.com> 2 3 [BlackBerry] Input focus state should unfocus the frame selection instead of the field. 4 https://bugs.webkit.org/show_bug.cgi?id=81023 5 6 Reviewed by Antonio Gomes. 7 8 PR 137400. 9 10 Prevent cursor drawing by unfocusing the frame selection 11 when input mode is not ready. 12 13 Greatly simplify the decision to focus input fields by removing 14 all ties to the page load state and base it on input. Input mode 15 is disabled when a page load begins and enabled on any user input. 16 17 The field is focused and ready for input immediately, only the 18 frame selection (or cursor) is unfocused. 19 20 Reviewed Internally by Gen Mak, Antonio Gomes and Nima Ghanavatian. 21 22 * Api/WebPage.cpp: 23 (BlackBerry::WebKit::WebPagePrivate::setLoadState): 24 (BlackBerry::WebKit::WebPagePrivate::handleMouseEvent): 25 * Api/WebPageClient.h: 26 * WebCoreSupport/EditorClientBlackBerry.cpp: 27 (WebCore::EditorClientBlackBerry::shouldBeginEditing): 28 * WebKitSupport/InputHandler.cpp: 29 (BlackBerry::WebKit::InputHandler::InputHandler): 30 (BlackBerry::WebKit::InputHandler::setElementUnfocused): 31 (BlackBerry::WebKit::InputHandler::enableInputMode): 32 (BlackBerry::WebKit::InputHandler::setElementFocused): 33 (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible): 34 (BlackBerry::WebKit::InputHandler::notifyClientOfKeyboardVisibilityChange): 35 (BlackBerry::WebKit::InputHandler::handleKeyboardInput): 36 (BlackBerry::WebKit::InputHandler::setComposingText): 37 * WebKitSupport/InputHandler.h: 38 (InputHandler): 39 * WebKitSupport/TouchEventHandler.cpp: 40 (BlackBerry::WebKit::TouchEventHandler::handleTouchPoint): 41 1 42 2012-03-13 Adam Barth <abarth@webkit.org> && Benjamin Poulain <bpoulain@apple.com> 2 43 -
trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
r110230 r110630 160 160 return m_webPagePrivate->m_dumpRenderTree->shouldBeginEditingInDOMRange(range); 161 161 162 return m_webPagePrivate->m_inputHandler->shouldAcceptInputFocus();162 return true; 163 163 } 164 164 -
trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
r110175 r110630 110 110 : m_webPage(page) 111 111 , m_currentFocusElement(0) 112 , m_inputModeEnabled(false) 112 113 , m_processingChange(false) 113 114 , m_changingFocus(false) … … 407 408 m_webPage->m_client->inputFocusLost(); 408 409 m_webPage->m_selectionHandler->selectionPositionChanged(); 410 411 // If the frame selection isn't focused, focus it. 412 if (!m_currentFocusElement->document()->frame()->selection()->isFocused()) 413 m_currentFocusElement->document()->frame()->selection()->setFocused(true); 409 414 } 410 415 … … 414 419 } 415 420 416 bool InputHandler::shouldAcceptInputFocus() 417 { 418 // If the DRT is running, always accept focus. 419 if (m_webPage->m_dumpRenderTree) 420 return true; 421 422 if (Platform::Settings::get()->alwaysShowKeyboardOnFocus()) { 423 FocusLog(LogLevelInfo, "InputHandler::shouldAcceptInputFocus alwaysShowKeyboardOnFocus is active."); 424 return true; 425 } 426 427 Frame* focusedFrame = m_webPage->focusedOrMainFrame(); 428 if (!focusedFrame) { 429 FocusLog(LogLevelInfo, "InputHandler::shouldAcceptInputFocus Frame not valid."); 430 return false; 431 } 432 433 // Any user action should be respected. Mouse will be down when touch is 434 // used to focus. 435 if (focusedFrame->eventHandler()->mousePressed()) { 436 FocusLog(LogLevelInfo, "InputHandler::shouldAcceptInputFocus Mouse is pressed focusing."); 437 return true; 438 } 439 440 if (!m_webPage->m_client->hasKeyboardFocus()) { 441 FocusLog(LogLevelInfo, "InputHandler::shouldAcceptInputFocus Client does not have input focus."); 442 return false; 443 } 444 445 if (m_webPage->isLoading()) { 446 FocusLog(LogLevelInfo, "InputHandler::shouldAcceptInputFocus Webpage is loading."); 447 return false; 448 } 449 450 // Make sure the focused frame is not processing load events. 451 FocusLog(LogLevelInfo, "InputHandler::shouldAcceptInputFocus returning state of processingLoadEvent (%s).", !focusedFrame->document()->processingLoadEvent() ? "true" : "false"); 452 return !focusedFrame->document()->processingLoadEvent(); 421 void InputHandler::enableInputMode(bool inputModeAllowed) 422 { 423 FocusLog(LogLevelInfo, "InputHandler::enableInputMode %s, override is %s" 424 , inputModeAllowed ? "true" : "false" 425 , m_webPage->m_dumpRenderTree || Platform::Settings::get()->alwaysShowKeyboardOnFocus() ? "true" : "false"); 426 427 m_inputModeEnabled = inputModeAllowed; 428 429 // If DRT is running or always show keyboard setting is active, do not delay 430 // showing the keyboard. 431 if (m_webPage->m_dumpRenderTree || Platform::Settings::get()->alwaysShowKeyboardOnFocus()) 432 m_inputModeEnabled = true; 433 434 // If the frame selection isn't focused, focus it. 435 if (m_inputModeEnabled && isActiveTextEdit() && !m_currentFocusElement->document()->frame()->selection()->isFocused()) 436 m_currentFocusElement->document()->frame()->selection()->setFocused(true); 453 437 } 454 438 … … 458 442 ASSERT(element->document() && element->document()->frame()); 459 443 460 if (!m_changingFocus && !shouldAcceptInputFocus()) { 461 // Remove the focus from this element, but guard against recursion by 462 // allowing a refocus during the blur to continue. 463 // THIS IS A HACK that needs to be fixed. Instead of blur the field, 464 // the frame or frame selection should be blurred. Google bypasses these 465 // though so it can't be done right now. 466 m_changingFocus = true; 467 element->blur(); 468 m_changingFocus = false; 469 return; 470 } 444 if (element->document()->frame()->selection()->isFocused() != m_inputModeEnabled) 445 element->document()->frame()->selection()->setFocused(m_inputModeEnabled); 471 446 472 447 // Clear the existing focus node details. … … 482 457 483 458 FocusLog(LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d", type, m_currentFocusElementTextEditMask); 484 485 m_webPage->m_client->inputFocusGained(type, 486 m_currentFocusElementTextEditMask, 487 m_delayKeyboardVisibilityChange /* wait for explicit keyboard show call */); 459 m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask); 488 460 489 461 handleInputLocaleChanged(m_webPage->m_webSettings->isWritingDirectionRTL()); 462 463 if (!m_delayKeyboardVisibilityChange) 464 notifyClientOfKeyboardVisibilityChange(true); 490 465 } 491 466 … … 553 528 void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) 554 529 { 555 if (!m_ currentFocusElement || !m_currentFocusElement->document())530 if (!m_inputModeEnabled || !m_currentFocusElement || !m_currentFocusElement->document()) 556 531 return; 557 532 … … 755 730 void InputHandler::notifyClientOfKeyboardVisibilityChange(bool visible) 756 731 { 732 // If we aren't ready for input, keyboard changes should be ignored. 733 if (!m_inputModeEnabled && visible) 734 return; 735 757 736 if (!m_delayKeyboardVisibilityChange) { 758 737 m_webPage->showVirtualKeyboard(visible); … … 909 888 { 910 889 InputLog(LogLevelInfo, "InputHandler::handleKeyboardInput received character=%lc, type=%d", keyboardEvent.character(), keyboardEvent.type()); 890 891 // Enable input mode if we are processing a key event. 892 enableInputMode(); 911 893 912 894 // If we aren't specifically part of a composition, fail, IMF should never send key input … … 1690 1672 InputLog(LogLevelInfo, "InputHandler::setComposingText at relativeCursorPosition: %d", relativeCursorPosition); 1691 1673 1674 // Enable input mode if we are processing a key event. 1675 enableInputMode(); 1676 1692 1677 return setSpannableTextAndRelativeCursor(spannableString, relativeCursorPosition, true /* markTextAsComposing */) ? 0 : -1; 1693 1678 } -
trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h
r110175 r110630 57 57 enum FocusElementType { TextEdit, TextPopup /* Date/Time & Color */, SelectPopup, Plugin }; 58 58 enum CaretScrollType { CenterAlways, CenterIfNeeded, EdgeIfNeeded }; 59 60 void enableInputMode(bool inputModeAllowed = true); 59 61 60 62 void focusedNodeChanged(); … … 117 119 int32_t commitText(spannable_string_t*, int32_t relativeCursorPosition); 118 120 119 bool shouldAcceptInputFocus();120 121 121 private: 122 122 enum PendingKeyboardStateChange { NoChange, Visible, NotVisible }; … … 178 178 179 179 RefPtr<WebCore::Element> m_currentFocusElement; 180 bool m_inputModeEnabled; 180 181 181 182 bool m_processingChange; -
trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp
r108721 r110630 175 175 bool TouchEventHandler::handleTouchPoint(Platform::TouchPoint& point) 176 176 { 177 // Enable input mode on any touch event. 178 m_webPage->m_inputHandler->enableInputMode(); 179 177 180 switch (point.m_state) { 178 181 case Platform::TouchPoint::TouchPressed:
Note:
See TracChangeset
for help on using the changeset viewer.