Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 74 |
| 75 if (dialog->IsFocusable()) { | 75 if (dialog->IsFocusable()) { |
| 76 dialog->focus(); | 76 dialog->focus(); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 dialog->GetDocument().ClearFocusedElement(); | 80 dialog->GetDocument().ClearFocusedElement(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static void InertSubtreesChanged(Document& document) { | 83 static void InertSubtreesChanged(Document& document) { |
| 84 // TODO(kenrb): Am I correct in thinking that this will never get called on | |
| 85 // and element that is in a frame that is already inert? If not, we | |
| 86 // need to get the embedding frame's inert value and use that instead of | |
| 87 // false. | |
| 88 if (document.GetFrame()) | |
| 89 document.GetFrame()->SetIsInert(false); | |
| 90 | |
| 84 // When a modal dialog opens or closes, nodes all over the accessibility | 91 // When a modal dialog opens or closes, nodes all over the accessibility |
| 85 // tree can change inertness which means they must be added or removed from | 92 // tree can change inertness which means they must be added or removed from |
| 86 // the tree. The most foolproof way is to clear the entire tree and rebuild | 93 // the tree. The most foolproof way is to clear the entire tree and rebuild |
| 87 // it, though a more clever way is probably possible. | 94 // it, though a more clever way is probably possible. |
| 88 document.ClearAXObjectCache(); | 95 document.ClearAXObjectCache(); |
| 89 if (AXObjectCache* cache = document.AxObjectCache()) | 96 if (AXObjectCache* cache = document.AxObjectCache()) |
| 90 cache->ChildrenChanged(&document); | 97 cache->ChildrenChanged(&document); |
| 91 } | 98 } |
| 92 | 99 |
| 93 inline HTMLDialogElement::HTMLDialogElement(Document& document) | 100 inline HTMLDialogElement::HTMLDialogElement(Document& document) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 // is thrown away. | 182 // is thrown away. |
| 176 InertSubtreesChanged(GetDocument()); | 183 InertSubtreesChanged(GetDocument()); |
| 177 | 184 |
| 178 ForceLayoutForCentering(); | 185 ForceLayoutForCentering(); |
| 179 SetFocusForDialog(this); | 186 SetFocusForDialog(this); |
| 180 } | 187 } |
| 181 | 188 |
| 182 void HTMLDialogElement::RemovedFrom(ContainerNode* insertion_point) { | 189 void HTMLDialogElement::RemovedFrom(ContainerNode* insertion_point) { |
| 183 HTMLElement::RemovedFrom(insertion_point); | 190 HTMLElement::RemovedFrom(insertion_point); |
| 184 SetNotCentered(); | 191 SetNotCentered(); |
| 185 // FIXME: We should call inertSubtreesChanged() here. | 192 // FIXME: We should call inertSubtreesChanged() here. |
|
kenrb
2017/05/15 20:51:53
Does this become a problem? With an inert bit bein
| |
| 186 } | 193 } |
| 187 | 194 |
| 188 void HTMLDialogElement::SetCentered(LayoutUnit centered_position) { | 195 void HTMLDialogElement::SetCentered(LayoutUnit centered_position) { |
| 189 DCHECK_EQ(centering_mode_, kNeedsCentering); | 196 DCHECK_EQ(centering_mode_, kNeedsCentering); |
| 190 centered_position_ = centered_position; | 197 centered_position_ = centered_position; |
| 191 centering_mode_ = kCentered; | 198 centering_mode_ = kCentered; |
| 192 } | 199 } |
| 193 | 200 |
| 194 void HTMLDialogElement::SetNotCentered() { | 201 void HTMLDialogElement::SetNotCentered() { |
| 195 centering_mode_ = kNotCentered; | 202 centering_mode_ = kNotCentered; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 209 void HTMLDialogElement::DefaultEventHandler(Event* event) { | 216 void HTMLDialogElement::DefaultEventHandler(Event* event) { |
| 210 if (event->type() == EventTypeNames::cancel) { | 217 if (event->type() == EventTypeNames::cancel) { |
| 211 CloseDialog(); | 218 CloseDialog(); |
| 212 event->SetDefaultHandled(); | 219 event->SetDefaultHandled(); |
| 213 return; | 220 return; |
| 214 } | 221 } |
| 215 HTMLElement::DefaultEventHandler(event); | 222 HTMLElement::DefaultEventHandler(event); |
| 216 } | 223 } |
| 217 | 224 |
| 218 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |