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

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

Issue 2702403004: Expand FrameSeleciton::start() to increase chances of hoisting update layout (Closed)
Patch Set: 2017-02-22T12:32:36 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 if (!behavior().shouldInsertCharacter(*evt) || !canEdit()) 60 if (!behavior().shouldInsertCharacter(*evt) || !canEdit())
61 return false; 61 return false;
62 62
63 const Element* const focusedElement = m_frame->document()->focusedElement(); 63 const Element* const focusedElement = m_frame->document()->focusedElement();
64 if (!focusedElement) { 64 if (!focusedElement) {
65 // We may lose focused element by |command.execute(evt)|. 65 // We may lose focused element by |command.execute(evt)|.
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()
70 .computeVisibleSelectionInDOMTreeDeprecated()
71 .start()
72 .computeContainerNode())) {
70 // We should not insert text at selection start if selection doesn't have 73 // We should not insert text at selection start if selection doesn't have
71 // focus. See http://crbug.com/89026 74 // focus. See http://crbug.com/89026
72 return false; 75 return false;
73 } 76 }
74 77
75 // Return true to prevent default action. e.g. Space key scroll. 78 // Return true to prevent default action. e.g. Space key scroll.
76 if (dispatchBeforeInputInsertText(evt->target()->toNode(), keyEvent->text) != 79 if (dispatchBeforeInputInsertText(evt->target()->toNode(), keyEvent->text) !=
77 DispatchEventResult::NotCanceled) 80 DispatchEventResult::NotCanceled)
78 return true; 81 return true;
79 82
80 return insertText(keyEvent->text, evt); 83 return insertText(keyEvent->text, evt);
81 } 84 }
82 85
83 void Editor::handleKeyboardEvent(KeyboardEvent* evt) { 86 void Editor::handleKeyboardEvent(KeyboardEvent* evt) {
84 // Give the embedder a chance to handle the keyboard event. 87 // Give the embedder a chance to handle the keyboard event.
85 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt)) 88 if (client().handleKeyboardEvent(m_frame) || handleEditingKeyboardEvent(evt))
86 evt->setDefaultHandled(); 89 evt->setDefaultHandled();
87 } 90 }
88 91
89 } // namespace blink 92 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698