Skip to content

Commit 9cf5497

Browse files
authored
Merge e1ed5ee into 2c141e0
2 parents 2c141e0 + e1ed5ee commit 9cf5497

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,16 +1603,18 @@ private static void OnTooltipTextChanged(DependencyObject d, DependencyPropertyC
16031603
/// <param name="newValue">new value</param>
16041604
protected virtual void OnTooltipTextChanged(string oldValue, string newValue)
16051605
{
1606-
var timer = tooltipTimer;
1607-
if (timer == null)
1606+
// There are cases where oldValue is null and newValue is string.Empty
1607+
// and vice versa, simply ignore when string.IsNullOrEmpty for both.
1608+
if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue))
16081609
{
16091610
return;
16101611
}
16111612

1612-
// There are cases where oldValue is null and newValue is string.Empty
1613-
// and vice versa, simply ignore when string.IsNullOrEmpty for both.
1614-
if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue))
1613+
var timer = tooltipTimer;
1614+
if (timer == null)
16151615
{
1616+
OpenOrCloseToolTip(newValue);
1617+
16161618
return;
16171619
}
16181620

@@ -2056,14 +2058,18 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg
20562058
/// <param name="routedEventArgs">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
20572059
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
20582060
{
2059-
// TODO: Consider making the delay here configurable.
2060-
tooltipTimer = new DispatcherTimer(
2061-
TimeSpan.FromSeconds(0.5),
2062-
DispatcherPriority.Render,
2063-
OnTooltipTimerTick,
2064-
Dispatcher
2065-
);
2066-
tooltipTimer.IsEnabled = false;
2061+
var initialShowDelay = ToolTipService.GetInitialShowDelay(this);
2062+
2063+
if (initialShowDelay > 0)
2064+
{
2065+
tooltipTimer = new DispatcherTimer(
2066+
TimeSpan.FromMilliseconds(initialShowDelay),
2067+
DispatcherPriority.Render,
2068+
OnTooltipTimerTick,
2069+
Dispatcher
2070+
);
2071+
tooltipTimer.IsEnabled = false;
2072+
}
20672073

20682074
//Initial value for screen location
20692075
browserScreenLocation = GetBrowserScreenLocation();

0 commit comments

Comments
 (0)