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 15 matching lines...) Expand all Loading... | |
| 26 #include "core/html/HTMLDialogElement.h" | 26 #include "core/html/HTMLDialogElement.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "core/dom/AXObjectCache.h" | 29 #include "core/dom/AXObjectCache.h" |
| 30 #include "core/dom/ExceptionCode.h" | 30 #include "core/dom/ExceptionCode.h" |
| 31 #include "core/dom/NodeTraversal.h" | 31 #include "core/dom/NodeTraversal.h" |
| 32 #include "core/events/Event.h" | 32 #include "core/events/Event.h" |
| 33 #include "core/frame/FrameView.h" | 33 #include "core/frame/FrameView.h" |
| 34 #include "core/frame/UseCounter.h" | 34 #include "core/frame/UseCounter.h" |
| 35 #include "core/html/HTMLFormControlElement.h" | 35 #include "core/html/HTMLFormControlElement.h" |
| 36 #include "core/layout/LayoutView.h" | |
| 36 #include "core/style/ComputedStyle.h" | 37 #include "core/style/ComputedStyle.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 using namespace HTMLNames; | 41 using namespace HTMLNames; |
| 41 | 42 |
| 42 // This function chooses the focused element when show() or showModal() is | 43 // This function chooses the focused element when show() or showModal() is |
| 43 // invoked, as described in their spec. | 44 // invoked, as described in their spec. |
| 44 static void setFocusForDialog(HTMLDialogElement* dialog) { | 45 static void setFocusForDialog(HTMLDialogElement* dialog) { |
| 45 Element* focusableDescendant = 0; | 46 Element* focusableDescendant = 0; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 closeDialog(returnValue); | 110 closeDialog(returnValue); |
| 110 } | 111 } |
| 111 | 112 |
| 112 void HTMLDialogElement::closeDialog(const String& returnValue) { | 113 void HTMLDialogElement::closeDialog(const String& returnValue) { |
| 113 if (!fastHasAttribute(openAttr)) | 114 if (!fastHasAttribute(openAttr)) |
| 114 return; | 115 return; |
| 115 setBooleanAttribute(openAttr, false); | 116 setBooleanAttribute(openAttr, false); |
| 116 | 117 |
| 117 HTMLDialogElement* activeModalDialog = document().activeModalDialog(); | 118 HTMLDialogElement* activeModalDialog = document().activeModalDialog(); |
| 118 document().removeFromTopLayer(this); | 119 document().removeFromTopLayer(this); |
| 119 if (activeModalDialog == this) | 120 if (activeModalDialog == this) { |
| 120 inertSubtreesChanged(document()); | 121 inertSubtreesChanged(document()); |
| 122 // Any scrollers that were laid out when we were shown need to be laid out | |
| 123 // again now to keep FrameView::m_scrollableAreas up to date. To that end, | |
| 124 // force normal layout instead of simplified layout on the document. | |
| 125 // See crbug.com/633520 for details. | |
| 126 document().layoutView()->setNeedsLayout( | |
|
esprehn
2016/10/15 08:38:46
This should be in the top layer management code, n
| |
| 127 LayoutInvalidationReason::ChildChanged); | |
| 128 } | |
| 121 | 129 |
| 122 if (!returnValue.isNull()) | 130 if (!returnValue.isNull()) |
| 123 m_returnValue = returnValue; | 131 m_returnValue = returnValue; |
| 124 | 132 |
| 125 scheduleCloseEvent(); | 133 scheduleCloseEvent(); |
| 126 } | 134 } |
| 127 | 135 |
| 128 void HTMLDialogElement::forceLayoutForCentering() { | 136 void HTMLDialogElement::forceLayoutForCentering() { |
| 129 m_centeringMode = NeedsCentering; | 137 m_centeringMode = NeedsCentering; |
| 130 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 138 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 void HTMLDialogElement::defaultEventHandler(Event* event) { | 214 void HTMLDialogElement::defaultEventHandler(Event* event) { |
| 207 if (event->type() == EventTypeNames::cancel) { | 215 if (event->type() == EventTypeNames::cancel) { |
| 208 closeDialog(); | 216 closeDialog(); |
| 209 event->setDefaultHandled(); | 217 event->setDefaultHandled(); |
| 210 return; | 218 return; |
| 211 } | 219 } |
| 212 HTMLElement::defaultEventHandler(event); | 220 HTMLElement::defaultEventHandler(event); |
| 213 } | 221 } |
| 214 | 222 |
| 215 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |