OLD | NEW |
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, | 1069 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, |
1070 LocalFrame* newFocusedFrame, | 1070 LocalFrame* newFocusedFrame, |
1071 Element* newFocusedElement) { | 1071 Element* newFocusedElement) { |
1072 if (!oldFocusedFrame || !newFocusedFrame) | 1072 if (!oldFocusedFrame || !newFocusedFrame) |
1073 return; | 1073 return; |
1074 | 1074 |
1075 if (oldFocusedFrame->document() != newFocusedFrame->document()) | 1075 if (oldFocusedFrame->document() != newFocusedFrame->document()) |
1076 return; | 1076 return; |
1077 | 1077 |
1078 FrameSelection& selection = oldFocusedFrame->selection(); | 1078 FrameSelection& selection = oldFocusedFrame->selection(); |
1079 const SelectionInDOMTree& selectionInDOMTree = selection.selectionInDOMTree(); | 1079 if (selection.isNone()) |
1080 if (selectionInDOMTree.isNone()) | |
1081 return; | 1080 return; |
1082 | 1081 |
1083 Node* selectionStartNode = selectionInDOMTree.base().anchorNode(); | 1082 Node* selectionStartNode = selection.selection().start().anchorNode(); |
1084 if (selectionStartNode == newFocusedElement || | 1083 if (selectionStartNode == newFocusedElement || |
1085 selectionStartNode->isDescendantOf(newFocusedElement)) | 1084 selectionStartNode->isDescendantOf(newFocusedElement)) |
1086 return; | 1085 return; |
1087 | 1086 |
1088 if (!enclosingTextControl(selectionStartNode)) | 1087 if (!enclosingTextControl(selectionStartNode)) |
1089 return; | 1088 return; |
1090 | 1089 |
1091 if (selectionStartNode->isInShadowTree() && | 1090 if (selectionStartNode->isInShadowTree() && |
1092 selectionStartNode->ownerShadowHost() == newFocusedElement) | 1091 selectionStartNode->ownerShadowHost() == newFocusedElement) |
1093 return; | 1092 return; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 it->focusedFrameChanged(); | 1414 it->focusedFrameChanged(); |
1416 } | 1415 } |
1417 | 1416 |
1418 DEFINE_TRACE(FocusController) { | 1417 DEFINE_TRACE(FocusController) { |
1419 visitor->trace(m_page); | 1418 visitor->trace(m_page); |
1420 visitor->trace(m_focusedFrame); | 1419 visitor->trace(m_focusedFrame); |
1421 visitor->trace(m_focusChangedObservers); | 1420 visitor->trace(m_focusChangedObservers); |
1422 } | 1421 } |
1423 | 1422 |
1424 } // namespace blink | 1423 } // namespace blink |
OLD | NEW |