| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 WebTextDirection dir = m_currentAnchor->renderer()->style()->direction() ==
RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight; | 85 WebTextDirection dir = m_currentAnchor->renderer()->style()->direction() ==
RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight; |
| 86 AtomicString title = m_currentAnchor->fastGetAttribute(HTMLNames::titleAttr)
; | 86 AtomicString title = m_currentAnchor->fastGetAttribute(HTMLNames::titleAttr)
; |
| 87 m_webView.client()->showValidationMessage(anchorInRootView, m_message, title
, dir); | 87 m_webView.client()->showValidationMessage(anchorInRootView, m_message, title
, dir); |
| 88 | 88 |
| 89 const double minimumSecondToShowValidationMessage = 5.0; | 89 const double minimumSecondToShowValidationMessage = 5.0; |
| 90 const double secondPerCharacter = 0.05; | 90 const double secondPerCharacter = 0.05; |
| 91 const double statusCheckInterval = 0.1; | 91 const double statusCheckInterval = 0.1; |
| 92 m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowV
alidationMessage, (message.length() + title.length()) * secondPerCharacter); | 92 m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowV
alidationMessage, (message.length() + title.length()) * secondPerCharacter); |
| 93 // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, | 93 // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, |
| 94 // or page scale change happen. | 94 // or page scale change happen. |
| 95 m_timer.startRepeating(statusCheckInterval); | 95 m_timer.startRepeating(statusCheckInterval, FROM_HERE); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor) | 98 void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor) |
| 99 { | 99 { |
| 100 if (!m_currentAnchor || !isValidationMessageVisible(anchor)) | 100 if (!m_currentAnchor || !isValidationMessageVisible(anchor)) |
| 101 return; | 101 return; |
| 102 m_timer.stop(); | 102 m_timer.stop(); |
| 103 m_currentAnchor = 0; | 103 m_currentAnchor = 0; |
| 104 m_message = String(); | 104 m_message = String(); |
| 105 m_finishTime = 0; | 105 m_finishTime = 0; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 136 | 136 |
| 137 IntRect newAnchorRectInScreen = currentView()->hostWindow()->rootViewToScree
n(newAnchorRect); | 137 IntRect newAnchorRectInScreen = currentView()->hostWindow()->rootViewToScree
n(newAnchorRect); |
| 138 if (newAnchorRectInScreen == m_lastAnchorRectInScreen && m_webView.pageScale
Factor() == m_lastPageScaleFactor) | 138 if (newAnchorRectInScreen == m_lastAnchorRectInScreen && m_webView.pageScale
Factor() == m_lastPageScaleFactor) |
| 139 return; | 139 return; |
| 140 m_lastAnchorRectInScreen = newAnchorRectInScreen; | 140 m_lastAnchorRectInScreen = newAnchorRectInScreen; |
| 141 m_lastPageScaleFactor = m_webView.pageScaleFactor(); | 141 m_lastPageScaleFactor = m_webView.pageScaleFactor(); |
| 142 m_webView.client()->moveValidationMessage(newAnchorRect); | 142 m_webView.client()->moveValidationMessage(newAnchorRect); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } | 145 } |
| OLD | NEW |