Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 #include "core/accessibility/AXSlider.h" | 51 #include "core/accessibility/AXSlider.h" |
| 52 #include "core/accessibility/AXSpinButton.h" | 52 #include "core/accessibility/AXSpinButton.h" |
| 53 #include "core/accessibility/AXTable.h" | 53 #include "core/accessibility/AXTable.h" |
| 54 #include "core/accessibility/AXTableCell.h" | 54 #include "core/accessibility/AXTableCell.h" |
| 55 #include "core/accessibility/AXTableColumn.h" | 55 #include "core/accessibility/AXTableColumn.h" |
| 56 #include "core/accessibility/AXTableHeaderContainer.h" | 56 #include "core/accessibility/AXTableHeaderContainer.h" |
| 57 #include "core/accessibility/AXTableRow.h" | 57 #include "core/accessibility/AXTableRow.h" |
| 58 #include "core/dom/Document.h" | 58 #include "core/dom/Document.h" |
| 59 #include "core/frame/Frame.h" | 59 #include "core/frame/Frame.h" |
| 60 #include "core/html/HTMLAreaElement.h" | 60 #include "core/html/HTMLAreaElement.h" |
| 61 #include "core/html/HTMLDialogElement.h" | |
| 61 #include "core/html/HTMLImageElement.h" | 62 #include "core/html/HTMLImageElement.h" |
| 62 #include "core/html/HTMLInputElement.h" | 63 #include "core/html/HTMLInputElement.h" |
| 63 #include "core/html/HTMLLabelElement.h" | 64 #include "core/html/HTMLLabelElement.h" |
| 64 #include "core/page/Chrome.h" | 65 #include "core/page/Chrome.h" |
| 65 #include "core/page/ChromeClient.h" | 66 #include "core/page/ChromeClient.h" |
| 66 #include "core/page/FocusController.h" | 67 #include "core/page/FocusController.h" |
| 67 #include "core/page/Page.h" | 68 #include "core/page/Page.h" |
| 68 #include "core/platform/ScrollView.h" | 69 #include "core/platform/ScrollView.h" |
| 69 #include "core/rendering/AbstractInlineTextBox.h" | 70 #include "core/rendering/AbstractInlineTextBox.h" |
| 70 #include "core/rendering/RenderListBox.h" | 71 #include "core/rendering/RenderListBox.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 { | 161 { |
| 161 if (!gAccessibilityEnabled) | 162 if (!gAccessibilityEnabled) |
| 162 return 0; | 163 return 0; |
| 163 | 164 |
| 164 // get the focused node in the page | 165 // get the focused node in the page |
| 165 Document* focusedDocument = page->focusController().focusedOrMainFrame()->do cument(); | 166 Document* focusedDocument = page->focusController().focusedOrMainFrame()->do cument(); |
| 166 Node* focusedNode = focusedDocument->focusedElement(); | 167 Node* focusedNode = focusedDocument->focusedElement(); |
| 167 if (!focusedNode) | 168 if (!focusedNode) |
| 168 focusedNode = focusedDocument; | 169 focusedNode = focusedDocument; |
| 169 | 170 |
| 171 // If a modal dialog is active, let it have default focus instead of the doc ument. JAWS | |
|
dmazzoni
2013/12/10 08:07:53
I'd eliminate the comment about JAWS here - I thin
| |
| 172 // seems to rely on focus changing within the document to update its AT tree , so otherwise | |
| 173 // JAWS will allow navigation into inert content. | |
| 174 if (focusedNode == focusedDocument) { | |
|
dmazzoni
2013/12/10 08:07:53
Would it be possible that focus is outside the dia
falken
2013/12/10 12:19:57
It's possible if you have something like:
<body>
| |
| 175 if (HTMLDialogElement* dialog = focusedDocument->activeModalDialog()) | |
| 176 focusedNode = dialog; | |
| 177 } | |
| 178 | |
| 170 if (isHTMLAreaElement(focusedNode)) | 179 if (isHTMLAreaElement(focusedNode)) |
| 171 return focusedImageMapUIElement(toHTMLAreaElement(focusedNode)); | 180 return focusedImageMapUIElement(toHTMLAreaElement(focusedNode)); |
| 172 | 181 |
| 173 AXObject* obj = focusedNode->document().axObjectCache()->getOrCreate(focused Node); | 182 AXObject* obj = focusedNode->document().axObjectCache()->getOrCreate(focused Node); |
| 174 if (!obj) | 183 if (!obj) |
| 175 return 0; | 184 return 0; |
| 176 | 185 |
| 177 if (obj->shouldFocusActiveDescendant()) { | 186 if (obj->shouldFocusActiveDescendant()) { |
| 178 if (AXObject* descendant = obj->activeDescendant()) | 187 if (AXObject* descendant = obj->activeDescendant()) |
| 179 obj = descendant; | 188 obj = descendant; |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 989 if (!obj || !obj->document() || !obj->documentFrameView() || !obj->documentF rameView()->frame().page()) | 998 if (!obj || !obj->document() || !obj->documentFrameView() || !obj->documentF rameView()->frame().page()) |
| 990 return; | 999 return; |
| 991 | 1000 |
| 992 ChromeClient& client = obj->documentFrameView()->frame().page()->chrome().cl ient(); | 1001 ChromeClient& client = obj->documentFrameView()->frame().page()->chrome().cl ient(); |
| 993 | 1002 |
| 994 if (notification == AXActiveDescendantChanged | 1003 if (notification == AXActiveDescendantChanged |
| 995 && obj->document()->focusedElement() | 1004 && obj->document()->focusedElement() |
| 996 && obj->node() == obj->document()->focusedElement()) { | 1005 && obj->node() == obj->document()->focusedElement()) { |
| 997 // Calling handleFocusedUIElementChanged will focus the new active | 1006 // Calling handleFocusedUIElementChanged will focus the new active |
| 998 // descendant and send the AXFocusedUIElementChanged notification. | 1007 // descendant and send the AXFocusedUIElementChanged notification. |
| 999 handleFocusedUIElementChanged(0, obj->document()->focusedElement()); | 1008 handleFocusedUIElementChanged(*obj->document()); |
| 1000 } | 1009 } |
| 1001 | 1010 |
| 1002 client.postAccessibilityNotification(obj, notification); | 1011 client.postAccessibilityNotification(obj, notification); |
| 1003 } | 1012 } |
| 1004 | 1013 |
| 1005 void AXObjectCache::handleFocusedUIElementChanged(Node*, Node* newFocusedNode) | 1014 void AXObjectCache::handleFocusedUIElementChanged(const Document& document) |
| 1006 { | 1015 { |
| 1007 if (!newFocusedNode) | 1016 Page* page = document.page(); |
| 1008 return; | |
| 1009 | |
| 1010 Page* page = newFocusedNode->document().page(); | |
| 1011 if (!page) | 1017 if (!page) |
| 1012 return; | 1018 return; |
| 1013 | 1019 |
| 1014 AXObject* focusedObject = focusedUIElementForPage(page); | 1020 AXObject* focusedObject = focusedUIElementForPage(page); |
| 1015 if (!focusedObject) | 1021 if (!focusedObject) |
| 1016 return; | 1022 return; |
| 1017 | 1023 |
| 1018 postPlatformNotification(focusedObject, AXFocusedUIElementChanged); | 1024 postPlatformNotification(focusedObject, AXFocusedUIElementChanged); |
| 1019 } | 1025 } |
| 1020 | 1026 |
| 1021 void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode) | 1027 void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode) |
| 1022 { | 1028 { |
| 1023 // The anchor node may not be accessible. Post the notification for the | 1029 // The anchor node may not be accessible. Post the notification for the |
| 1024 // first accessible object. | 1030 // first accessible object. |
| 1025 postPlatformNotification(AXObject::firstAccessibleObjectFromNode(anchorNode) , AXScrolledToAnchor); | 1031 postPlatformNotification(AXObject::firstAccessibleObjectFromNode(anchorNode) , AXScrolledToAnchor); |
| 1026 } | 1032 } |
| 1027 | 1033 |
| 1028 } // namespace WebCore | 1034 } // namespace WebCore |
| OLD | NEW |