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

Unified Diff: Source/WebKit/chromium/src/ValidationMessageClientImpl.cpp

Issue 16180009: Improve WebValidationMessageClient interface and implementation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 6 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/WebKit/chromium/src/ValidationMessageClientImpl.cpp
diff --git a/Source/WebKit/chromium/src/ValidationMessageClientImpl.cpp b/Source/WebKit/chromium/src/ValidationMessageClientImpl.cpp
index 84268100185ac87203e63a165cb708e96ab2b00a..57365166e90143940de49a877b4206b358ee5036 100644
--- a/Source/WebKit/chromium/src/ValidationMessageClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ValidationMessageClientImpl.cpp
@@ -78,26 +78,24 @@ void ValidationMessageClientImpl::showValidationMessage(const Element& anchor, c
if (m_currentAnchor)
hideValidationMessage(*m_currentAnchor);
m_currentAnchor = &anchor;
- m_lastAnchorRectInScreen = currentView()->contentsToScreen(anchor.pixelSnappedBoundingBox());
+ IntRect anchorInRootView = currentView()->contentsToRootView(anchor.pixelSnappedBoundingBox());
+ m_lastAnchorRectInScreen = currentView()->hostWindow()->rootViewToScreen(anchorInRootView);
m_lastPageScaleFactor = m_webView.pageScaleFactor();
m_message = message;
- askClientToShowValidationMessage();
+
+ WebTextDirection dir = m_currentAnchor->renderer()->style()->direction() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight;
+ AtomicString title = m_currentAnchor->fastGetAttribute(HTMLNames::titleAttr);
+ m_client.showValidationMessage(anchorInRootView, m_message, title, dir);
const double minimumSecondToShowValidationMessage = 5.0;
const double secondPerCharacter = 0.05;
const double statusCheckInterval = 0.1;
- m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowValidationMessage, message.length() * secondPerCharacter);
+ m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowValidationMessage, (message.length() + title.length()) * secondPerCharacter);
// FIXME: We should invoke checkAnchorStatus actively when layout, scroll,
// or page scale change happen.
m_timer.startRepeating(statusCheckInterval);
}
-void ValidationMessageClientImpl::askClientToShowValidationMessage()
-{
- WebTextDirection dir = m_currentAnchor->renderer()->style()->direction() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight;
- m_client.showValidationMessage(m_lastAnchorRectInScreen, m_message, m_currentAnchor->fastGetAttribute(HTMLNames::titleAttr), dir);
-}
-
void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor)
{
if (!m_currentAnchor || !isValidationMessageVisible(anchor))
@@ -136,7 +134,7 @@ void ValidationMessageClientImpl::checkAnchorStatus(Timer<ValidationMessageClien
return;
m_lastAnchorRectInScreen = newAnchorRectInScreen;
m_lastPageScaleFactor = m_webView.pageScaleFactor();
- askClientToShowValidationMessage();
+ m_client.moveValidationMessage(newAnchorRect);
}
}
« no previous file with comments | « Source/WebKit/chromium/src/ValidationMessageClientImpl.h ('k') | public/webpage/WebValidationMessageClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698