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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 Document* new_document = nullptr; | 1108 Document* new_document = nullptr; |
1109 if (element) | 1109 if (element) |
1110 new_document = &element->GetDocument(); | 1110 new_document = &element->GetDocument(); |
1111 else if (new_focused_frame && new_focused_frame->IsLocalFrame()) | 1111 else if (new_focused_frame && new_focused_frame->IsLocalFrame()) |
1112 new_document = ToLocalFrame(new_focused_frame)->GetDocument(); | 1112 new_document = ToLocalFrame(new_focused_frame)->GetDocument(); |
1113 | 1113 |
1114 if (new_document && old_document == new_document && | 1114 if (new_document && old_document == new_document && |
1115 new_document->FocusedElement() == element) | 1115 new_document->FocusedElement() == element) |
1116 return true; | 1116 return true; |
1117 | 1117 |
1118 | |
1119 if (old_document && old_document != new_document) | 1118 if (old_document && old_document != new_document) |
1120 old_document->ClearFocusedElement(); | 1119 old_document->ClearFocusedElement(); |
1121 | 1120 |
1122 if (new_focused_frame && !new_focused_frame->GetPage()) { | 1121 if (new_focused_frame && !new_focused_frame->GetPage()) { |
1123 SetFocusedFrame(nullptr); | 1122 SetFocusedFrame(nullptr); |
1124 return false; | 1123 return false; |
1125 } | 1124 } |
1126 SetFocusedFrame(new_focused_frame); | 1125 SetFocusedFrame(new_focused_frame); |
1127 | 1126 |
1128 if (new_document) { | 1127 if (new_document) { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 it->FocusedFrameChanged(); | 1409 it->FocusedFrameChanged(); |
1411 } | 1410 } |
1412 | 1411 |
1413 DEFINE_TRACE(FocusController) { | 1412 DEFINE_TRACE(FocusController) { |
1414 visitor->Trace(page_); | 1413 visitor->Trace(page_); |
1415 visitor->Trace(focused_frame_); | 1414 visitor->Trace(focused_frame_); |
1416 visitor->Trace(focus_changed_observers_); | 1415 visitor->Trace(focus_changed_observers_); |
1417 } | 1416 } |
1418 | 1417 |
1419 } // namespace blink | 1418 } // namespace blink |
OLD | NEW |