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

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

Issue 2889763003: Accept text input only if selection has focus. (Closed)
Patch Set: update Created 3 years, 7 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, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * Copyright (C) 2015 Google Inc. All rights reserved. 6 * Copyright (C) 2015 Google Inc. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 if (selection_state_ == SelectionState::kExtendedSelection) { 230 if (selection_state_ == SelectionState::kExtendedSelection) {
231 UpdateSelectionForMouseDownDispatchingSelectStart( 231 UpdateSelectionForMouseDownDispatchingSelectStart(
232 inner_node, selection, kCharacterGranularity, 232 inner_node, selection, kCharacterGranularity,
233 HandleVisibility::kNotVisible); 233 HandleVisibility::kNotVisible);
234 return false; 234 return false;
235 } 235 }
236 236
237 if (visible_pos.IsNull()) { 237 if (visible_pos.IsNull()) {
238 UpdateSelectionForMouseDownDispatchingSelectStart( 238 Selection().SetSelection(SelectionInFlatTree());
yosin_UTC9 2017/05/17 10:26:02 Do other browser clear selection at clicking user-
239 inner_node, VisibleSelectionInFlatTree(), kCharacterGranularity,
240 HandleVisibility::kNotVisible);
241 return false; 239 return false;
242 } 240 }
243 241
244 bool is_handle_visible = false; 242 bool is_handle_visible = false;
245 if (HasEditableStyle(*inner_node)) { 243 if (HasEditableStyle(*inner_node)) {
246 const bool is_text_box_empty = 244 const bool is_text_box_empty =
247 CreateVisibleSelection(SelectionInFlatTree::Builder() 245 CreateVisibleSelection(SelectionInFlatTree::Builder()
248 .SelectAllChildren(*inner_node) 246 .SelectAllChildren(*inner_node)
249 .Build()) 247 .Build())
250 .IsCaret(); 248 .IsCaret();
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 1129
1132 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { 1130 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) {
1133 bool is_mouse_down_on_link_or_image = 1131 bool is_mouse_down_on_link_or_image =
1134 event.IsOverLink() || event.GetHitTestResult().GetImage(); 1132 event.IsOverLink() || event.GetHitTestResult().GetImage();
1135 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != 1133 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) !=
1136 0 && 1134 0 &&
1137 !is_mouse_down_on_link_or_image; 1135 !is_mouse_down_on_link_or_image;
1138 } 1136 }
1139 1137
1140 } // namespace blink 1138 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698