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

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

Issue 327633004: Apply DEFINE/DECLARE_NODE_FACTORY(T) macro to element factories with single Document& argument. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/html/HTMLDialogElement.h ('k') | Source/core/html/HTMLDirectoryElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // When a modal dialog opens or closes, nodes all over the accessibility 82 // When a modal dialog opens or closes, nodes all over the accessibility
83 // tree can change inertness which means they must be added or removed from 83 // tree can change inertness which means they must be added or removed from
84 // the tree. The most foolproof way is to clear the entire tree and rebuild 84 // the tree. The most foolproof way is to clear the entire tree and rebuild
85 // it, though a more clever way is probably possible. 85 // it, though a more clever way is probably possible.
86 Document& topDocument = document.topDocument(); 86 Document& topDocument = document.topDocument();
87 topDocument.clearAXObjectCache(); 87 topDocument.clearAXObjectCache();
88 if (AXObjectCache* cache = topDocument.axObjectCache()) 88 if (AXObjectCache* cache = topDocument.axObjectCache())
89 cache->childrenChanged(cache->getOrCreate(&topDocument)); 89 cache->childrenChanged(cache->getOrCreate(&topDocument));
90 } 90 }
91 91
92 HTMLDialogElement::HTMLDialogElement(Document& document) 92 inline HTMLDialogElement::HTMLDialogElement(Document& document)
93 : HTMLElement(dialogTag, document) 93 : HTMLElement(dialogTag, document)
94 , m_centeringMode(NotCentered) 94 , m_centeringMode(NotCentered)
95 , m_centeredPosition(0) 95 , m_centeredPosition(0)
96 , m_returnValue("") 96 , m_returnValue("")
97 { 97 {
98 ScriptWrappable::init(this); 98 ScriptWrappable::init(this);
99 } 99 }
100 100
101 PassRefPtrWillBeRawPtr<HTMLDialogElement> HTMLDialogElement::create(Document& do cument) 101 DEFINE_NODE_FACTORY(HTMLDialogElement)
102 {
103 return adoptRefWillBeRefCountedGarbageCollected(new HTMLDialogElement(docume nt));
104 }
105 102
106 void HTMLDialogElement::close(const String& returnValue, ExceptionState& excepti onState) 103 void HTMLDialogElement::close(const String& returnValue, ExceptionState& excepti onState)
107 { 104 {
108 if (!fastHasAttribute(openAttr)) { 105 if (!fastHasAttribute(openAttr)) {
109 exceptionState.throwDOMException(InvalidStateError, "The element does no t have an 'open' attribute, and therefore cannot be closed."); 106 exceptionState.throwDOMException(InvalidStateError, "The element does no t have an 'open' attribute, and therefore cannot be closed.");
110 return; 107 return;
111 } 108 }
112 closeDialog(returnValue); 109 closeDialog(returnValue);
113 } 110 }
114 111
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 196 {
200 if (event->type() == EventTypeNames::cancel) { 197 if (event->type() == EventTypeNames::cancel) {
201 closeDialog(); 198 closeDialog();
202 event->setDefaultHandled(); 199 event->setDefaultHandled();
203 return; 200 return;
204 } 201 }
205 HTMLElement::defaultEventHandler(event); 202 HTMLElement::defaultEventHandler(event);
206 } 203 }
207 204
208 } // namespace WebCore 205 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLDialogElement.h ('k') | Source/core/html/HTMLDirectoryElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698