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

Side by Side Diff: third_party/WebKit/Source/core/page/FocusController.cpp

Issue 1958093002: CONTINUED Make FrameSelection to hold non-canonicalized positions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2017-01-16T20:04:35 Created 3 years, 11 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) 2008 Nuanti Ltd. 3 * Copyright (C) 2008 Nuanti Ltd.
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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, 1061 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame,
1062 LocalFrame* newFocusedFrame, 1062 LocalFrame* newFocusedFrame,
1063 Element* newFocusedElement) { 1063 Element* newFocusedElement) {
1064 if (!oldFocusedFrame || !newFocusedFrame) 1064 if (!oldFocusedFrame || !newFocusedFrame)
1065 return; 1065 return;
1066 1066
1067 if (oldFocusedFrame->document() != newFocusedFrame->document()) 1067 if (oldFocusedFrame->document() != newFocusedFrame->document())
1068 return; 1068 return;
1069 1069
1070 FrameSelection& selection = oldFocusedFrame->selection(); 1070 FrameSelection& selection = oldFocusedFrame->selection();
1071 if (selection.isNone()) 1071 const SelectionInDOMTree& selectionInDOMTree = selection.selectionInDOMTree();
1072 if (selectionInDOMTree.isNone())
1072 return; 1073 return;
1073 1074
1074 Node* selectionStartNode = selection.selection().start().anchorNode(); 1075 Node* selectionStartNode = selectionInDOMTree.base().anchorNode();
1075 if (selectionStartNode == newFocusedElement || 1076 if (selectionStartNode == newFocusedElement ||
1076 selectionStartNode->isDescendantOf(newFocusedElement)) 1077 selectionStartNode->isDescendantOf(newFocusedElement))
1077 return; 1078 return;
1078 1079
1079 if (!enclosingTextControl(selectionStartNode)) 1080 if (!enclosingTextControl(selectionStartNode))
1080 return; 1081 return;
1081 1082
1082 if (selectionStartNode->isInShadowTree() && 1083 if (selectionStartNode->isInShadowTree() &&
1083 selectionStartNode->ownerShadowHost() == newFocusedElement) 1084 selectionStartNode->ownerShadowHost() == newFocusedElement)
1084 return; 1085 return;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 1394
1394 return consumed; 1395 return consumed;
1395 } 1396 }
1396 1397
1397 DEFINE_TRACE(FocusController) { 1398 DEFINE_TRACE(FocusController) {
1398 visitor->trace(m_page); 1399 visitor->trace(m_page);
1399 visitor->trace(m_focusedFrame); 1400 visitor->trace(m_focusedFrame);
1400 } 1401 }
1401 1402
1402 } // namespace blink 1403 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698