diff options
author | Henri Sara <hesara@vaadin.com> | 2013-11-12 11:27:07 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2013-11-12 11:27:07 +0200 |
commit | 9885b8c7d70d1f9bdfeb7ebcef1a85a5fdf9fbe5 (patch) | |
tree | a743aacd678155d3f3b94dea7d3c9370bd154f5c /client | |
parent | d2e7b366ef40bd5a27ba4693eba8d80ae8fc4f77 (diff) | |
parent | 011a2a0c9d8eac77e17a5a31b6ddd9ea243209d8 (diff) | |
download | vaadin-framework-9885b8c7d70d1f9bdfeb7ebcef1a85a5fdf9fbe5.tar.gz vaadin-framework-9885b8c7d70d1f9bdfeb7ebcef1a85a5fdf9fbe5.zip |
Merge branch '7.1' into testbench4
Conflicts:
publish.xml
Change-Id: Ic8187a44ac731a930921a6ddcbe0f7eb07deef7e
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/BrowserInfo.java | 16 | ||||
-rw-r--r-- | client/src/com/vaadin/client/Util.java | 51 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VPanel.java | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VScrollTable.java | 4 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VUI.java | 3 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 46 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/ui/UIConnector.java | 22 |
7 files changed, 71 insertions, 73 deletions
diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index 273964c889..78c5c1f59f 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -347,6 +347,22 @@ public class BrowserInfo { } /** + * Indicates whether the browser might require juggling to properly update + * sizes inside elements with overflow: auto when adjusting absolutely + * positioned elements. + * <p> + * See https://bugs.webkit.org/show_bug.cgi?id=123958 and + * http://code.google.com/p/chromium/issues/detail?id=316549 + * + * @since 7.1.8 + * @return <code>true</code> if the browser requires the workaround, + * otherwise <code>false</code> + */ + public boolean requiresPositionAbsoluteOverflowAutoFix() { + return (getWebkitVersion() > 0) && Util.getNativeScrollbarSize() > 0; + } + + /** * Checks if the browser is run on iOS * * @return true if the browser is run on iOS, false otherwise diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index 274df676aa..fe4a7b7573 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -32,7 +32,6 @@ import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Display; -import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Touch; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; @@ -556,56 +555,6 @@ public class Util { } /** - * Prevents some browsers from adding scroll bars to a component (such as a - * Window) whose contents fit in the component. - * <p> - * See: bugs #11994 and #12736. - * - * @param contentNode - * an element that is scrollable - * - * @since 7.1.8 - */ - public static void removeUnneededScrollbars(final Element scrollable) { - if (BrowserInfo.get().isWebkit()) { - - /* - * Shake up the DOM a bit to make the window shed unnecessary - * scrollbars and resize correctly afterwards. This resulting code - * took over a week to summon forth, and involved some pretty hairy - * black magic. Don't touch it unless you know what you're doing! - * Fixes ticket #11994. Later modified to fix ticket #12736. - */ - Scheduler.get().scheduleFinally(new ScheduledCommand() { - - @Override - public void execute() { - // Adjusting the width or height may change the scroll - // position, so store the current position - int horizontalScrollPosition = scrollable.getScrollLeft(); - int verticalScrollPosition = scrollable.getScrollTop(); - - final String oldWidth = scrollable.getStyle().getWidth(); - final String oldHeight = scrollable.getStyle().getHeight(); - - scrollable.getStyle().setWidth(110, Unit.PCT); - scrollable.getOffsetWidth(); - scrollable.getStyle().setProperty("width", oldWidth); - scrollable.getStyle().setHeight(110, Unit.PCT); - scrollable.getOffsetHeight(); - scrollable.getStyle().setProperty("height", oldHeight); - - // Restore the scroll position - scrollable.setScrollLeft(horizontalScrollPosition); - scrollable.setScrollTop(verticalScrollPosition); - - } - }); - - } - } - - /** * Parses shared state and fetches the relative size of the component. If a * dimension is not specified as relative it will return -1. If the shared * state does not contain width or height specifications this will return diff --git a/client/src/com/vaadin/client/ui/VPanel.java b/client/src/com/vaadin/client/ui/VPanel.java index 307a2e4a91..6b02f079d1 100644 --- a/client/src/com/vaadin/client/ui/VPanel.java +++ b/client/src/com/vaadin/client/ui/VPanel.java @@ -24,7 +24,6 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.SimplePanel; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.Focusable; -import com.vaadin.client.Util; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; @@ -207,6 +206,5 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, touchScrollHandler = TouchScrollDelegate.enableTouchScrolling(this); } touchScrollHandler.addElement(contentNode); - Util.removeUnneededScrollbars(contentNode); } } diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index d9d65387dc..47d01bad70 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -4234,8 +4234,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Already updated by setColWidth called from // TableHeads.updateCellsFromUIDL in case of a server // side resize - final String width = col.getStringAttribute("width"); - c.setWidth(Integer.parseInt(width), true); + final int width = col.getIntAttribute("width"); + c.setWidth(width, true); } } else if (recalcWidths) { c.setUndefinedWidth(); diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index 4817bf9304..ba3495743d 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -101,9 +101,6 @@ public class VUI extends SimplePanel implements ResizeHandler, private int parentHeight; /** For internal use only. May be removed or replaced in the future. */ - public boolean rendering; - - /** For internal use only. May be removed or replaced in the future. */ public boolean immediate; /** For internal use only. May be removed or replaced in the future. */ diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 62937b6a67..03a65e8ece 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -345,11 +345,47 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, if (!visibilityChangesDisabled) { super.setVisible(visible); } - if (visible && BrowserInfo.get().isWebkit()) { - Util.removeUnneededScrollbars((Element) contents - .getFirstChildElement()); - updateContentsSize(); - positionOrSizeUpdated(); + + if (visible + && BrowserInfo.get().requiresPositionAbsoluteOverflowAutoFix()) { + + /* + * Shake up the DOM a bit to make the window shed unnecessary + * scrollbars and resize correctly afterwards. This resulting code + * took over a week to summon forth, and involved some pretty hairy + * black magic. Don't touch it unless you know what you're doing! + * Fixes ticket #11994 + */ + Scheduler.get().scheduleFinally(new ScheduledCommand() { + @Override + public void execute() { + final com.google.gwt.dom.client.Element scrollable = contents + .getFirstChildElement(); + + // Adjusting the width or height may change the scroll + // position, so store the current position + int horizontalScrollPosition = scrollable.getScrollLeft(); + int verticalScrollPosition = scrollable.getScrollTop(); + + final String oldWidth = scrollable.getStyle().getWidth(); + final String oldHeight = scrollable.getStyle().getHeight(); + + scrollable.getStyle().setWidth(110, Unit.PCT); + scrollable.getOffsetWidth(); + scrollable.getStyle().setProperty("width", oldWidth); + + scrollable.getStyle().setHeight(110, Unit.PCT); + scrollable.getOffsetHeight(); + scrollable.getStyle().setProperty("height", oldHeight); + + // Restore the scroll position + scrollable.setScrollLeft(horizontalScrollPosition); + scrollable.setScrollTop(verticalScrollPosition); + + updateContentsSize(); + positionOrSizeUpdated(); + } + }); } } diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 8813d70609..149d99de17 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -130,11 +130,16 @@ public class UIConnector extends AbstractSingleComponentContainerConnector Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { - if (sessionExpired) { - getConnection().showSessionExpiredError(null); - } else { - getState().enabled = false; - updateEnabledState(getState().enabled); + // Only notify user if we're still running and not eg. + // navigating away (#12298) + if (getConnection().isApplicationRunning()) { + if (sessionExpired) { + getConnection().showSessionExpiredError(null); + } else { + getState().enabled = false; + updateEnabledState(getState().enabled); + } + getConnection().setApplicationRunning(false); } } }); @@ -192,7 +197,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) { ConnectorMap paintableMap = ConnectorMap.get(getConnection()); - getWidget().rendering = true; getWidget().id = getConnectorId(); boolean firstPaint = getWidget().connection == null; getWidget().connection = client; @@ -285,9 +289,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector childIndex++; } if (isClosed) { - // don't render the content, something else will be opened to this - // browser view - getWidget().rendering = false; + // We're navigating away, so stop the application. + client.setApplicationRunning(false); return; } @@ -397,7 +400,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } }); } - getWidget().rendering = false; } /** |