And this return false because of containing rules for Rectangle. As Y coordinate of content bounds is negative, area does not contain it. But they have same size !
So, you should test sizes more than bounds. IMHO
No, that’s the way I intended it to work. Even if the item would fit in the viewport, but is currently positioned off one edge, the viewport needs to show the scrollbars, otherwise you could end up with the content getting stuck halfway off the screen, without any way to move it back on.
I do understand that fact. It is real that if content size is lower than viewport size, it could be also to center content in view. But in this case, can you evaluate the use of a Justification type ? In this way, we could attach content relatively to view area and in the case which I explained above it could be useful to reset content position at (0,0) if Justification was on top left edge of view.
But it is a minor bug, and I will understand if it could give you too many work for fixing it.
When you resize the viewport to the size of its content, if scrollbars were not at 0, they still appears in viewport because of indent.
For example, if you have a content in 800x600, and your viewport is 400x300, you will have scrollbars.
Then move vertical bar to scroll the content which will set its bounds to (0, -200, 800, 600) for example.
If you set the viewport size to 800x600, then content must fit in it, and we do not need scrollbars anymore. But the size of the content is tested against viewport size using ::contains() function. So, as content bounds were set to -200 on y-axis, it will not be contained in viewport bounds.
IMHO, only sizes must be tested, and content position must be reset to (0,0) if its size fit inside viewport size if position was negative.
I do not known how to explain this clearly (maybe in french !)