| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 AtomicString eventType; | 344 AtomicString eventType; |
| 345 switch (inputEvent.type) { | 345 switch (inputEvent.type) { |
| 346 case WebInputEvent::MouseMove: | 346 case WebInputEvent::MouseMove: |
| 347 eventType = EventTypeNames::mousemove; | 347 eventType = EventTypeNames::mousemove; |
| 348 break; | 348 break; |
| 349 case WebInputEvent::MouseLeave: | 349 case WebInputEvent::MouseLeave: |
| 350 eventType = EventTypeNames::mouseout; | 350 eventType = EventTypeNames::mouseout; |
| 351 break; | 351 break; |
| 352 case WebInputEvent::MouseDown: | 352 case WebInputEvent::MouseDown: |
| 353 eventType = EventTypeNames::mousedown; | 353 eventType = EventTypeNames::mousedown; |
| 354 gestureIndicator = wrapUnique( | 354 gestureIndicator = wrapUnique(new UserGestureIndicator( |
| 355 new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); | 355 UserGestureToken::create(UserGestureToken::NewGesture))); |
| 356 m_mouseCaptureGestureToken = gestureIndicator->currentToken(); | 356 m_mouseCaptureGestureToken = gestureIndicator->currentToken(); |
| 357 break; | 357 break; |
| 358 case WebInputEvent::MouseUp: | 358 case WebInputEvent::MouseUp: |
| 359 eventType = EventTypeNames::mouseup; | 359 eventType = EventTypeNames::mouseup; |
| 360 gestureIndicator = wrapUnique( | 360 gestureIndicator = wrapUnique( |
| 361 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); | 361 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); |
| 362 break; | 362 break; |
| 363 default: | 363 default: |
| 364 NOTREACHED(); | 364 NOTREACHED(); |
| 365 } | 365 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 } | 518 } |
| 519 | 519 |
| 520 // A keypress event is canceled. If an ongoing composition exists, then the | 520 // A keypress event is canceled. If an ongoing composition exists, then the |
| 521 // keydown event should have arisen from a handled key (e.g., backspace). | 521 // keydown event should have arisen from a handled key (e.g., backspace). |
| 522 // In this case we ignore the cancellation and continue; otherwise (no | 522 // In this case we ignore the cancellation and continue; otherwise (no |
| 523 // ongoing composition) we exit and signal success only for attempts to | 523 // ongoing composition) we exit and signal success only for attempts to |
| 524 // clear the composition. | 524 // clear the composition. |
| 525 if (m_suppressNextKeypressEvent && !inputMethodController.hasComposition()) | 525 if (m_suppressNextKeypressEvent && !inputMethodController.hasComposition()) |
| 526 return text.isEmpty(); | 526 return text.isEmpty(); |
| 527 | 527 |
| 528 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 528 UserGestureIndicator gestureIndicator( |
| 529 UserGestureToken::create(UserGestureToken::NewGesture)); |
| 529 | 530 |
| 530 // When the range of composition underlines overlap with the range between | 531 // When the range of composition underlines overlap with the range between |
| 531 // selectionStart and selectionEnd, WebKit somehow won't paint the selection | 532 // selectionStart and selectionEnd, WebKit somehow won't paint the selection |
| 532 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). | 533 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). |
| 533 // But the selection range actually takes effect. | 534 // But the selection range actually takes effect. |
| 534 inputMethodController.setComposition( | 535 inputMethodController.setComposition( |
| 535 String(text), CompositionUnderlineVectorBuilder(underlines), | 536 String(text), CompositionUnderlineVectorBuilder(underlines), |
| 536 selectionStart, selectionEnd); | 537 selectionStart, selectionEnd); |
| 537 | 538 |
| 538 return text.isEmpty() || inputMethodController.hasComposition(); | 539 return text.isEmpty() || inputMethodController.hasComposition(); |
| 539 } | 540 } |
| 540 | 541 |
| 541 // TODO(ekaramad):These methods are almost duplicated in WebViewImpl as well. | 542 // TODO(ekaramad):These methods are almost duplicated in WebViewImpl as well. |
| 542 // This code needs to be refactored (http://crbug.com/629721). | 543 // This code needs to be refactored (http://crbug.com/629721). |
| 543 bool WebFrameWidgetImpl::commitText(const WebString& text, | 544 bool WebFrameWidgetImpl::commitText(const WebString& text, |
| 544 int relativeCaretPosition) { | 545 int relativeCaretPosition) { |
| 545 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); | 546 UserGestureIndicator gestureIndicator( |
| 547 UserGestureToken::create(UserGestureToken::NewGesture)); |
| 546 LocalFrame* focused = focusedLocalFrameAvailableForIme(); | 548 LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| 547 if (!focused) | 549 if (!focused) |
| 548 return false; | 550 return false; |
| 549 | 551 |
| 550 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) | 552 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) |
| 551 return plugin->commitText(text, relativeCaretPosition); | 553 return plugin->commitText(text, relativeCaretPosition); |
| 552 | 554 |
| 553 return focused->inputMethodController().commitText(text, | 555 return focused->inputMethodController().commitText(text, |
| 554 relativeCaretPosition); | 556 relativeCaretPosition); |
| 555 } | 557 } |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 return flags; | 1518 return flags; |
| 1517 } | 1519 } |
| 1518 | 1520 |
| 1519 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { | 1521 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { |
| 1520 if (!m_imeAcceptEvents) | 1522 if (!m_imeAcceptEvents) |
| 1521 return nullptr; | 1523 return nullptr; |
| 1522 return focusedLocalFrameInWidget(); | 1524 return focusedLocalFrameInWidget(); |
| 1523 } | 1525 } |
| 1524 | 1526 |
| 1525 } // namespace blink | 1527 } // namespace blink |
| OLD | NEW |