Hi,

Inorder to resolve the delay, applied the below patches in Qt 5.6.3 source
due to fallback fonts but didnot solve the delay in page loading first time.

https://github.com/qt/qtbase/commit/a332f3fabc29f796526202648eddf35a24f1cb67
https://codereview.qt-project.org/c/qt/qtbase/+/245404/1/src/gui/text/qfontdatabase.cpp

Any thoughts?

Best Regards,
Ramakanth

On Tue, Jan 5, 2021 at 10:58 AM Ramakanth Kesireddy <[email protected]>
wrote:

> Hello Konstantin,
>
> I tried the cmake option -DENABLE_TEST_SUPPORT=OFF to remove the
> fontconfig dependency but when I run sample webkit application which
> creates the QWebPage and displays local HTML,
> it creates the fontconfig cache files in /home/.cache/fontconfig which is
> causing delay for the first time.
>
> After debugging, found the below highlighted one is causing for the delay.
> Hence would like to avoid the fontconfig dependency of creating cache files.
>
> QWebSettings::QWebSettings()
> : d(new QWebSettingsPrivate)
> {
> // Initialize our global defaults
> d->fontSizes.insert(QWebSettings::MinimumFontSize, 0);
> d->fontSizes.insert(QWebSettings::MinimumLogicalFontSize, 0);
> d->fontSizes.insert(QWebSettings::DefaultFontSize, 16);
> d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 13);
> QFont defaultFont;
> defaultFont.setStyleHint(QFont::Serif);
> d->fontFamilies.insert(QWebSettings::StandardFont,
> defaultFont.defaultFamily());
>
> Appreciate to share your suggestions/feedback or any other configuration
> being missed in this regard.
>
> Best Regards,
> Ramakanth
>
> On Mon, Dec 28, 2020 at 5:23 PM Ramakanth Kesireddy <[email protected]>
> wrote:
>
>> Hello Konstantin,
>>
>> Can you please let me know if there is any cmake config option to remove
>> the dependency on fontconfig while configuring Qtwebkit?
>>
>> Thanks and Regards,
>> Ramakanth
>>
>> On Sun, 20 Dec, 2020, 15:30 Ramakanth Kesireddy, <[email protected]>
>> wrote:
>>
>>> Hello Konstantin,
>>>
>>> Here is the sample app where the delay is reproduced even on Ubuntu
>>> 16.04 desktop.
>>> user.css and png files are to be placed in /usr/share/images directory
>>> in the filesystem.
>>>
>>> home@ubuntu:~/Project/thread_QtApp$ sudo ./thread_QtApp
>>>  Elapse time for QWebView creation 0
>>> Elapse time for m_webView->page() 42722
>>> Elapse time for setUserStyleSheetUrl 0
>>> Elapse time for installEventFilter 0
>>> width: 640 height: 480
>>> Elapse time for setHtml() 61
>>> UiAppInstance::createUserInterface <<<
>>> QEventLoop: Cannot be used without QApplication
>>>
>>> It shall create fontconfig cache files for the first time in
>>> /var/cache/fontconfig which is causing delay for the first time.
>>> This issue can be reproduced always when fontconfig caches are deleted.
>>>
>>> On further debugs in the Qtwebkit sources, it gets stuck in the below
>>> highlighted one.
>>>
>>> QWebSettings::QWebSettings()
>>> : d(new QWebSettingsPrivate)
>>> {
>>> // Initialize our global defaults
>>> d->fontSizes.insert(QWebSettings::MinimumFontSize, 0);
>>> d->fontSizes.insert(QWebSettings::MinimumLogicalFontSize, 0);
>>> d->fontSizes.insert(QWebSettings::DefaultFontSize, 16);
>>> d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 13);
>>> QFont defaultFont;
>>> defaultFont.setStyleHint(QFont::Serif);
>>> d->fontFamilies.insert(QWebSettings::StandardFont,
>>> defaultFont.defaultFamily());
>>> d->fontFamilies.insert(QWebSettings::SerifFont,
>>> defaultFont.defaultFamily());
>>> ...
>>> ...
>>> }
>>>
>>> As mentioned in the
>>> https://github.com/qtwebkit/qtwebkit/wiki/Building-QtWebKit-on-Linux,
>>> fontconfig is an optional dependency.
>>>
>>> Could you please let me know if there is any cmake option to remove
>>> fontconfig dependency in the qtwebkit configuration or any
>>> other thoughts ?
>>>
>>> The same issue is being reproduced in the UIApp on target as mentioned
>>> in the qtwebkit issue https://github.com/qtwebkit/qtwebkit/issues/1039
>>>
>>> Appreciate your kind suggestions in this regard.
>>>
>>> Thanks and Regards,
>>> Ramakanth
>>>
>>> On Fri, Dec 4, 2020 at 11:36 PM Konstantin Tokarev <[email protected]>
>>> wrote:
>>>
>>>>
>>>>
>>>> 04.12.2020, 10:36, "Ramakanth Kesireddy" <[email protected]>:
>>>> > Hello Konstantin,
>>>> >
>>>> > Thanks for the details.
>>>> >
>>>> > Also the same UiApp setuserstylesheet codes work for Qt 4.8 based
>>>> QtWebKit 2.3.4 without any delay first time.
>>>> > Do you think of any potential changes in QtWebkit 5.212 Alpha4 that
>>>> could cause the first time load issue of user stylesheet?
>>>>
>>>> First, is "delay" you are talking about equal to execution time of
>>>> setUserStyleSheet? You can measure it simply by putting QElapsedTimer
>>>> before call and printing its value afterwards.
>>>>
>>>> My first guess about this "delay" is that it is caused by complex
>>>> layout computation. However it's hard to guess why 4.8 behavior is
>>>> different without profiling.
>>>> Did you try to do any profiling of what happens inside
>>>> setUserStyleSheet?
>>>> Does execution time of setUserStyleSheet depend on page or stylesheet
>>>> you are trying to load?
>>>>
>>>> >
>>>> > Best Regards,
>>>> > Ramakanth
>>>> >
>>>> > On Thu, Dec 3, 2020 at 10:26 PM Konstantin Tokarev <[email protected]>
>>>> wrote:
>>>> >> 03.12.2020, 19:40, "Ramakanth Kesireddy" <[email protected]>:
>>>> >>> Ok Thanks for your mail.Shall check and update further.
>>>> >>> Is it by design QWebSettings is not thread safe or any means to
>>>> make thread safe?
>>>> >>
>>>> >> WebCore by design is not thread safe. QWebView and all other classes
>>>> from QtWebKitWidgets module use WebCore directly and so aren't thread safe
>>>> too. You must call them from the same thread QWebView was created (and it
>>>> should better be main GUI thread, i.e. where QApplication is created).
>>>> >>
>>>> >> For comparison, QML API uses multi-process architecture so WebCore
>>>> is used in a background process and minimizes blocking of GUI process (i.e.
>>>> your application). Though that API is still not thread safe respective to
>>>> threads in GUI process (though it might be reentrant).
>>>> >>
>>>> >> --
>>>> >> Regards,
>>>> >> Konstantin
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Konstantin
>>>>
>>>
_______________________________________________
webkit-qt mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-qt

Reply via email to