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

Side by Side Diff: Source/web/ValidationMessageClientImpl.cpp

Issue 557753002: Code cleanup for showValidationMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | public/web/WebViewClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 IntRect anchorInRootView = currentView()->contentsToRootView(anchor.pixelSna ppedBoundingBox()); 76 IntRect anchorInRootView = currentView()->contentsToRootView(anchor.pixelSna ppedBoundingBox());
77 m_lastAnchorRectInScreen = currentView()->hostWindow()->rootViewToScreen(anc horInRootView); 77 m_lastAnchorRectInScreen = currentView()->hostWindow()->rootViewToScreen(anc horInRootView);
78 m_lastPageScaleFactor = m_webView.pageScaleFactor(); 78 m_lastPageScaleFactor = m_webView.pageScaleFactor();
79 m_message = message; 79 m_message = message;
80 const double minimumSecondToShowValidationMessage = 5.0; 80 const double minimumSecondToShowValidationMessage = 5.0;
81 const double secondPerCharacter = 0.05; 81 const double secondPerCharacter = 0.05;
82 const double statusCheckInterval = 0.1; 82 const double statusCheckInterval = 0.1;
83 83
84 m_webView.client()->showValidationMessage(anchorInRootView, m_message, toWeb TextDirection(messageDir), 84 m_webView.client()->showValidationMessage(anchorInRootView, m_message, toWeb TextDirection(messageDir),
85 subMessage, toWebTextDirection(subMessageDir)); 85 subMessage, toWebTextDirection(subMessageDir));
86 m_webView.client()->showValidationMessage(anchorInRootView, m_message, subMe ssage, toWebTextDirection(messageDir));
87 86
88 m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowV alidationMessage, (message.length() + subMessage.length()) * secondPerCharacter) ; 87 m_finishTime = monotonicallyIncreasingTime() + std::max(minimumSecondToShowV alidationMessage, (message.length() + subMessage.length()) * secondPerCharacter) ;
89 // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, 88 // FIXME: We should invoke checkAnchorStatus actively when layout, scroll,
90 // or page scale change happen. 89 // or page scale change happen.
91 m_timer.startRepeating(statusCheckInterval, FROM_HERE); 90 m_timer.startRepeating(statusCheckInterval, FROM_HERE);
92 } 91 }
93 92
94 void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor) 93 void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor)
95 { 94 {
96 if (!m_currentAnchor || !isValidationMessageVisible(anchor)) 95 if (!m_currentAnchor || !isValidationMessageVisible(anchor))
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 hideValidationMessage(*m_currentAnchor); 143 hideValidationMessage(*m_currentAnchor);
145 } 144 }
146 145
147 void ValidationMessageClientImpl::trace(Visitor* visitor) 146 void ValidationMessageClientImpl::trace(Visitor* visitor)
148 { 147 {
149 visitor->trace(m_currentAnchor); 148 visitor->trace(m_currentAnchor);
150 ValidationMessageClient::trace(visitor); 149 ValidationMessageClient::trace(visitor);
151 } 150 }
152 151
153 } // namespace blink 152 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/web/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698