From 0419835823ab554694cb3cf98e22cb7843c7aab1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Mon, 25 Jun 2012 11:47:49 +0000 Subject: [PATCH] #8957 Ensure non-negative width svn changeset:23973/svn branch:6.8 --- .../gwt/client/ui/table/VScrollTable.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java index b5f10e68ec..4021fc1230 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java @@ -3288,20 +3288,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, DOM.setStyleAttribute(captionContainer, "width", ""); setWidth(""); } else { - /* * Reduce width with one pixel for the right border since the * footers does not have any spacers between them. */ - int borderWidths = 1; + final int borderWidths = 1; // Set the container width (check for negative value) - if (w - borderWidths >= 0) { - captionContainer.getStyle().setPropertyPx("width", - w - borderWidths); - } else { - captionContainer.getStyle().setPropertyPx("width", 0); - } + captionContainer.getStyle().setPropertyPx("width", + Math.max(w - borderWidths, 0)); /* * if we already have tBody, set the header width properly, if @@ -3309,22 +3304,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * unless TD width is not explicitly set. */ if (scrollBody != null) { - /* - * Reduce with one since footer does not have any spacers, - * instead a 1 pixel border. - */ int tdWidth = width + scrollBody.getCellExtraWidth() - borderWidths; - setWidth(tdWidth + "px"); + setWidth(Math.max(tdWidth, 0) + "px"); } else { Scheduler.get().scheduleDeferred(new Command() { public void execute() { - int borderWidths = 1; int tdWidth = width + scrollBody.getCellExtraWidth() - borderWidths; - setWidth(tdWidth + "px"); + setWidth(Math.max(tdWidth, 0) + "px"); } }); } -- 2.39.5