Skip to content

Commit 0916c75

Browse files
committed
WPF - Tooltip minor cleanup
- Ignore tooltip change if both new/old values are null/empty - Change order so timer is stopped before hiding tooltip
1 parent 7021a7d commit 0916c75

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,14 +1609,21 @@ protected virtual void OnTooltipTextChanged(string oldValue, string newValue)
16091609
return;
16101610
}
16111611

1612-
if (string.IsNullOrEmpty(newValue))
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))
16131615
{
1614-
UiThreadRunAsync(() => OpenOrCloseToolTip(null), DispatcherPriority.Render);
1616+
return;
1617+
}
16151618

1619+
if (string.IsNullOrEmpty(newValue))
1620+
{
16161621
if (timer.IsEnabled)
16171622
{
16181623
timer.Stop();
16191624
}
1625+
1626+
OpenOrCloseToolTip(null);
16201627
}
16211628
else if (!timer.IsEnabled)
16221629
{
@@ -2145,7 +2152,10 @@ protected virtual void OpenOrCloseToolTip(string text)
21452152
{
21462153
if (string.IsNullOrEmpty(text))
21472154
{
2148-
toolTip.IsOpen = false;
2155+
if (toolTip.IsOpen)
2156+
{
2157+
toolTip.IsOpen = false;
2158+
}
21492159
}
21502160
else
21512161
{

0 commit comments

Comments
 (0)