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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 if (!returnValue.isNull()) | 123 if (!returnValue.isNull()) |
124 m_returnValue = returnValue; | 124 m_returnValue = returnValue; |
125 | 125 |
126 dispatchScopedEvent(Event::create(EventTypeNames::close)); | 126 dispatchScopedEvent(Event::create(EventTypeNames::close)); |
127 } | 127 } |
128 | 128 |
129 void HTMLDialogElement::forceLayoutForCentering() | 129 void HTMLDialogElement::forceLayoutForCentering() |
130 { | 130 { |
131 m_centeringMode = NeedsCentering; | 131 m_centeringMode = NeedsCentering; |
132 document().updateLayoutIgnorePendingStylesheets(); | 132 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
133 if (m_centeringMode == NeedsCentering) | 133 if (m_centeringMode == NeedsCentering) |
134 setNotCentered(); | 134 setNotCentered(); |
135 } | 135 } |
136 | 136 |
137 void HTMLDialogElement::show() | 137 void HTMLDialogElement::show() |
138 { | 138 { |
139 if (fastHasAttribute(openAttr)) | 139 if (fastHasAttribute(openAttr)) |
140 return; | 140 return; |
141 setBooleanAttribute(openAttr, true); | 141 setBooleanAttribute(openAttr, true); |
142 | 142 |
143 // The layout must be updated here because setFocusForDialog calls | 143 // The layout must be updated here because setFocusForDialog calls |
144 // Element::isFocusable, which requires an up-to-date layout. | 144 // Element::isFocusable, which requires an up-to-date layout. |
145 document().updateLayoutIgnorePendingStylesheets(); | 145 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
146 | 146 |
147 setFocusForDialog(this); | 147 setFocusForDialog(this); |
148 } | 148 } |
149 | 149 |
150 void HTMLDialogElement::showModal(ExceptionState& exceptionState) | 150 void HTMLDialogElement::showModal(ExceptionState& exceptionState) |
151 { | 151 { |
152 if (fastHasAttribute(openAttr)) { | 152 if (fastHasAttribute(openAttr)) { |
153 exceptionState.throwDOMException(InvalidStateError, "The element already
has an 'open' attribute, and therefore cannot be opened modally."); | 153 exceptionState.throwDOMException(InvalidStateError, "The element already
has an 'open' attribute, and therefore cannot be opened modally."); |
154 return; | 154 return; |
155 } | 155 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 { | 202 { |
203 if (event->type() == EventTypeNames::cancel) { | 203 if (event->type() == EventTypeNames::cancel) { |
204 closeDialog(); | 204 closeDialog(); |
205 event->setDefaultHandled(); | 205 event->setDefaultHandled(); |
206 return; | 206 return; |
207 } | 207 } |
208 HTMLElement::defaultEventHandler(event); | 208 HTMLElement::defaultEventHandler(event); |
209 } | 209 } |
210 | 210 |
211 } // namespace blink | 211 } // namespace blink |
OLD | NEW |