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