After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763640 - Webkit initially unaware of window width and height
Webkit initially unaware of window width and height
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.6.11
Other Linux
: Low minor
: ---
Assigned To: gnucash-reports-maint
gnucash-reports-maint
Depends on:
Blocks:
 
 
Reported: 2016-03-14 20:16 UTC by Geert Janssens
Modified: 2018-06-29 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Geert Janssens 2016-03-14 20:16:57 UTC
This bug is not immediately visible in our current use of webkit.

To see it, one would have to alter the code to generate a chart.

Here's one way to discover this issue:
1. in src/report/report-system/html-barchart.scm replace

            (push "<div id=\"")(push chart-id)(push "\" style=\"width:")
            (push (gnc:html-barchart-width barchart))
            (push "px;height:")
            (push (gnc:html-barchart-height barchart))
            (push "px;\"></div>\n")
with
            (push "<div id=\"")(push chart-id)
            (push "\" style=\"width: 100%;height:100%;\"></div>\n")

2. save the file and have gnucash use it (either rebuild gnucash, or copy the altered file over the original one wherever gnucash is installed)

3. open gnucash and generate any barchart report

With the changes above, the chart should be drawn on the full width and height of the window (width: 100% and height: 100%) instead of at a fixed width and height as was done before.

Instead however the chart is still rendered in a small area. By adding some debug code in javascript, I found the width is still 400px and webkit believes the body element is only one pixel wide.

Opening the exact same generated html file in firefox on the other hand will render the chart properly full width/height. So the issue is not in the html code, but somewhere in webkit or how we are using webkit.

I believe it's the latter, because when with the report still open in gnucash:

4. open the report options window, and change an arbitrary option, like the report name
5. hit ok

Suddenly the chart gets rendered full width/height.

So for some reason webkit doesn't know the full width/height yet, but after changing a report option, it does.

As we are currently not depending on this, the bug is pretty low priority. However in the future we may be able to provide a better report experience if we can depend on full width/height support, like allowing users to draw charts in relative sizes instead of fixed sizes.
Comment 1 Geert Janssens 2016-03-14 21:05:52 UTC
Update: is simple page reload fixes the chart size as well, so it's not even necessary to change a report option.
Comment 2 Geert Janssens 2016-03-14 21:08:07 UTC
And one more data point: reducing the window width when the chart is full size,  will not dynamically reduce the chart's size. So it will be too big to fit the window at this point. Again a page reload will fix that.

So it appears we are not properly informing webkit of window size or resize events.
Comment 3 Bob 2016-10-22 13:50:35 UTC
I had a look at this and created a pull request 107 on github for a possible fix.

The main problem was that the webkit view is not realized before the report is created and so webkit does not know the view size to use when the page is created.
To overcome this I moved the report creating to an idle add function along with some other changes.

Bob
Comment 4 Geert Janssens 2016-12-06 09:44:05 UTC
Bob's work has been merged into master (with backward compat changes on maint), so this bug can be closed.

Thanks a lot!
Comment 5 John Ralls 2018-06-29 23:48:03 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=763640. Please update any external references or bookmarks.