Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1680,16 +1680,18 @@ private static void OnTooltipTextChanged(DependencyObject d, DependencyPropertyC
/// <param name="newValue">new value</param>
protected virtual void OnTooltipTextChanged(string oldValue, string newValue)
{
var timer = tooltipTimer;
if (timer == null)
// There are cases where oldValue is null and newValue is string.Empty
// and vice versa, simply ignore when string.IsNullOrEmpty for both.
if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue))
{
return;
}

// There are cases where oldValue is null and newValue is string.Empty
// and vice versa, simply ignore when string.IsNullOrEmpty for both.
if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue))
var timer = tooltipTimer;
if (timer == null)
{
OpenOrCloseToolTip(newValue);

return;
}

Expand Down Expand Up @@ -2151,14 +2153,18 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg
/// <param name="routedEventArgs">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
// TODO: Consider making the delay here configurable.
tooltipTimer = new DispatcherTimer(
TimeSpan.FromSeconds(0.5),
DispatcherPriority.Render,
OnTooltipTimerTick,
Dispatcher
);
tooltipTimer.IsEnabled = false;
var initialShowDelay = ToolTipService.GetInitialShowDelay(this);

if (initialShowDelay > 0)
{
tooltipTimer = new DispatcherTimer(
TimeSpan.FromMilliseconds(initialShowDelay),
DispatcherPriority.Render,
OnTooltipTimerTick,
Dispatcher
);
tooltipTimer.IsEnabled = false;
}

//Initial value for screen location
browserScreenLocation = GetBrowserScreenLocation();
Expand Down