Skip to content

Commit d4c5b00

Browse files
authored
Merge e34ce46 into c579ddf
2 parents c579ddf + e34ce46 commit d4c5b00

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
@@ -1680,16 +1680,18 @@ private static void OnTooltipTextChanged(DependencyObject d, DependencyPropertyC
16801680
/// <param name="newValue">new value</param>
16811681
protected virtual void OnTooltipTextChanged(string oldValue, string newValue)
16821682
{
1683-
var timer = tooltipTimer;
1684-
if (timer == null)
1683+
// There are cases where oldValue is null and newValue is string.Empty
1684+
// and vice versa, simply ignore when string.IsNullOrEmpty for both.
1685+
if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue))
16851686
{
16861687
return;
16871688
}
16881689

1689-
// There are cases where oldValue is null and newValue is string.Empty
1690-
// and vice versa, simply ignore when string.IsNullOrEmpty for both.
1691-
if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue))
1690+
var timer = tooltipTimer;
1691+
if (timer == null)
16921692
{
1693+
OpenOrCloseToolTip(newValue);
1694+
16931695
return;
16941696
}
16951697

@@ -2151,14 +2153,18 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg
21512153
/// <param name="routedEventArgs">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
21522154
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
21532155
{
2154-
// TODO: Consider making the delay here configurable.
2155-
tooltipTimer = new DispatcherTimer(
2156-
TimeSpan.FromSeconds(0.5),
2157-
DispatcherPriority.Render,
2158-
OnTooltipTimerTick,
2159-
Dispatcher
2160-
);
2161-
tooltipTimer.IsEnabled = false;
2156+
var initialShowDelay = ToolTipService.GetInitialShowDelay(this);
2157+
2158+
if (initialShowDelay > 0)
2159+
{
2160+
tooltipTimer = new DispatcherTimer(
2161+
TimeSpan.FromMilliseconds(initialShowDelay),
2162+
DispatcherPriority.Render,
2163+
OnTooltipTimerTick,
2164+
Dispatcher
2165+
);
2166+
tooltipTimer.IsEnabled = false;
2167+
}
21622168

21632169
//Initial value for screen location
21642170
browserScreenLocation = GetBrowserScreenLocation();

0 commit comments

Comments
 (0)