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

Unified Diff: Source/web/ValidationMessageClientImpl.cpp

Issue 389343002: Custom validation message to take into account text direction (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrected addition in core.gypi Created 6 years, 4 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/ValidationMessageClientImpl.h ('k') | public/web/WebViewClient.h » ('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 daf2696cd60e7d56b23a2d46ac6f195aeff364d8..a7cfcc3403fea65b9ba64b7988a1b519ef6cabfc 100644
--- a/Source/web/ValidationMessageClientImpl.cpp
+++ b/Source/web/ValidationMessageClientImpl.cpp
@@ -64,7 +64,7 @@ FrameView* ValidationMessageClientImpl::currentView()
return m_currentAnchor->document().view();
}
-void ValidationMessageClientImpl::showValidationMessage(const Element& anchor, const String& message)
+void ValidationMessageClientImpl::showValidationMessage(const Element& anchor, const String& message, TextDirection messageDir, const String& subMessage, TextDirection subMessageDir)
{
if (message.isEmpty()) {
hideValidationMessage(anchor);
@@ -79,15 +79,15 @@ void ValidationMessageClientImpl::showValidationMessage(const Element& anchor, c
m_lastAnchorRectInScreen = currentView()->hostWindow()->rootViewToScreen(anchorInRootView);
m_lastPageScaleFactor = m_webView.pageScaleFactor();
m_message = message;
-
- WebTextDirection dir = m_currentAnchor->renderer()->style()->direction() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight;
- AtomicString title = m_currentAnchor->fastGetAttribute(HTMLNames::titleAttr);
- m_webView.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() + title.length()) * secondPerCharacter);
+
+ m_webView.client()->showValidationMessage(anchorInRootView, m_message, messageDir == LTR ? WebTextDirectionLeftToRight: WebTextDirectionRightToLeft,
+ subMessage, subMessageDir == LTR ? WebTextDirectionLeftToRight: WebTextDirectionRightToLeft);
+ m_webView.client()->showValidationMessage(anchorInRootView, m_message, subMessage, messageDir == LTR ? WebTextDirectionLeftToRight: WebTextDirectionRightToLeft);
+
+ m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowValidationMessage, (message.length() + subMessage.length()) * secondPerCharacter);
// FIXME: We should invoke checkAnchorStatus actively when layout, scroll,
// or page scale change happen.
m_timer.startRepeating(statusCheckInterval, FROM_HERE);
« no previous file with comments | « Source/web/ValidationMessageClientImpl.h ('k') | public/web/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698