Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Unified Diff: Source/web/ValidationMessageClientImpl.cpp

Issue 919423002: Audited and renamed uses of methods and variables named RootView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Build fix Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/ValidationMessageClientImpl.cpp
diff --git a/Source/web/ValidationMessageClientImpl.cpp b/Source/web/ValidationMessageClientImpl.cpp
index 0405aa99734e2a4bc18d0e4aaf83e430c3d21a7c..9e83790cc060d63c5b6c0f5c7db95b15c286c064 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()

Powered by Google App Engine
This is Rietveld 408576698