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

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

Issue 2258663003: [InputEvent] Support |deleteByCut|&|insertFromPaste| with |dataTransfer| field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yosin's review2, fix nits Created 4 years, 3 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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, InputE vent::InputType inputType, const String& data, const RangeVector* ranges) 1884 DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, InputE vent::InputType inputType, const String& data, const RangeVector* ranges)
1885 { 1885 {
1886 if (!RuntimeEnabledFeatures::inputEventEnabled()) 1886 if (!RuntimeEnabledFeatures::inputEventEnabled())
1887 return DispatchEventResult::NotCanceled; 1887 return DispatchEventResult::NotCanceled;
1888 if (!target) 1888 if (!target)
1889 return DispatchEventResult::NotCanceled; 1889 return DispatchEventResult::NotCanceled;
1890 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data , InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo mposing, ranges); 1890 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data , InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo mposing, ranges);
1891 return target->dispatchEvent(beforeInputEvent); 1891 return target->dispatchEvent(beforeInputEvent);
1892 } 1892 }
1893 1893
1894 DispatchEventResult dispatchBeforeInputDataTransfer(EventTarget* target, InputEv ent::InputType inputType, DataTransfer* dataTransfer, const RangeVector* ranges)
1895 {
1896 if (!RuntimeEnabledFeatures::inputEventEnabled())
1897 return DispatchEventResult::NotCanceled;
1898 if (!target)
1899 return DispatchEventResult::NotCanceled;
1900 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data Transfer, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposin g::NotComposing, ranges);
1901 return target->dispatchEvent(beforeInputEvent);
1902 }
1903
1894 InputEvent::InputType deletionInputTypeFromTextGranularity(DeleteDirection direc tion, TextGranularity granularity) 1904 InputEvent::InputType deletionInputTypeFromTextGranularity(DeleteDirection direc tion, TextGranularity granularity)
1895 { 1905 {
1896 using InputType = InputEvent::InputType; 1906 using InputType = InputEvent::InputType;
1897 switch (direction) { 1907 switch (direction) {
1898 case DeleteDirection::Forward: 1908 case DeleteDirection::Forward:
1899 if (granularity == WordGranularity) 1909 if (granularity == WordGranularity)
1900 return InputType::DeleteWordForward; 1910 return InputType::DeleteWordForward;
1901 if (granularity == LineBoundary) 1911 if (granularity == LineBoundary)
1902 return InputType::DeleteLineForward; 1912 return InputType::DeleteLineForward;
1903 return InputType::DeleteContentForward; 1913 return InputType::DeleteContentForward;
1904 case DeleteDirection::Backward: 1914 case DeleteDirection::Backward:
1905 if (granularity == WordGranularity) 1915 if (granularity == WordGranularity)
1906 return InputType::DeleteWordBackward; 1916 return InputType::DeleteWordBackward;
1907 if (granularity == LineBoundary) 1917 if (granularity == LineBoundary)
1908 return InputType::DeleteLineBackward; 1918 return InputType::DeleteLineBackward;
1909 return InputType::DeleteContentBackward; 1919 return InputType::DeleteContentBackward;
1910 default: 1920 default:
1911 return InputType::None; 1921 return InputType::None;
1912 } 1922 }
1913 } 1923 }
1914 1924
1915 } // namespace blink 1925 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.h ('k') | third_party/WebKit/Source/core/editing/Editor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698