| 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "public/web/WebViewClient.h" | 36 #include "public/web/WebViewClient.h" |
| 37 #include "web/WebViewImpl.h" | 37 #include "web/WebViewImpl.h" |
| 38 #include "wtf/CurrentTime.h" | 38 #include "wtf/CurrentTime.h" |
| 39 | 39 |
| 40 using namespace WebCore; | 40 using namespace WebCore; |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 ValidationMessageClientImpl::ValidationMessageClientImpl(WebViewImpl& webView) | 44 ValidationMessageClientImpl::ValidationMessageClientImpl(WebViewImpl& webView) |
| 45 : m_webView(webView) | 45 : m_webView(webView) |
| 46 , m_currentAnchor(0) | 46 , m_currentAnchor(nullptr) |
| 47 , m_lastPageScaleFactor(1) | 47 , m_lastPageScaleFactor(1) |
| 48 , m_finishTime(0) | 48 , m_finishTime(0) |
| 49 , m_timer(this, &ValidationMessageClientImpl::checkAnchorStatus) | 49 , m_timer(this, &ValidationMessageClientImpl::checkAnchorStatus) |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 PassOwnPtr<ValidationMessageClientImpl> ValidationMessageClientImpl::create(WebV
iewImpl& webView) | 53 PassOwnPtrWillBeRawPtr<ValidationMessageClientImpl> ValidationMessageClientImpl:
:create(WebViewImpl& webView) |
| 54 { | 54 { |
| 55 return adoptPtr(new ValidationMessageClientImpl(webView)); | 55 return adoptPtrWillBeNoop(new ValidationMessageClientImpl(webView)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 ValidationMessageClientImpl::~ValidationMessageClientImpl() | 58 ValidationMessageClientImpl::~ValidationMessageClientImpl() |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 FrameView* ValidationMessageClientImpl::currentView() | 62 FrameView* ValidationMessageClientImpl::currentView() |
| 63 { | 63 { |
| 64 return m_currentAnchor->document().view(); | 64 return m_currentAnchor->document().view(); |
| 65 } | 65 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 91 // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, | 91 // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, |
| 92 // or page scale change happen. | 92 // or page scale change happen. |
| 93 m_timer.startRepeating(statusCheckInterval, FROM_HERE); | 93 m_timer.startRepeating(statusCheckInterval, FROM_HERE); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor) | 96 void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor) |
| 97 { | 97 { |
| 98 if (!m_currentAnchor || !isValidationMessageVisible(anchor)) | 98 if (!m_currentAnchor || !isValidationMessageVisible(anchor)) |
| 99 return; | 99 return; |
| 100 m_timer.stop(); | 100 m_timer.stop(); |
| 101 m_currentAnchor = 0; | 101 m_currentAnchor = nullptr; |
| 102 m_message = String(); | 102 m_message = String(); |
| 103 m_finishTime = 0; | 103 m_finishTime = 0; |
| 104 m_webView.client()->hideValidationMessage(); | 104 m_webView.client()->hideValidationMessage(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool ValidationMessageClientImpl::isValidationMessageVisible(const Element& anch
or) | 107 bool ValidationMessageClientImpl::isValidationMessageVisible(const Element& anch
or) |
| 108 { | 108 { |
| 109 return m_currentAnchor == &anchor; | 109 return m_currentAnchor == &anchor; |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 139 m_lastPageScaleFactor = m_webView.pageScaleFactor(); | 139 m_lastPageScaleFactor = m_webView.pageScaleFactor(); |
| 140 m_webView.client()->moveValidationMessage(newAnchorRect); | 140 m_webView.client()->moveValidationMessage(newAnchorRect); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void ValidationMessageClientImpl::willBeDestroyed() | 143 void ValidationMessageClientImpl::willBeDestroyed() |
| 144 { | 144 { |
| 145 if (m_currentAnchor) | 145 if (m_currentAnchor) |
| 146 hideValidationMessage(*m_currentAnchor); | 146 hideValidationMessage(*m_currentAnchor); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ValidationMessageClientImpl::trace(Visitor* visitor) |
| 150 { |
| 151 visitor->trace(m_currentAnchor); |
| 152 ValidationMessageClient::trace(visitor); |
| 149 } | 153 } |
| 154 |
| 155 } |
| OLD | NEW |