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

Unified Diff: Source/core/page/FocusController.cpp

Issue 424973003: Don't clear selection on focus change except for text form control element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-08-13T13:21:11 Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index 3629d5ef3a7601f61ba064e4713743a39faccfe6..149ff8a87bca01cdc267d43e738c6569f5615562 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -665,17 +665,11 @@ static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendantOf(newFocusedNode))
return;
- if (selectionStartNode->isInShadowTree() && selectionStartNode->shadowHost() == newFocusedNode)
+ if (!enclosingTextFormControl(selectionStartNode))
return;
- if (Node* mousePressNode = newFocusedFrame->eventHandler().mousePressNode()) {
- if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) {
- // Don't clear the selection for contentEditable elements, but do
- // clear it for input and textarea. See bug 38696.
- if (!enclosingTextFormControl(selection.start()))
- return;
- }
- }
+ if (selectionStartNode->isInShadowTree() && selectionStartNode->shadowHost() == newFocusedNode)
+ return;
selection.clear();
}
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698