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

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-07-30T09:45:59 Created 6 years, 5 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 | « LayoutTests/editing/selection/keep-selection-after-set-focus-expected.txt ('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 bdf43b6cf4144a2b28f93de3553567f2e3ace5f1..761539a93665ef2825b98dabeaca881eef8313b6 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -677,7 +677,11 @@ static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
}
}
- selection.clear();
+ if (newFocusedNode && (newFocusedNode->hasEditableStyle()
+ || (newFocusedNode->isElementNode() && isHTMLTextFormControlElement(toElement(newFocusedNode))))) {
leviw_travelin_and_unemployed 2014/07/30 19:19:19 How about a named function to document why you're
yosin_UTC9 2014/08/01 04:39:19 Fumm... There are no good reasons to exclude them.
+ selection.clear();
+ return;
+ }
}
bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newFocusedFrame, FocusType type)
« no previous file with comments | « LayoutTests/editing/selection/keep-selection-after-set-focus-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698