| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ValidationMessage_h | 31 #ifndef ValidationMessage_h |
| 32 #define ValidationMessage_h | 32 #define ValidationMessage_h |
| 33 | 33 |
| 34 #include "core/platform/Timer.h" | 34 #include "core/platform/Timer.h" |
| 35 #include "heap/Handle.h" |
| 35 #include <wtf/Noncopyable.h> | 36 #include <wtf/Noncopyable.h> |
| 36 #include <wtf/OwnPtr.h> | 37 #include <wtf/OwnPtr.h> |
| 37 #include <wtf/RefPtr.h> | 38 #include <wtf/RefPtr.h> |
| 38 #include <wtf/text/WTFString.h> | 39 #include <wtf/text/WTFString.h> |
| 39 | 40 |
| 40 namespace WebCore { | 41 namespace WebCore { |
| 41 | 42 |
| 42 class HTMLElement; | 43 class HTMLElement; |
| 43 class HTMLFormControlElement; | 44 class HTMLFormControlElement; |
| 44 class Node; | 45 class Node; |
| 45 class ValidationMessageClient; | 46 class ValidationMessageClient; |
| 46 | 47 |
| 47 // FIXME: We should remove the code for !validationMessageClient() when all | 48 // FIXME: We should remove the code for !validationMessageClient() when all |
| 48 // ports supporting interactive validation switch to ValidationMessageClient. | 49 // ports supporting interactive validation switch to ValidationMessageClient. |
| 49 class ValidationMessage { | 50 class ValidationMessage { |
| 50 WTF_MAKE_NONCOPYABLE(ValidationMessage); WTF_MAKE_FAST_ALLOCATED; | 51 WTF_MAKE_NONCOPYABLE(ValidationMessage); WTF_MAKE_FAST_ALLOCATED; |
| 51 public: | 52 public: |
| 52 static PassOwnPtr<ValidationMessage> create(HTMLFormControlElement*); | 53 static PassOwnPtr<ValidationMessage> create(Handle<HTMLFormControlElement>); |
| 53 ~ValidationMessage(); | 54 ~ValidationMessage(); |
| 54 void updateValidationMessage(const String&); | 55 void updateValidationMessage(const String&); |
| 55 void requestToHideMessage(); | 56 void requestToHideMessage(); |
| 56 bool isVisible() const; | 57 bool isVisible() const; |
| 57 bool shadowTreeContains(Node*) const; | 58 bool shadowTreeContains(Node*) const; |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 ValidationMessage(HTMLFormControlElement*); | 61 ValidationMessage(Handle<HTMLFormControlElement>); |
| 61 ValidationMessageClient* validationMessageClient() const; | 62 ValidationMessageClient* validationMessageClient() const; |
| 62 void setMessage(const String&); | 63 void setMessage(const String&); |
| 63 void setMessageDOMAndStartTimer(Timer<ValidationMessage>* = 0); | 64 void setMessageDOMAndStartTimer(Timer<ValidationMessage>* = 0); |
| 64 void buildBubbleTree(Timer<ValidationMessage>*); | 65 void buildBubbleTree(Timer<ValidationMessage>*); |
| 65 void deleteBubbleTree(Timer<ValidationMessage>* = 0); | 66 void deleteBubbleTree(Timer<ValidationMessage>* = 0); |
| 66 | 67 |
| 68 // FIXME(oilpan): Move ValidationMessage to the heap and use a Member. |
| 67 HTMLFormControlElement* m_element; | 69 HTMLFormControlElement* m_element; |
| 68 String m_message; | 70 String m_message; |
| 69 OwnPtr<Timer<ValidationMessage> > m_timer; | 71 OwnPtr<Timer<ValidationMessage> > m_timer; |
| 70 RefPtr<HTMLElement> m_bubble; | 72 RefPtr<HTMLElement> m_bubble; |
| 71 RefPtr<HTMLElement> m_messageHeading; | 73 RefPtr<HTMLElement> m_messageHeading; |
| 72 RefPtr<HTMLElement> m_messageBody; | 74 RefPtr<HTMLElement> m_messageBody; |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace WebCore | 77 } // namespace WebCore |
| 76 | 78 |
| 77 #endif // ValidationMessage_h | 79 #endif // ValidationMessage_h |
| OLD | NEW |