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

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: Rebase again 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
« no previous file with comments | « Source/web/PopupMenuTest.cpp ('k') | Source/web/WebElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « Source/web/PopupMenuTest.cpp ('k') | Source/web/WebElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698