Opened 7 years ago

Last modified 7 years ago

#16753 closed Bug

element.setSize doesn't play well with hdpi — at Version 3

Reported by: Marek Lewandowski Owned by: Marek Lewandowski
Priority: Normal Milestone: CKEditor 4.6.2
Component: General Version:
Keywords: Cc:

Description (last modified by Marek Lewandowski)

This come out from #14630.

There as a failing test:

Error details for tests/plugins/maximize/maximize
test maximize fire resize event with proper properties
Width should be restored.
Expected: 200 (number)
Actual:   202 (number)

When I started to investigate what's the cause of this - it took me all the way to setSize method, and then marginAndPaddingSize function.

The problem there was that resize plugin was setting editor size, using box model so that border width should be included as a part of with. But it did not consider that the width might ba a fraction of a pixel, as a result in mentioned test border width was something like ~0.9px - but it used it as 0px. Having width attribute set to 200px (because border were skipped) and including the border, the actual width of the element was 202px.

The issue was reproducible on all browsers for me.

Change History (3)

comment:1 Changed 7 years ago by Marek Lewandowski

Status: newconfirmed

comment:2 Changed 7 years ago by Marek Lewandowski

Owner: set to Marek Lewandowski
Status: confirmedreview

Pushed to branch:t/16753.

I didn't create manual test for this, as it's hard to test with "eye" - instead the best way to test it is simply a unit test. However I don't think I'm able to stub hdpi settings, so I used explicitly border with a fraction of a pixel.

To test it it's nice to play around with different pixel ratio in OS - I've used 250%, 300% and 350%.

comment:3 Changed 7 years ago by Marek Lewandowski

Description: modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy