| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/html/HTMLElement.h" | 30 #include "core/html/HTMLElement.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class Document; | 34 class Document; |
| 35 class ExceptionState; | 35 class ExceptionState; |
| 36 class QualifiedName; | 36 class QualifiedName; |
| 37 | 37 |
| 38 class HTMLDialogElement FINAL : public HTMLElement { | 38 class HTMLDialogElement FINAL : public HTMLElement { |
| 39 public: | 39 public: |
| 40 static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document&)
; | 40 static PassRefPtr<HTMLDialogElement> create(Document&); |
| 41 | 41 |
| 42 void close(const String& returnValue, ExceptionState&); | 42 void close(const String& returnValue, ExceptionState&); |
| 43 void closeDialog(const String& returnValue = String()); | 43 void closeDialog(const String& returnValue = String()); |
| 44 void show(); | 44 void show(); |
| 45 void showModal(ExceptionState&); | 45 void showModal(ExceptionState&); |
| 46 | 46 |
| 47 enum CenteringMode { Uninitialized, Centered, NotCentered }; | 47 enum CenteringMode { Uninitialized, Centered, NotCentered }; |
| 48 CenteringMode centeringMode() const { return m_centeringMode; } | 48 CenteringMode centeringMode() const { return m_centeringMode; } |
| 49 LayoutUnit centeredPosition() const | 49 LayoutUnit centeredPosition() const |
| 50 { | 50 { |
| 51 ASSERT(m_centeringMode == Centered); | 51 ASSERT(m_centeringMode == Centered); |
| 52 return m_centeredPosition; | 52 return m_centeredPosition; |
| 53 } | 53 } |
| 54 void setCentered(LayoutUnit centeredPosition); | 54 void setCentered(LayoutUnit centeredPosition); |
| 55 void setNotCentered(); | 55 void setNotCentered(); |
| 56 | 56 |
| 57 String returnValue() const { return m_returnValue; } | 57 String returnValue() const { return m_returnValue; } |
| 58 void setReturnValue(const String& returnValue) { m_returnValue = returnValue
; } | 58 void setReturnValue(const String& returnValue) { m_returnValue = returnValue
; } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 HTMLDialogElement(const QualifiedName&, Document&); | 61 explicit HTMLDialogElement(Document&); |
| 62 | 62 |
| 63 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; | 63 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; |
| 64 virtual void defaultEventHandler(Event*) OVERRIDE; | 64 virtual void defaultEventHandler(Event*) OVERRIDE; |
| 65 virtual bool shouldBeReparentedUnderRenderView(const RenderStyle*) const OVE
RRIDE; | 65 virtual bool shouldBeReparentedUnderRenderView(const RenderStyle*) const OVE
RRIDE; |
| 66 | 66 |
| 67 void forceLayoutForCentering(); | 67 void forceLayoutForCentering(); |
| 68 | 68 |
| 69 CenteringMode m_centeringMode; | 69 CenteringMode m_centeringMode; |
| 70 LayoutUnit m_centeredPosition; | 70 LayoutUnit m_centeredPosition; |
| 71 String m_returnValue; | 71 String m_returnValue; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 inline HTMLDialogElement* toHTMLDialogElement(Node* node) | 74 inline HTMLDialogElement* toHTMLDialogElement(Node* node) |
| 75 { | 75 { |
| 76 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::dialog
Tag)); | 76 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::dialog
Tag)); |
| 77 ASSERT_WITH_SECURITY_IMPLICATION(RuntimeEnabledFeatures::dialogElementEnable
d()); | 77 ASSERT_WITH_SECURITY_IMPLICATION(RuntimeEnabledFeatures::dialogElementEnable
d()); |
| 78 return static_cast<HTMLDialogElement*>(node); | 78 return static_cast<HTMLDialogElement*>(node); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace WebCore | 81 } // namespace WebCore |
| 82 | 82 |
| 83 #endif | 83 #endif |
| OLD | NEW |