Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 1752933002: [InputEvent] Fire 'beforeinput' during typing, pressing hot keys and IME composition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on WebEditingCommandType & Yosin's review 2 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 // otherwise, make sure to be at the start of the first selected node, 1724 // otherwise, make sure to be at the start of the first selected node,
1725 // instead of possibly at the end of the last node before the selection 1725 // instead of possibly at the end of the last node before the selection
1726 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); 1726 return mostForwardCaretPosition(visiblePosition.deepEquivalent());
1727 } 1727 }
1728 1728
1729 bool isTextSecurityNode(const Node* node) 1729 bool isTextSecurityNode(const Node* node)
1730 { 1730 {
1731 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE; 1731 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE;
1732 } 1732 }
1733 1733
1734 DispatchEventResult dispatchBeforeInputInsertText(EventTarget* target, const Str ing& data)
1735 {
1736 if (RuntimeEnabledFeatures::inputEventEnabled()) {
yosin_UTC9 2016/04/13 06:13:09 Could you use early return style to reduce indenta
chongz 2016/04/13 23:53:08 Done.
1737 if (target) {
1738 InputEvent* beforeInputEvent = InputEvent::createBeforeInputTyping(I nputEvent::InputType::InsertText, data);
1739 return target->dispatchEvent(beforeInputEvent);
1740 }
1741 }
1742 return DispatchEventResult::NotCanceled;
1743 }
1744
1745 DispatchEventResult dispatchBeforeInputFromComposition(EventTarget* target, Inpu tEvent::InputType inputType, const String& data)
1746 {
1747 if (RuntimeEnabledFeatures::inputEventEnabled()) {
1748 if (target) {
1749 InputEvent* beforeInputEvent = InputEvent::createBeforeInputFromComp osition(inputType, data);
1750 return target->dispatchEvent(beforeInputEvent);
1751 }
1752 }
1753 return DispatchEventResult::NotCanceled;
1754 }
1755
1756 DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, InputE vent::InputType inputType, const String& data)
1757 {
1758 if (RuntimeEnabledFeatures::inputEventEnabled()) {
1759 if (target) {
1760 InputEvent* beforeInputEvent = InputEvent::createBeforeInputEditorCo mmand(inputType, data);
1761 return target->dispatchEvent(beforeInputEvent);
1762 }
1763 }
1764 return DispatchEventResult::NotCanceled;
1765 }
1766
1734 } // namespace blink 1767 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698