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

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: Yosin's review 3 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())
1737 return DispatchEventResult::NotCanceled;
1738 if (!target)
1739 return DispatchEventResult::NotCanceled;
1740 InputEvent* beforeInputEvent = InputEvent::createBeforeInputTyping(InputEven t::InputType::InsertText, data);
1741 return target->dispatchEvent(beforeInputEvent);
1742 }
1743
1744 DispatchEventResult dispatchBeforeInputFromComposition(EventTarget* target, Inpu tEvent::InputType inputType, const String& data)
1745 {
1746 if (!RuntimeEnabledFeatures::inputEventEnabled())
1747 return DispatchEventResult::NotCanceled;
1748 if (!target)
1749 return DispatchEventResult::NotCanceled;
1750 InputEvent* beforeInputEvent = InputEvent::createBeforeInputFromComposition( inputType, data);
1751 return target->dispatchEvent(beforeInputEvent);
1752 }
1753
1754 DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, InputE vent::InputType inputType, const String& data)
1755 {
1756 if (!RuntimeEnabledFeatures::inputEventEnabled())
1757 return DispatchEventResult::NotCanceled;
1758 if (!target)
1759 return DispatchEventResult::NotCanceled;
1760 InputEvent* beforeInputEvent = InputEvent::createBeforeInputEditorCommand(in putType, data);
1761 return target->dispatchEvent(beforeInputEvent);
1762 }
1763
1734 } // namespace blink 1764 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698