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

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

Issue 2693863003: [InputEvent] Change |getTargetRanges()| to return current selection by default (Closed)
Patch Set: yosin's review: Use const Node&, add null checks Created 3 years, 10 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) 2006, 2007 Apple, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
3 * Copyright (C) 2012 Google, Inc. All rights reserved. 3 * Copyright (C) 2012 Google, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return false; 66 return false;
67 } 67 }
68 if (!focusedElement->containsIncludingHostElements( 68 if (!focusedElement->containsIncludingHostElements(
69 *m_frame->selection().start().computeContainerNode())) { 69 *m_frame->selection().start().computeContainerNode())) {
70 // We should not insert text at selection start if selection doesn't have 70 // We should not insert text at selection start if selection doesn't have
71 // focus. See http://crbug.com/89026 71 // focus. See http://crbug.com/89026
72 return false; 72 return false;
73 } 73 }
74 74
75 // Return true to prevent default action. e.g. Space key scroll. 75 // Return true to prevent default action. e.g. Space key scroll.
76 if (dispatchBeforeInputInsertText(evt->target(), keyEvent->text) != 76 if (dispatchBeforeInputInsertText(evt->target()->toNode(), keyEvent->text) !=
77 DispatchEventResult::NotCanceled) 77 DispatchEventResult::NotCanceled)
78 return true; 78 return true;
79 79
80 return insertText(keyEvent->text, evt); 80 return insertText(keyEvent->text, evt);
81 } 81 }
82 82
83 void Editor::handleKeyboardEvent(KeyboardEvent* evt) { 83 void Editor::handleKeyboardEvent(KeyboardEvent* evt) {
84 // Give the embedder a chance to handle the keyboard event. 84 // Give the embedder a chance to handle the keyboard event.
85 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt)) 85 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt))
86 evt->setDefaultHandled(); 86 evt->setDefaultHandled();
87 } 87 }
88 88
89 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | third_party/WebKit/Source/core/editing/InputMethodController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698