| Index: Source/web/ValidationMessageClientImpl.cpp
|
| diff --git a/Source/web/ValidationMessageClientImpl.cpp b/Source/web/ValidationMessageClientImpl.cpp
|
| index 25289a27e6b0c322755600c4d84b1be82c19d7e4..d3c901b522cb2e2ab99c3156cfbd2e20c7f806b9 100644
|
| --- a/Source/web/ValidationMessageClientImpl.cpp
|
| +++ b/Source/web/ValidationMessageClientImpl.cpp
|
| @@ -73,15 +73,15 @@ void ValidationMessageClientImpl::showValidationMessage(const Element& anchor, c
|
| if (m_currentAnchor)
|
| hideValidationMessage(*m_currentAnchor);
|
| m_currentAnchor = &anchor;
|
| - IntRect anchorInRootView = currentView()->contentsToRootView(anchor.pixelSnappedBoundingBox());
|
| - m_lastAnchorRectInScreen = currentView()->hostWindow()->rootViewToScreen(anchorInRootView);
|
| + IntRect anchorInViewport = currentView()->contentsToWindow(anchor.pixelSnappedBoundingBox());
|
| + m_lastAnchorRectInScreen = currentView()->hostWindow()->viewportToScreen(anchorInViewport);
|
| m_lastPageScaleFactor = m_webView.pageScaleFactor();
|
| m_message = message;
|
| const double minimumSecondToShowValidationMessage = 5.0;
|
| const double secondPerCharacter = 0.05;
|
| const double statusCheckInterval = 0.1;
|
|
|
| - m_webView.client()->showValidationMessage(anchorInRootView, m_message, toWebTextDirection(messageDir),
|
| + m_webView.client()->showValidationMessage(anchorInViewport, m_message, toWebTextDirection(messageDir),
|
| subMessage, toWebTextDirection(subMessageDir));
|
|
|
| m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowValidationMessage, (message.length() + subMessage.length()) * secondPerCharacter);
|
| @@ -122,19 +122,23 @@ void ValidationMessageClientImpl::checkAnchorStatus(Timer<ValidationMessageClien
|
|
|
| // Check the visibility of the element.
|
| // FIXME: Can we check invisibility by scrollable non-frame elements?
|
| - IntRect newAnchorRect = currentView()->contentsToRootView(m_currentAnchor->pixelSnappedBoundingBox());
|
| - newAnchorRect = intersection(currentView()->convertToContainingWindow(currentView()->boundsRect()), newAnchorRect);
|
| - if (newAnchorRect.isEmpty()) {
|
| + IntRect newAnchorRectInViewport = currentView()->contentsToWindow(m_currentAnchor->pixelSnappedBoundingBox());
|
| +
|
| + // FIXME: This intersection eliminates the part of the rect outside the root view.
|
| + // If this is meant as a visiblity test, intersecting it against the viewport rect
|
| + // likely makes more sense.
|
| + newAnchorRectInViewport = intersection(currentView()->convertToContainingWindow(currentView()->boundsRect()), newAnchorRectInViewport);
|
| + if (newAnchorRectInViewport.isEmpty()) {
|
| hideValidationMessage(*m_currentAnchor);
|
| return;
|
| }
|
|
|
| - IntRect newAnchorRectInScreen = currentView()->hostWindow()->rootViewToScreen(newAnchorRect);
|
| - if (newAnchorRectInScreen == m_lastAnchorRectInScreen && m_webView.pageScaleFactor() == m_lastPageScaleFactor)
|
| + IntRect newAnchorRectInViewportInScreen = currentView()->hostWindow()->viewportToScreen(newAnchorRectInViewport);
|
| + if (newAnchorRectInViewportInScreen == m_lastAnchorRectInScreen && m_webView.pageScaleFactor() == m_lastPageScaleFactor)
|
| return;
|
| - m_lastAnchorRectInScreen = newAnchorRectInScreen;
|
| + m_lastAnchorRectInScreen = newAnchorRectInViewportInScreen;
|
| m_lastPageScaleFactor = m_webView.pageScaleFactor();
|
| - m_webView.client()->moveValidationMessage(newAnchorRect);
|
| + m_webView.client()->moveValidationMessage(newAnchorRectInViewport);
|
| }
|
|
|
| void ValidationMessageClientImpl::willBeDestroyed()
|
|
|