Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#16753 closed Bug (fixed)

[HIDPI] element.setSize sets wrong editor's dimensions if border's width is in fraction of pixels

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 (8)

comment:1 Changed 20 months ago by Marek Lewandowski

Status: newconfirmed

comment:2 Changed 20 months 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 20 months ago by Marek Lewandowski

Description: modified (diff)

comment:4 Changed 20 months ago by Tomasz Jakut

Status: reviewreview_failed

Test is failing in IE8. It seems that element.setSize still returns wrong dimensions in that browser:

Computed width
Expected: 198.2 (number)
Actual:   198 (number)

comment:5 Changed 20 months ago by Marek Lewandowski

Status: review_failedreview

True, it rounds the width - I've updated branch:t/16753 accordingly.

comment:6 Changed 20 months ago by Tomasz Jakut

Resolution: fixed
Status: reviewclosed

comment:7 Changed 20 months ago by Marek Lewandowski

Summary: element.setSize doesn't play well with hdpi[HIDPI] element.setSize sets wrong editor's dimensions if border's width is in fraction of pixels.

comment:8 Changed 20 months ago by Marek Lewandowski

Summary: [HIDPI] element.setSize sets wrong editor's dimensions if border's width is in fraction of pixels.[HIDPI] element.setSize sets wrong editor's dimensions if border's width is in fraction of pixels
Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy