Project

General

Profile

Actions

Bug #7350

closed

WPaintedWidget in layout with resizer can display wrong height

Added by Bruce Toll almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
12/05/2019
Due date:
% Done:

0%

Estimated time:

Description

With wt 4.2.0, a WPaintedWidget can display the wrong height when used in a resizable WVBoxLayout. The issue is more obvious when a minimum height is set using setMinimumSize() and the resizer is manually moved to the WPaintedWidget's minimum size.

The attached test program can be used to demonstrate the issue with two WCartesianCharts. To drive the issue, use a browser window that is at least 200px high and move the resizer up as far as it will go. This should cause the upper chart to extend over the resizer and overlap the lower chart.

The issue seems related to the wtResize javascript code added by the setJavaScriptMember in WPaintedWidget::createDomElement that adjusts the WPaintedWidget canvas element's style height.

What seems to be happening is that the wtResize method gets called with a height of --1 by the StdLayout2 code when the resizer is manually set to the minimum size. As a result, the wtResize routine does not update the canvas element's style height from its previous value. The canvas style height appears to take precedence over the canvas height attribute (which appears to be correct) resulting in the wrong height being displayed.

I'm not sure why WPaintedWidget's wtResize gets called with a height of --1 when the resizer is at the WPaintedWidget's minimumSize (height), but I suspect that this is the root cause of the problem.

As a note, it appears that commenting out the setJavaScriptMember() call in WPaintedWidget.C corrects the behavior of the test program, although it's probably not a good solution for the general case.


Files

Actions #1

Updated by Roel Standaert almost 5 years ago

So if I understand correctly, this is a regression in Wt 4.2.0, right? It was not there in Wt 4.1.2? Or has it been an issue for longer?

Actions #2

Updated by Bruce Toll almost 5 years ago

I didn't check if this issue was a recent regression --- I very much doubt that it is. I usually note the Wt version used in testing to assist in reproducing an issue. Sorry for the confusion.

Actions #3

Updated by Bruce Toll almost 5 years ago

As a follow-up, the issue was also present in Wt 4.0.4. I suspect it dates back quite a bit further, though. There are some library compatibility issues that make it challenging to bisect.

Actions #4

Updated by Roel Standaert almost 5 years ago

Thanks for clarifying :-).

Actions #5

Updated by Roel Standaert almost 5 years ago

  • Target version set to 4.2.1
Actions #6

Updated by Roel Standaert almost 5 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche

I can see the --1 in StdGridLayoutImpl2.js, but I don't know what its intended meaning is. Can you explain, Koen?

I see that item.set[VERTICAL] is false, and that's why --1 is used for the height.

Actions #7

Updated by Roel Standaert almost 5 years ago

  • Status changed from InProgress to Resolved
  • Assignee deleted (Koen Deforche)

Commit eee7d36f63420b02b4438920c00385e710f1de0c should fix this.

Actions #8

Updated by Bruce Toll almost 5 years ago

This works well. Thanks, Roel!

Actions #9

Updated by Roel Standaert almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF