| 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/html/HTMLDialogElement.h" | 27 #include "core/html/HTMLDialogElement.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
| 30 #include "core/accessibility/AXObjectCache.h" | 30 #include "core/accessibility/AXObjectCache.h" |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
| 33 #include "core/events/Event.h" | 33 #include "core/events/Event.h" |
| 34 #include "core/frame/UseCounter.h" |
| 34 #include "core/html/HTMLFormControlElement.h" | 35 #include "core/html/HTMLFormControlElement.h" |
| 35 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 36 #include "core/rendering/RenderBlock.h" | 37 #include "core/rendering/RenderBlock.h" |
| 37 #include "core/rendering/style/RenderStyle.h" | 38 #include "core/rendering/style/RenderStyle.h" |
| 38 | 39 |
| 39 namespace WebCore { | 40 namespace WebCore { |
| 40 | 41 |
| 41 using namespace HTMLNames; | 42 using namespace HTMLNames; |
| 42 | 43 |
| 43 // This function chooses the focused element when showModal() is invoked, as des
cribed in the spec for showModal(). | 44 // This function chooses the focused element when showModal() is invoked, as des
cribed in the spec for showModal(). |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 cache->childrenChanged(cache->getOrCreate(&topDocument)); | 91 cache->childrenChanged(cache->getOrCreate(&topDocument)); |
| 91 } | 92 } |
| 92 | 93 |
| 93 inline HTMLDialogElement::HTMLDialogElement(Document& document) | 94 inline HTMLDialogElement::HTMLDialogElement(Document& document) |
| 94 : HTMLElement(dialogTag, document) | 95 : HTMLElement(dialogTag, document) |
| 95 , m_centeringMode(NotCentered) | 96 , m_centeringMode(NotCentered) |
| 96 , m_centeredPosition(0) | 97 , m_centeredPosition(0) |
| 97 , m_returnValue("") | 98 , m_returnValue("") |
| 98 { | 99 { |
| 99 ScriptWrappable::init(this); | 100 ScriptWrappable::init(this); |
| 101 UseCounter::count(document, UseCounter::DialogElement); |
| 100 } | 102 } |
| 101 | 103 |
| 102 DEFINE_NODE_FACTORY(HTMLDialogElement) | 104 DEFINE_NODE_FACTORY(HTMLDialogElement) |
| 103 | 105 |
| 104 void HTMLDialogElement::close(const String& returnValue, ExceptionState& excepti
onState) | 106 void HTMLDialogElement::close(const String& returnValue, ExceptionState& excepti
onState) |
| 105 { | 107 { |
| 106 if (!fastHasAttribute(openAttr)) { | 108 if (!fastHasAttribute(openAttr)) { |
| 107 exceptionState.throwDOMException(InvalidStateError, "The element does no
t have an 'open' attribute, and therefore cannot be closed."); | 109 exceptionState.throwDOMException(InvalidStateError, "The element does no
t have an 'open' attribute, and therefore cannot be closed."); |
| 108 return; | 110 return; |
| 109 } | 111 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 { | 199 { |
| 198 if (event->type() == EventTypeNames::cancel) { | 200 if (event->type() == EventTypeNames::cancel) { |
| 199 closeDialog(); | 201 closeDialog(); |
| 200 event->setDefaultHandled(); | 202 event->setDefaultHandled(); |
| 201 return; | 203 return; |
| 202 } | 204 } |
| 203 HTMLElement::defaultEventHandler(event); | 205 HTMLElement::defaultEventHandler(event); |
| 204 } | 206 } |
| 205 | 207 |
| 206 } // namespace WebCore | 208 } // namespace WebCore |
| OLD | NEW |