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

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

Issue 2384273007: reflow comments in core/html/*.{cpp,h},core/html/imports (Closed)
Patch Set: comments Created 4 years, 2 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
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 21 matching lines...) Expand all
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/style/ComputedStyle.h" 36 #include "core/style/ComputedStyle.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 using namespace HTMLNames; 40 using namespace HTMLNames;
41 41
42 // This function chooses the focused element when show() or showModal() is invok ed, as described in their spec. 42 // This function chooses the focused element when show() or showModal() is
43 // invoked, as described in their spec.
43 static void setFocusForDialog(HTMLDialogElement* dialog) { 44 static void setFocusForDialog(HTMLDialogElement* dialog) {
44 Element* focusableDescendant = 0; 45 Element* focusableDescendant = 0;
45 Node* next = 0; 46 Node* next = 0;
46 for (Node* node = dialog->firstChild(); node; node = next) { 47 for (Node* node = dialog->firstChild(); node; node = next) {
47 if (isHTMLDialogElement(*node)) 48 if (isHTMLDialogElement(*node))
48 next = NodeTraversal::nextSkippingChildren(*node, dialog); 49 next = NodeTraversal::nextSkippingChildren(*node, dialog);
49 else 50 else
50 next = NodeTraversal::next(*node, dialog); 51 next = NodeTraversal::next(*node, dialog);
51 52
52 if (!node->isElementNode()) 53 if (!node->isElementNode())
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 160 }
160 if (!isConnected()) { 161 if (!isConnected()) {
161 exceptionState.throwDOMException(InvalidStateError, 162 exceptionState.throwDOMException(InvalidStateError,
162 "The element is not in a Document."); 163 "The element is not in a Document.");
163 return; 164 return;
164 } 165 }
165 166
166 document().addToTopLayer(this); 167 document().addToTopLayer(this);
167 setBooleanAttribute(openAttr, true); 168 setBooleanAttribute(openAttr, true);
168 169
169 // Throw away the AX cache first, so the subsequent steps don't have a chance of queuing up 170 // Throw away the AX cache first, so the subsequent steps don't have a chance
170 // AX events on objects that would be invalidated when the cache is thrown awa y. 171 // of queuing up AX events on objects that would be invalidated when the cache
172 // is thrown away.
171 inertSubtreesChanged(document()); 173 inertSubtreesChanged(document());
172 174
173 forceLayoutForCentering(); 175 forceLayoutForCentering();
174 setFocusForDialog(this); 176 setFocusForDialog(this);
175 } 177 }
176 178
177 void HTMLDialogElement::removedFrom(ContainerNode* insertionPoint) { 179 void HTMLDialogElement::removedFrom(ContainerNode* insertionPoint) {
178 HTMLElement::removedFrom(insertionPoint); 180 HTMLElement::removedFrom(insertionPoint);
179 setNotCentered(); 181 setNotCentered();
180 // FIXME: We should call inertSubtreesChanged() here. 182 // FIXME: We should call inertSubtreesChanged() here.
181 } 183 }
182 184
183 void HTMLDialogElement::setCentered(LayoutUnit centeredPosition) { 185 void HTMLDialogElement::setCentered(LayoutUnit centeredPosition) {
184 DCHECK_EQ(m_centeringMode, NeedsCentering); 186 DCHECK_EQ(m_centeringMode, NeedsCentering);
185 m_centeredPosition = centeredPosition; 187 m_centeredPosition = centeredPosition;
186 m_centeringMode = Centered; 188 m_centeringMode = Centered;
187 } 189 }
188 190
189 void HTMLDialogElement::setNotCentered() { 191 void HTMLDialogElement::setNotCentered() {
190 m_centeringMode = NotCentered; 192 m_centeringMode = NotCentered;
191 } 193 }
192 194
193 bool HTMLDialogElement::isPresentationAttribute( 195 bool HTMLDialogElement::isPresentationAttribute(
194 const QualifiedName& name) const { 196 const QualifiedName& name) const {
195 // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: modi fying an attribute for which there is an attribute selector 197 // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>:
196 // in html.css sometimes does not trigger a style recalc. 198 // modifying an attribute for which there is an attribute selector in html.css
199 // sometimes does not trigger a style recalc.
197 if (name == openAttr) 200 if (name == openAttr)
198 return true; 201 return true;
199 202
200 return HTMLElement::isPresentationAttribute(name); 203 return HTMLElement::isPresentationAttribute(name);
201 } 204 }
202 205
203 void HTMLDialogElement::defaultEventHandler(Event* event) { 206 void HTMLDialogElement::defaultEventHandler(Event* event) {
204 if (event->type() == EventTypeNames::cancel) { 207 if (event->type() == EventTypeNames::cancel) {
205 closeDialog(); 208 closeDialog();
206 event->setDefaultHandled(); 209 event->setDefaultHandled();
207 return; 210 return;
208 } 211 }
209 HTMLElement::defaultEventHandler(event); 212 HTMLElement::defaultEventHandler(event);
210 } 213 }
211 214
212 } // namespace blink 215 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLDimension.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698