| 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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 Element* FocusController::findFocusableElementInShadowHost(const Element& shadow
Host) | 1014 Element* FocusController::findFocusableElementInShadowHost(const Element& shadow
Host) |
| 1015 { | 1015 { |
| 1016 DCHECK(shadowHost.authorShadowRoot()); | 1016 DCHECK(shadowHost.authorShadowRoot()); |
| 1017 ScopedFocusNavigation scope = ScopedFocusNavigation::ownedByShadowHost(shado
wHost); | 1017 ScopedFocusNavigation scope = ScopedFocusNavigation::ownedByShadowHost(shado
wHost); |
| 1018 return findFocusableElementAcrossFocusScopes(WebFocusTypeForward, scope); | 1018 return findFocusableElementAcrossFocusScopes(WebFocusTypeForward, scope); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 static bool relinquishesEditingFocus(const Element& element) | 1021 static bool relinquishesEditingFocus(const Element& element) |
| 1022 { | 1022 { |
| 1023 DCHECK(element.hasEditableStyle()); | 1023 DCHECK(element.hasEditableStyle()); |
| 1024 return element.document().frame() && element.rootEditableElement(); | 1024 return element.document().frame() && rootEditableElement(element); |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
ocusedFrame, Element* newFocusedElement) | 1027 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
ocusedFrame, Element* newFocusedElement) |
| 1028 { | 1028 { |
| 1029 if (!oldFocusedFrame || !newFocusedFrame) | 1029 if (!oldFocusedFrame || !newFocusedFrame) |
| 1030 return; | 1030 return; |
| 1031 | 1031 |
| 1032 if (oldFocusedFrame->document() != newFocusedFrame->document()) | 1032 if (oldFocusedFrame->document() != newFocusedFrame->document()) |
| 1033 return; | 1033 return; |
| 1034 | 1034 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1061 bool FocusController::setFocusedElement(Element* element, Frame* newFocusedFrame
, const FocusParams& params) | 1061 bool FocusController::setFocusedElement(Element* element, Frame* newFocusedFrame
, const FocusParams& params) |
| 1062 { | 1062 { |
| 1063 LocalFrame* oldFocusedFrame = focusedFrame(); | 1063 LocalFrame* oldFocusedFrame = focusedFrame(); |
| 1064 Document* oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : null
ptr; | 1064 Document* oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : null
ptr; |
| 1065 | 1065 |
| 1066 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : n
ullptr; | 1066 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : n
ullptr; |
| 1067 if (element && oldFocusedElement == element) | 1067 if (element && oldFocusedElement == element) |
| 1068 return true; | 1068 return true; |
| 1069 | 1069 |
| 1070 // FIXME: Might want to disable this check for caretBrowsing | 1070 // FIXME: Might want to disable this check for caretBrowsing |
| 1071 if (oldFocusedElement && oldFocusedElement->isRootEditableElement() && !reli
nquishesEditingFocus(*oldFocusedElement)) | 1071 if (oldFocusedElement && isRootEditableElement(*oldFocusedElement) && !relin
quishesEditingFocus(*oldFocusedElement)) |
| 1072 return false; | 1072 return false; |
| 1073 | 1073 |
| 1074 m_page->chromeClient().willSetInputMethodState(); | 1074 m_page->chromeClient().willSetInputMethodState(); |
| 1075 | 1075 |
| 1076 Document* newDocument = nullptr; | 1076 Document* newDocument = nullptr; |
| 1077 if (element) | 1077 if (element) |
| 1078 newDocument = &element->document(); | 1078 newDocument = &element->document(); |
| 1079 else if (newFocusedFrame && newFocusedFrame->isLocalFrame()) | 1079 else if (newFocusedFrame && newFocusedFrame->isLocalFrame()) |
| 1080 newDocument = toLocalFrame(newFocusedFrame)->document(); | 1080 newDocument = toLocalFrame(newFocusedFrame)->document(); |
| 1081 | 1081 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 return consumed; | 1308 return consumed; |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 DEFINE_TRACE(FocusController) | 1311 DEFINE_TRACE(FocusController) |
| 1312 { | 1312 { |
| 1313 visitor->trace(m_page); | 1313 visitor->trace(m_page); |
| 1314 visitor->trace(m_focusedFrame); | 1314 visitor->trace(m_focusedFrame); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 } // namespace blink | 1317 } // namespace blink |
| OLD | NEW |