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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 { | 66 { |
67 if (message.isEmpty()) { | 67 if (message.isEmpty()) { |
68 hideValidationMessage(anchor); | 68 hideValidationMessage(anchor); |
69 return; | 69 return; |
70 } | 70 } |
71 if (!anchor.layoutBox()) | 71 if (!anchor.layoutBox()) |
72 return; | 72 return; |
73 if (m_currentAnchor) | 73 if (m_currentAnchor) |
74 hideValidationMessage(*m_currentAnchor); | 74 hideValidationMessage(*m_currentAnchor); |
75 m_currentAnchor = &anchor; | 75 m_currentAnchor = &anchor; |
76 IntRect anchorInViewport = currentView()->contentsToWindow(anchor.pixelSnapp
edBoundingBox()); | 76 IntRect anchorInViewport = currentView()->contentsToViewport(anchor.pixelSna
ppedBoundingBox()); |
77 m_lastAnchorRectInScreen = currentView()->hostWindow()->viewportToScreen(anc
horInViewport); | 77 m_lastAnchorRectInScreen = currentView()->hostWindow()->viewportToScreen(anc
horInViewport); |
78 m_lastPageScaleFactor = m_webView.pageScaleFactor(); | 78 m_lastPageScaleFactor = m_webView.pageScaleFactor(); |
79 m_message = message; | 79 m_message = message; |
80 const double minimumSecondToShowValidationMessage = 5.0; | 80 const double minimumSecondToShowValidationMessage = 5.0; |
81 const double secondPerCharacter = 0.05; | 81 const double secondPerCharacter = 0.05; |
82 const double statusCheckInterval = 0.1; | 82 const double statusCheckInterval = 0.1; |
83 | 83 |
84 m_webView.client()->showValidationMessage(anchorInViewport, m_message, toWeb
TextDirection(messageDir), | 84 m_webView.client()->showValidationMessage(anchorInViewport, m_message, toWeb
TextDirection(messageDir), |
85 subMessage, toWebTextDirection(subMessageDir)); | 85 subMessage, toWebTextDirection(subMessageDir)); |
86 | 86 |
(...skipping 28 matching lines...) Expand all Loading... |
115 void ValidationMessageClientImpl::checkAnchorStatus(Timer<ValidationMessageClien
tImpl>*) | 115 void ValidationMessageClientImpl::checkAnchorStatus(Timer<ValidationMessageClien
tImpl>*) |
116 { | 116 { |
117 ASSERT(m_currentAnchor); | 117 ASSERT(m_currentAnchor); |
118 if (monotonicallyIncreasingTime() >= m_finishTime || !currentView()) { | 118 if (monotonicallyIncreasingTime() >= m_finishTime || !currentView()) { |
119 hideValidationMessage(*m_currentAnchor); | 119 hideValidationMessage(*m_currentAnchor); |
120 return; | 120 return; |
121 } | 121 } |
122 | 122 |
123 // Check the visibility of the element. | 123 // Check the visibility of the element. |
124 // FIXME: Can we check invisibility by scrollable non-frame elements? | 124 // FIXME: Can we check invisibility by scrollable non-frame elements? |
125 IntRect newAnchorRectInViewport = currentView()->contentsToWindow(m_currentA
nchor->pixelSnappedBoundingBox()); | 125 IntRect newAnchorRectInViewport = currentView()->contentsToViewport(m_curren
tAnchor->pixelSnappedBoundingBox()); |
126 | 126 |
127 // FIXME: This intersection eliminates the part of the rect outside the root
view. | 127 // FIXME: This intersection eliminates the part of the rect outside the root
view. |
128 // If this is meant as a visiblity test, intersecting it against the viewpor
t rect | 128 // If this is meant as a visiblity test, intersecting it against the viewpor
t rect |
129 // likely makes more sense. | 129 // likely makes more sense. |
130 newAnchorRectInViewport = intersection(currentView()->convertToContainingWin
dow(currentView()->boundsRect()), newAnchorRectInViewport); | 130 newAnchorRectInViewport = intersection(currentView()->convertToContainingWin
dow(currentView()->boundsRect()), newAnchorRectInViewport); |
131 if (newAnchorRectInViewport.isEmpty()) { | 131 if (newAnchorRectInViewport.isEmpty()) { |
132 hideValidationMessage(*m_currentAnchor); | 132 hideValidationMessage(*m_currentAnchor); |
133 return; | 133 return; |
134 } | 134 } |
135 | 135 |
(...skipping 11 matching lines...) Expand all Loading... |
147 hideValidationMessage(*m_currentAnchor); | 147 hideValidationMessage(*m_currentAnchor); |
148 } | 148 } |
149 | 149 |
150 DEFINE_TRACE(ValidationMessageClientImpl) | 150 DEFINE_TRACE(ValidationMessageClientImpl) |
151 { | 151 { |
152 visitor->trace(m_currentAnchor); | 152 visitor->trace(m_currentAnchor); |
153 ValidationMessageClient::trace(visitor); | 153 ValidationMessageClient::trace(visitor); |
154 } | 154 } |
155 | 155 |
156 } // namespace blink | 156 } // namespace blink |
OLD | NEW |