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

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

Issue 2616623002: Do not send redundant selectionchange-events (decouple focus) (Closed)
Patch Set: Fix spatnav tests (clear selection when focus goes to non editable element). Remove now invalid kee… 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/FocusController.cpp
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp
index c75f524ac1ac4de629c2045c739a8667a6e8457c..e14308a0db90ac9217534bd245f67627adac5951 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -1066,34 +1066,6 @@ static bool relinquishesEditingFocus(const Element& element) {
return element.document().frame() && rootEditableElement(element);
}
-static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame,
- LocalFrame* newFocusedFrame,
- Element* newFocusedElement) {
- if (!oldFocusedFrame || !newFocusedFrame)
- return;
-
- if (oldFocusedFrame->document() != newFocusedFrame->document())
- return;
-
- FrameSelection& selection = oldFocusedFrame->selection();
- if (selection.isNone())
- return;
-
- Node* selectionStartNode = selection.selection().start().anchorNode();
- if (selectionStartNode == newFocusedElement ||
- selectionStartNode->isDescendantOf(newFocusedElement))
- return;
-
- if (!enclosingTextControl(selectionStartNode))
- return;
-
- if (selectionStartNode->isInShadowTree() &&
- selectionStartNode->ownerShadowHost() == newFocusedElement)
- return;
-
- selection.clear();
-}
-
bool FocusController::setFocusedElement(Element* element,
Frame* newFocusedFrame) {
return setFocusedElement(
@@ -1130,10 +1102,6 @@ bool FocusController::setFocusedElement(Element* element,
newDocument->focusedElement() == element)
return true;
- if (newFocusedFrame && newFocusedFrame->isLocalFrame())
- clearSelectionIfNeeded(oldFocusedFrame, toLocalFrame(newFocusedFrame),
- element);
-
if (oldDocument && oldDocument != newDocument)
oldDocument->clearFocusedElement();

Powered by Google App Engine
This is Rietveld 408576698