diff options
author | Patrik Lindström <patrik@vaadin.com> | 2013-08-15 15:36:36 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-08-15 14:03:45 +0000 |
commit | 7182665fde6fdedb721ef72efd5412432b4d13a9 (patch) | |
tree | bb1bdc29a831ad78e3971a799db4d875790be0aa /client | |
parent | 36413cb556cee7a7024a552e3772a2369d8f0294 (diff) | |
download | vaadin-framework-7182665fde6fdedb721ef72efd5412432b4d13a9.tar.gz vaadin-framework-7182665fde6fdedb721ef72efd5412432b4d13a9.zip |
Fix scrollbar for Window under WebKit browsers (#11994)
Change-Id: Ie39d521c2f299bca0e2175fd8bb59beaa4f66241
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 1331eb106a..ff6a15e597 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -342,6 +342,37 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, if (!visibilityChangesDisabled) { super.setVisible(visible); } + + if (visible && 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 + */ + Scheduler.get().scheduleFinally(new ScheduledCommand() { + @Override + public void execute() { + final com.google.gwt.dom.client.Element scrollable = contents + .getFirstChildElement(); + 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); + + updateContentsSize(); + positionOrSizeUpdated(); + } + }); + } } /** For internal use only. May be removed or replaced in the future. */ |