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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 setBooleanAttribute(openAttr, false); | 115 setBooleanAttribute(openAttr, false); |
116 | 116 |
117 HTMLDialogElement* activeModalDialog = document().activeModalDialog(); | 117 HTMLDialogElement* activeModalDialog = document().activeModalDialog(); |
118 document().removeFromTopLayer(this); | 118 document().removeFromTopLayer(this); |
119 if (activeModalDialog == this) | 119 if (activeModalDialog == this) |
120 inertSubtreesChanged(document()); | 120 inertSubtreesChanged(document()); |
121 | 121 |
122 if (!returnValue.isNull()) | 122 if (!returnValue.isNull()) |
123 m_returnValue = returnValue; | 123 m_returnValue = returnValue; |
124 | 124 |
125 dispatchScopedEvent(Event::create(EventTypeNames::close)); | 125 scheduleCloseEvent(); |
126 } | 126 } |
127 | 127 |
128 void HTMLDialogElement::forceLayoutForCentering() | 128 void HTMLDialogElement::forceLayoutForCentering() |
129 { | 129 { |
130 m_centeringMode = NeedsCentering; | 130 m_centeringMode = NeedsCentering; |
131 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 131 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
132 if (m_centeringMode == NeedsCentering) | 132 if (m_centeringMode == NeedsCentering) |
133 setNotCentered(); | 133 setNotCentered(); |
134 } | 134 } |
135 | 135 |
| 136 void HTMLDialogElement::scheduleCloseEvent() |
| 137 { |
| 138 Event* event = Event::create(EventTypeNames::close); |
| 139 event->setTarget(this); |
| 140 document().enqueueAnimationFrameEvent(event); |
| 141 } |
| 142 |
136 void HTMLDialogElement::show() | 143 void HTMLDialogElement::show() |
137 { | 144 { |
138 if (fastHasAttribute(openAttr)) | 145 if (fastHasAttribute(openAttr)) |
139 return; | 146 return; |
140 setBooleanAttribute(openAttr, true); | 147 setBooleanAttribute(openAttr, true); |
141 | 148 |
142 // The layout must be updated here because setFocusForDialog calls | 149 // The layout must be updated here because setFocusForDialog calls |
143 // Element::isFocusable, which requires an up-to-date layout. | 150 // Element::isFocusable, which requires an up-to-date layout. |
144 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 151 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
145 | 152 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 { | 208 { |
202 if (event->type() == EventTypeNames::cancel) { | 209 if (event->type() == EventTypeNames::cancel) { |
203 closeDialog(); | 210 closeDialog(); |
204 event->setDefaultHandled(); | 211 event->setDefaultHandled(); |
205 return; | 212 return; |
206 } | 213 } |
207 HTMLElement::defaultEventHandler(event); | 214 HTMLElement::defaultEventHandler(event); |
208 } | 215 } |
209 | 216 |
210 } // namespace blink | 217 } // namespace blink |
OLD | NEW |