Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: Source/core/html/HTMLDialogElement.cpp

Issue 139743005: Replace RenderFullScreen with top layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: needs baseline Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 topDocument->clearAXObjectCache(); 88 topDocument->clearAXObjectCache();
89 if (AXObjectCache* cache = topDocument->axObjectCache()) 89 if (AXObjectCache* cache = topDocument->axObjectCache())
90 cache->childrenChanged(cache->getOrCreate(topDocument)); 90 cache->childrenChanged(cache->getOrCreate(topDocument));
91 } 91 }
92 92
93 HTMLDialogElement::HTMLDialogElement(Document& document) 93 HTMLDialogElement::HTMLDialogElement(Document& document)
94 : HTMLElement(dialogTag, document) 94 : HTMLElement(dialogTag, document)
95 , m_centeringMode(Uninitialized) 95 , m_centeringMode(Uninitialized)
96 , m_centeredPosition(0) 96 , m_centeredPosition(0)
97 , m_returnValue("") 97 , m_returnValue("")
98 , m_modal(false)
98 { 99 {
99 ScriptWrappable::init(this); 100 ScriptWrappable::init(this);
100 } 101 }
101 102
102 PassRefPtr<HTMLDialogElement> HTMLDialogElement::create(Document& document) 103 PassRefPtr<HTMLDialogElement> HTMLDialogElement::create(Document& document)
103 { 104 {
104 return adoptRef(new HTMLDialogElement(document)); 105 return adoptRef(new HTMLDialogElement(document));
105 } 106 }
106 107
107 void HTMLDialogElement::close(const String& returnValue, ExceptionState& excepti onState) 108 void HTMLDialogElement::close(const String& returnValue, ExceptionState& excepti onState)
108 { 109 {
109 if (!fastHasAttribute(openAttr)) { 110 if (!fastHasAttribute(openAttr)) {
110 exceptionState.throwDOMException(InvalidStateError, "The element does no t have an 'open' attribute, and therefore cannot be closed."); 111 exceptionState.throwDOMException(InvalidStateError, "The element does no t have an 'open' attribute, and therefore cannot be closed.");
111 return; 112 return;
112 } 113 }
113 closeDialog(returnValue); 114 closeDialog(returnValue);
114 } 115 }
115 116
117 void HTMLDialogElement::removedFrom(ContainerNode* insertionPoint)
118 {
119 document().removeFromModalDialogStack(this);
esprehn 2014/01/21 18:59:05 Remove all this, I don't think you should need the
falken 2014/01/22 06:08:02 OK but we still need removedFrom to reset m_modal.
120 HTMLElement::removedFrom(insertionPoint);
121 }
122
116 void HTMLDialogElement::closeDialog(const String& returnValue) 123 void HTMLDialogElement::closeDialog(const String& returnValue)
117 { 124 {
118 if (!fastHasAttribute(openAttr)) 125 if (!fastHasAttribute(openAttr))
119 return; 126 return;
120 setBooleanAttribute(openAttr, false); 127 setBooleanAttribute(openAttr, false);
121 128
122 HTMLDialogElement* activeModalDialog = document().activeModalDialog(); 129 HTMLDialogElement* activeModalDialog = document().activeModalDialog();
123 document().removeFromTopLayer(this); 130 document().removeFromModalDialogStack(this);
124 if (activeModalDialog == this) 131 if (activeModalDialog == this)
125 inertSubtreesChanged(document()); 132 inertSubtreesChanged(document());
126 133
127 if (!returnValue.isNull()) 134 if (!returnValue.isNull())
128 m_returnValue = returnValue; 135 m_returnValue = returnValue;
129 136
130 dispatchScopedEvent(Event::create(EventTypeNames::close)); 137 dispatchScopedEvent(Event::create(EventTypeNames::close));
131 } 138 }
132 139
133 void HTMLDialogElement::forceLayoutForCentering() 140 void HTMLDialogElement::forceLayoutForCentering()
(...skipping 16 matching lines...) Expand all
150 { 157 {
151 if (fastHasAttribute(openAttr)) { 158 if (fastHasAttribute(openAttr)) {
152 exceptionState.throwDOMException(InvalidStateError, "The element already has an 'open' attribute, and therefore cannot be opened modally."); 159 exceptionState.throwDOMException(InvalidStateError, "The element already has an 'open' attribute, and therefore cannot be opened modally.");
153 return; 160 return;
154 } 161 }
155 if (!inDocument()) { 162 if (!inDocument()) {
156 exceptionState.throwDOMException(InvalidStateError, "The element is not in a Document."); 163 exceptionState.throwDOMException(InvalidStateError, "The element is not in a Document.");
157 return; 164 return;
158 } 165 }
159 166
160 document().addToTopLayer(this); 167 document().addToModalDialogStack(this);
161 setBooleanAttribute(openAttr, true); 168 setBooleanAttribute(openAttr, true);
162 169
163 // Throw away the AX cache first, so the subsequent steps don't have a chanc e of queuing up 170 // Throw away the AX cache first, so the subsequent steps don't have a chanc e of queuing up
164 // AX events on objects that would be invalidated when the cache is thrown a way. 171 // AX events on objects that would be invalidated when the cache is thrown a way.
165 inertSubtreesChanged(document()); 172 inertSubtreesChanged(document());
166 173
167 forceLayoutForCentering(); 174 forceLayoutForCentering();
168 setFocusForModalDialog(this); 175 setFocusForModalDialog(this);
169 } 176 }
170 177
(...skipping 24 matching lines...) Expand all
195 { 202 {
196 if (event->type() == EventTypeNames::cancel) { 203 if (event->type() == EventTypeNames::cancel) {
197 closeDialog(); 204 closeDialog();
198 event->setDefaultHandled(); 205 event->setDefaultHandled();
199 return; 206 return;
200 } 207 }
201 HTMLElement::defaultEventHandler(event); 208 HTMLElement::defaultEventHandler(event);
202 } 209 }
203 210
204 } // namespace WebCore 211 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698