long delay for tooltip text to appear

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

long delay for tooltip text to appear

Postby ctrebs » Tue Sep 05, 2023 1:33 pm

We are experiencing an issue in our application where tooltip text takes a long time to appear when mouse is hovered above a field (like 'title' attribute on h3 element in below html). When this html is run directly in Chrome, the tooltip text appears within one second when the mouse cursor is resting above the field. When run in the CEF browser in our application, this tooltip text takes 10-30 seconds to finally appear when the mouse is left perfectly still above the field. Interestingly (and consistently), if the mouse is hovered above the field perfectly still for a moment and then moved very slightly the text shows soon as the movement occurs.

platform: Windows 32
OS: Windows 10

I am not able to recreate this issue using the CEFClient sample app. But, our app does not call message_loop->Run() like the sample app, but instead we call CefDoMessageLoopWork() from within our app's main PumpMessage() function.

Code: Select all
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Test Hover</title>
</head>
<body>
<h3 title="This title text should display on mouse hover">Test H3 Hover</h3>
</body>
</html>


I tried overriding CefDisplayHandler OnTooltip (bool ClientHandler::OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text)), but this function never gets called in our app (and also never got called when I tested in the CEF Client sample app)

Thanks in advance for any guidance you can offer on what we can do to narrow down and hopefully resolve this.
ctrebs
Newbie
 
Posts: 7
Joined: Wed Jun 22, 2022 4:56 pm

Re: long delay for tooltip text to appear

Postby magreenblatt » Tue Sep 05, 2023 3:10 pm

How frequently are you running CefDoMessageLoopWork? Does anything else take unusually long (like web content changes due to mouseover events, etc)?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: long delay for tooltip text to appear

Postby ctrebs » Wed Sep 06, 2023 2:29 pm

Our application is built using MFC (derived from CWinAppEx which derives from CWinThread where the main message loop lives and executes infinitely until a WM_QUIT message is received). The main message loop calls virtual functions PumpMessage (when there are messages in the queue) and OnIdle (when the queue is empty). We override both of these functions which is where CefDoMessageLoopWork gets called (see below)

Code: Select all
BOOL CCerApp::PumpMessage()
{
   //CWinAppEx::PumpMessage();

   //This code replaces call to CWinAppEx::PumpMessage(). It was copied from MFC and tweaked for CEF
   _AFX_THREAD_STATE *pState = AfxGetThreadState();

   if (!::GetMessage(&(pState->m_msgCur), NULL, NULL, NULL))
   {
#ifdef _DEBUG
      TRACE(traceAppMsg, 1, "CWinThread::PumpMessage - Received WM_QUIT.\n");
         pState->m_nDisablePumpCount++; // application must die
#endif
      // Note: prevents calling message loop things in 'ExitInstance'
      // will never be decremented
      return FALSE;
   }

#ifdef _DEBUG
  if (pState->m_nDisablePumpCount != 0)
   {
     TRACE(traceAppMsg, 0, "Error: CWinThread::PumpMessage called when not permitted.\n");
     ASSERT(FALSE);
   }
#endif


  if (!AfxPreTranslateMessage(&(pState->m_msgCur)))
  {
      if (m_bCEFDoLoop)
      {
          CefDoMessageLoopWork();
      }
      if (pState->m_msgCur.message != WM_KICKIDLE)
      {
          ::TranslateMessage(&(pState->m_msgCur));
          ::DispatchMessage(&(pState->m_msgCur));
      }
    }
   //End of this code replaces CWinAppEx::PumpMessage(). It was copied from MFC and tweaked for CEF

   return TRUE;
}

BOOL CCerApp::OnIdle(LONG lCount)
{
    if (m_bCEFInitialized)
    {
        ;//CefDoMessageLoopWork();
    }

    return CWinAppEx::OnIdle(lCount);
}




Microsoft CWinThread doc
https://learn.microsoft.com/en-us/cpp/mfc/reference/cwinthread-class?view=msvc-170

Nothing else takes unusually long other than the tooltip text. There was one place I found and tested where web content is changed on mouseover, and that was working fine. Again, the tooltip delay only occurs when the mouse is left unmoved - if you hover the mouse over the field, then move it slightly the tooltip text pops up.

Also, a few releases ago we were on an older version of CEF (3.2924.1570.g558741c / Chromium 56.0.2924.76), and the tooltip text worked as expected without the long delay.

Thanks again for your assistance.
ctrebs
Newbie
 
Posts: 7
Joined: Wed Jun 22, 2022 4:56 pm

Re: long delay for tooltip text to appear

Postby magreenblatt » Wed Sep 06, 2023 3:40 pm

If you control the app content you might consider implementing the tooltips using JavaScript.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 213 guests