]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add 1px buffer to Escalator column natural widths. (#12075)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Mon, 17 Aug 2020 07:49:50 +0000 (10:49 +0300)
committerGitHub <noreply@github.com>
Mon, 17 Aug 2020 07:49:50 +0000 (10:49 +0300)
* 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

client/src/main/java/com/vaadin/client/widgets/Escalator.java
uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png
uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png
uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png

index 7774682dad46f7538e0472653eeb5098cec7d3fd..61dbbf6dd9438f9a97ede348c762a7f20a53bb67 100644 (file)
@@ -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();
index a36be531d593c3d5f7b9ad891d5e90d310fec011..8420cd520e4f34e8962b4008eb707c4b98faf403 100644 (file)
Binary files a/uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png and b/uitest/reference-screenshots/chrome/CheckboxAlignmentWithNoHeaderGridTest-alignments_are_correct_ANY_Chrome__alignment.png differ
index 7d5ccbddbcf572db0ce4a660edc925a942a79435..e12ab578d32bc9f93e8b89b86a58ee6a2e15b3a3 100755 (executable)
Binary files a/uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png and b/uitest/reference-screenshots/chrome/GridColumnAutoWidthClientTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png differ
index 17f5cb3aee250c354acf81074626b53126905794..1f9b7dddf6f5772b987c526b8be20d018cbd7006 100755 (executable)
Binary files a/uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png and b/uitest/reference-screenshots/chrome/GridColumnAutoWidthServerTest-testColumnsRenderCorrectly_ANY_Chrome__grid-v8-initialRender.png differ