| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 while (first && | 200 while (first && |
| 201 !ScopedFocusNavigation::isSlotFallbackScopedForThisSlot( | 201 !ScopedFocusNavigation::isSlotFallbackScopedForThisSlot( |
| 202 *m_rootSlot, *first)) | 202 *m_rootSlot, *first)) |
| 203 first = ElementTraversal::next(*first, m_rootSlot); | 203 first = ElementTraversal::next(*first, m_rootSlot); |
| 204 m_current = first; | 204 m_current = first; |
| 205 } | 205 } |
| 206 } else { | 206 } else { |
| 207 Element* first = m_rootNode->isElementNode() | 207 Element* first = m_rootNode->isElementNode() |
| 208 ? &toElement(*m_rootNode) | 208 ? &toElement(*m_rootNode) |
| 209 : ElementTraversal::next(*m_rootNode); | 209 : ElementTraversal::next(*m_rootNode); |
| 210 while (first && (SlotScopedTraversal::isSlotScoped(*first) || | 210 while (first && |
| 211 ScopedFocusNavigation::isSlotFallbackScoped(*first))) | 211 (SlotScopedTraversal::isSlotScoped(*first) || |
| 212 ScopedFocusNavigation::isSlotFallbackScoped(*first))) |
| 212 first = ElementTraversal::next(*first, m_rootNode); | 213 first = ElementTraversal::next(*first, m_rootNode); |
| 213 m_current = first; | 214 m_current = first; |
| 214 } | 215 } |
| 215 } | 216 } |
| 216 | 217 |
| 217 void ScopedFocusNavigation::moveToLast() { | 218 void ScopedFocusNavigation::moveToLast() { |
| 218 if (m_rootSlot) { | 219 if (m_rootSlot) { |
| 219 if (!m_slotFallbackTraversal) { | 220 if (!m_slotFallbackTraversal) { |
| 220 m_current = SlotScopedTraversal::lastAssignedToSlot(*m_rootSlot); | 221 m_current = SlotScopedTraversal::lastAssignedToSlot(*m_rootSlot); |
| 221 } else { | 222 } else { |
| 222 Element* last = ElementTraversal::lastWithin(*m_rootSlot); | 223 Element* last = ElementTraversal::lastWithin(*m_rootSlot); |
| 223 while (last && | 224 while (last && |
| 224 !ScopedFocusNavigation::isSlotFallbackScopedForThisSlot( | 225 !ScopedFocusNavigation::isSlotFallbackScopedForThisSlot( |
| 225 *m_rootSlot, *last)) | 226 *m_rootSlot, *last)) |
| 226 last = ElementTraversal::previous(*last, m_rootSlot); | 227 last = ElementTraversal::previous(*last, m_rootSlot); |
| 227 m_current = last; | 228 m_current = last; |
| 228 } | 229 } |
| 229 } else { | 230 } else { |
| 230 Element* last = ElementTraversal::lastWithin(*m_rootNode); | 231 Element* last = ElementTraversal::lastWithin(*m_rootNode); |
| 231 while (last && (SlotScopedTraversal::isSlotScoped(*last) || | 232 while (last && |
| 232 ScopedFocusNavigation::isSlotFallbackScoped(*last))) | 233 (SlotScopedTraversal::isSlotScoped(*last) || |
| 234 ScopedFocusNavigation::isSlotFallbackScoped(*last))) |
| 233 last = ElementTraversal::previous(*last, m_rootNode); | 235 last = ElementTraversal::previous(*last, m_rootNode); |
| 234 m_current = last; | 236 m_current = last; |
| 235 } | 237 } |
| 236 } | 238 } |
| 237 | 239 |
| 238 Element* ScopedFocusNavigation::owner() const { | 240 Element* ScopedFocusNavigation::owner() const { |
| 239 if (m_rootSlot) | 241 if (m_rootSlot) |
| 240 return m_rootSlot; | 242 return m_rootSlot; |
| 241 DCHECK(m_rootNode); | 243 DCHECK(m_rootNode); |
| 242 if (m_rootNode->isShadowRoot()) { | 244 if (m_rootNode->isShadowRoot()) { |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 it->focusedFrameChanged(); | 1417 it->focusedFrameChanged(); |
| 1416 } | 1418 } |
| 1417 | 1419 |
| 1418 DEFINE_TRACE(FocusController) { | 1420 DEFINE_TRACE(FocusController) { |
| 1419 visitor->trace(m_page); | 1421 visitor->trace(m_page); |
| 1420 visitor->trace(m_focusedFrame); | 1422 visitor->trace(m_focusedFrame); |
| 1421 visitor->trace(m_focusChangedObservers); | 1423 visitor->trace(m_focusChangedObservers); |
| 1422 } | 1424 } |
| 1423 | 1425 |
| 1424 } // namespace blink | 1426 } // namespace blink |
| OLD | NEW |