Chromium Code Reviews| 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 | 1069 |
| 1070 FrameSelection& selection = oldFocusedFrame->selection(); | 1070 FrameSelection& selection = oldFocusedFrame->selection(); |
| 1071 if (selection.isNone()) | 1071 if (selection.isNone()) |
| 1072 return; | 1072 return; |
| 1073 | 1073 |
| 1074 Node* selectionStartNode = selection.selection().start().anchorNode(); | 1074 Node* selectionStartNode = selection.selection().start().anchorNode(); |
| 1075 if (selectionStartNode == newFocusedElement || | 1075 if (selectionStartNode == newFocusedElement || |
| 1076 selectionStartNode->isDescendantOf(newFocusedElement)) | 1076 selectionStartNode->isDescendantOf(newFocusedElement)) |
| 1077 return; | 1077 return; |
| 1078 | 1078 |
| 1079 if (newFocusedElement && newFocusedElement->isTextControl()) | |
|
yosin_UTC9
2017/01/05 05:35:33
Should we also bail out for content editable?
Rat
hugoh_UTC2
2017/01/06 17:31:44
Yes, you're right. When focus jumps from <input> t
| |
| 1080 return; | |
| 1081 | |
| 1079 if (!enclosingTextControl(selectionStartNode)) | 1082 if (!enclosingTextControl(selectionStartNode)) |
| 1080 return; | 1083 return; |
| 1081 | 1084 |
| 1082 if (selectionStartNode->isInShadowTree() && | 1085 if (selectionStartNode->isInShadowTree() && |
| 1083 selectionStartNode->ownerShadowHost() == newFocusedElement) | 1086 selectionStartNode->ownerShadowHost() == newFocusedElement) |
| 1084 return; | 1087 return; |
| 1085 | 1088 |
| 1086 selection.clear(); | 1089 selection.clear(); |
| 1087 } | 1090 } |
| 1088 | 1091 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 | 1396 |
| 1394 return consumed; | 1397 return consumed; |
| 1395 } | 1398 } |
| 1396 | 1399 |
| 1397 DEFINE_TRACE(FocusController) { | 1400 DEFINE_TRACE(FocusController) { |
| 1398 visitor->trace(m_page); | 1401 visitor->trace(m_page); |
| 1399 visitor->trace(m_focusedFrame); | 1402 visitor->trace(m_focusedFrame); |
| 1400 } | 1403 } |
| 1401 | 1404 |
| 1402 } // namespace blink | 1405 } // namespace blink |
| OLD | NEW |