diff options
author | Henrik Paul <henrik@vaadin.com> | 2013-12-04 15:36:52 +0200 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2013-12-04 15:37:32 +0200 |
commit | c99e575653b78a324737d489709f3c68fbfba2d4 (patch) | |
tree | 086f2f42388e1767093d09e1002ea5ee157cd3c2 /client/src | |
parent | 428c5801da9f2d9248ad35c385b329a2f80c33b9 (diff) | |
parent | 8d6256e98a63222f4b4969612d8d777a31974613 (diff) | |
download | vaadin-framework-c99e575653b78a324737d489709f3c68fbfba2d4.tar.gz vaadin-framework-c99e575653b78a324737d489709f3c68fbfba2d4.zip |
Merge branch 'master' into grid-merge
Change-Id: I2502ed31f81326b2e32a03ad34c289a5bf7bd2b5
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/com/vaadin/client/Util.java | 37 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VNativeSelect.java | 16 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VScrollTable.java | 51 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 6 |
4 files changed, 25 insertions, 85 deletions
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index 7c7978be09..8972670232 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -448,35 +448,6 @@ public class Util { } /** - * Calculates maximum horizontal scrolling value for the given element. - * - * @since 7.1.9 - * @param element - * which scrollLeft should be calculated - * @return maximum value for scrollLeft of the given element - */ - public static int getMaxScrollLeft(final Element element) { - int scrollWidth = element.getScrollWidth(); - int clientWidth = element.getClientWidth(); - return scrollWidth - clientWidth; - } - - /** - * Checks if scrollLeft of the element is at its maximum value. Returns - * false if the element can't be scrolled horizontally. - * - * @since 7.1.9 - * @param element - * which scrollLeft should be checked - * @return true, if scrollLeft is at maximum (false if element can't be - * scrolled horizontally) - */ - public static boolean isScrollLeftAtMax(final Element element) { - int scrollLeft = element.getScrollLeft(); - return scrollLeft != 0 && scrollLeft == getMaxScrollLeft(element); - } - - /** * Run workaround for webkits overflow auto issue. * * See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 @@ -497,8 +468,6 @@ public class Util { // check the scrolltop value before hiding the element final int scrolltop = elem.getScrollTop(); final int scrollleft = elem.getScrollLeft(); - final boolean scrollLeftAtMax = isScrollLeftAtMax(elem); - elem.getStyle().setProperty("overflow", "hidden"); Scheduler.get().scheduleDeferred(new Command() { @@ -522,12 +491,6 @@ public class Util { elem.setScrollTop(scrollvalue); } - // keep horizontal scroll at max if it was before vertical - // scroll bar was added/removed - if (scrollLeftAtMax) { - elem.setScrollLeft(getMaxScrollLeft(elem)); - } - // fix for #6940 : Table horizontal scroll sometimes not // updated when collapsing/expanding columns // Also appeared in Safari 5.1 with webkit 534 (#7667) diff --git a/client/src/com/vaadin/client/ui/VNativeSelect.java b/client/src/com/vaadin/client/ui/VNativeSelect.java index 650ff7731a..04cc9e6624 100644 --- a/client/src/com/vaadin/client/ui/VNativeSelect.java +++ b/client/src/com/vaadin/client/ui/VNativeSelect.java @@ -21,6 +21,7 @@ import java.util.Iterator; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.user.client.ui.ListBox; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.UIDL; public class VNativeSelect extends VOptionGroupBase implements Field { @@ -98,6 +99,21 @@ public class VNativeSelect extends VOptionGroupBase implements Field { // remove temporary empty item select.removeItem(0); firstValueIsTemporaryNullItem = false; + /* + * Workaround to achrome bug that may cause value change event not + * to fire when selection is done with keyboard. + * + * http://dev.vaadin.com/ticket/10109 + * + * Problem is confirmed to exist only on Chrome-Win, but just + * execute in for all webkits. Probably exists also in other + * webkits/blinks on windows. + */ + if (BrowserInfo.get().isWebkit()) { + select.getElement().blur(); + select.getElement().focus(); + } + } } diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 0e64c71005..8bd875690b 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -276,10 +276,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private int detachedScrollPosition = 0; - // fields used in fixing erroneously lost scrollLeft - int lastScrollBodyHeight = 0; - boolean lastScrollLeftWasAtMax = false; - /** * Represents a select range of rows */ @@ -1009,15 +1005,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets, initialContentReceived = true; sizeNeedsInit = true; scrollBody.restoreRowVisibility(); - - // At least FireFox requires that scrollLeft is restored deferred after - // scrollBody is recreated - Scheduler.get().scheduleFinally(new ScheduledCommand() { - @Override - public void execute() { - restoreScrollLeft(); - } - }); } /** For internal use only. May be removed or replaced in the future. */ @@ -4245,8 +4232,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(); @@ -6891,44 +6878,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } /** - * Tries to restore horizontal scroll position if it was lost due to change - * in the height of scrollBody (#12652). - */ - private void restoreScrollLeft() { - int upcomingScrollLeft = scrollLeft; - - if (lastScrollLeftWasAtMax) { - upcomingScrollLeft = Util.getMaxScrollLeft(scrollBodyPanel - .getElement()); - } - scrollBodyPanel.getElement().setScrollLeft(upcomingScrollLeft); - } - - /** - * Checks if restore of scrollLeft is needed by checking if height of the - * scrollBody has changed. - * - * @return true, if restore is required - */ - private boolean isScrollLeftRestoreRequired() { - return (scrollBody.getElement().getClientHeight() != lastScrollBodyHeight); - } - - /** * This method has logic which rows needs to be requested from server when * user scrolls */ + @Override public void onScroll(ScrollEvent event) { - // restore in initializeRows() doesn't work right with Chrome - if (isScrollLeftRestoreRequired()) { - restoreScrollLeft(); - } - - lastScrollBodyHeight = scrollBody.getElement().getClientHeight(); - lastScrollLeftWasAtMax = Util.isScrollLeftAtMax(scrollBodyPanel - .getElement()); - scrollLeft = scrollBodyPanel.getElement().getScrollLeft(); scrollTop = scrollBodyPanel.getScrollPosition(); /* diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index c4b2af76e7..964adfe303 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -958,6 +958,12 @@ public class VWindow extends VWindowOverlay implements // dblclick handled in connector if (type != Event.ONDBLCLICK && draggable) { if (type == Event.ONMOUSEDOWN) { + /** + * Prevents accidental selection of window caption or + * content. (#12726) + */ + event.preventDefault(); + headerDragPending = event; } else if (type == Event.ONMOUSEMOVE && headerDragPending != null) { |