diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2020-08-17 10:49:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 10:49:50 +0300 |
commit | e5c42385f337702e561a87806807e3bd3ef9c551 (patch) | |
tree | 73e62f11250b3d7bad99e7a26b113ac685afc48c | |
parent | aa3757c6649fa056b9495500d6987d213a8bb782 (diff) | |
download | vaadin-framework-e5c42385f337702e561a87806807e3bd3ef9c551.tar.gz vaadin-framework-e5c42385f337702e561a87806807e3bd3ef9c551.zip |
Add 1px buffer to Escalator column natural widths. (#12075)
* Add 1px buffer to Escalator column natural widths.
The purpose of the buffer is to avoid subpixel handling issues,
especially when zoomed in or out.
In case fractions need to be adjusted for browser compatibility, round
up to ensure the contents have the space they need.
Fixes #12048
-rw-r--r-- | client/src/main/java/com/vaadin/client/widgets/Escalator.java | 14 | ||||
-rw-r--r-- | uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png | bin | 20251 -> 20256 bytes | |||
-rwxr-xr-x | uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png | bin | 16438 -> 16654 bytes | |||
-rwxr-xr-x | uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png | bin | 15787 -> 15925 bytes |
4 files changed, 7 insertions, 7 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index 7774682dad..61dbbf6dd9 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -2254,13 +2254,13 @@ public class Escalator extends Widget cell.getParentElement().insertBefore(cellClone, cell); double requiredWidth = getBoundingWidth(cellClone); - if (BrowserInfo.get().isIE()) { - /* - * IE browsers have some issues with subpixels. Occasionally - * content is overflown even if not necessary. Increase the - * counted required size by 0.01 just to be on the safe side. - */ - requiredWidth += 0.01; + + if (requiredWidth > 0) { + // add one pixel to avoid subpixel issues + // (overflow, unnecessary ellipsis...) + requiredWidth += 1; + // round up to a fraction that the current browser can handle + requiredWidth = WidgetUtil.roundSizeUp(requiredWidth); } cellClone.removeFromParent(); diff --git a/uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png b/uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png Binary files differindex a36be531d5..8420cd520e 100644 --- a/uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png +++ b/uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png diff --git a/uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png b/uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png Binary files differindex 7d5ccbddbc..e12ab578d3 100755 --- a/uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png +++ b/uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png diff --git a/uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png b/uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png Binary files differindex 17f5cb3aee..1f9b7dddf6 100755 --- a/uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png +++ b/uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png |