Bug 1544798 Comment 2 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Miko Mynttinen [:miko] from comment #1)

> This code is meant for debugging purposes only.
> Does adding
> ```
>   if (bounds.IsEmpty()) {
>     return;
>   }
> ```
> after
> ```
>   Rect bounds = NSRectToRect(aItem->GetBounds(aBuilder, &snap),
>                              aPresContext->AppUnitsPerDevPixel());
> ```
> fix this for your use case?

It didn't work unfortunately, because the bounds are not 'empty' at that point. They are both floats, and the height in my case is something like "0.5f", which gets truncated to "0" when it is cast to an int32_t in the line below.

But is truncation the correct behavior in this case? If you have an object that is "10.5W x 7.5H", don't you need a surface that is 11W x 8H to hold it?
(In reply to Miko Mynttinen [:miko] from comment #1)

> This code is meant for debugging purposes only.
> Does adding
> ```
>   if (bounds.IsEmpty()) {
>     return;
>   }
> ```
> after
> ```
>   Rect bounds = NSRectToRect(aItem->GetBounds(aBuilder, &snap),
>                              aPresContext->AppUnitsPerDevPixel());
> ```
> fix this for your use case?

It didn't work unfortunately, because the bounds are not 'empty' at that point. They are both floats, and the height in my case is something like "0.5f", which gets truncated to "0" when it is cast to an int32_t in the line below.

But is truncation the correct behavior in this case? If you have an object that is "10.5W x 7.5H", don't you need a surface that is "11W x 8H" to hold it?

Back to Bug 1544798 Comment 2