summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-11-15 09:46:42 +0000
committerVaadin Code Review <review@vaadin.com>2013-11-15 14:14:28 +0000
commit81a1c293f0e407db4a5443b85e57d32cddd397a7 (patch)
tree220d54d3653006ffdbea32ab3da36bd8828abd13 /client
parent642818fef200429d4206403e98aabd54ff3b6dd8 (diff)
downloadvaadin-framework-81a1c293f0e407db4a5443b85e57d32cddd397a7.tar.gz
vaadin-framework-81a1c293f0e407db4a5443b85e57d32cddd397a7.zip
Revert "Fixed lost scrollLeft when row count changed in Table (#12652)."
This reverts commit 533ddcda271b7226b38c035adf3073062c562653. Seems like the caused regressions are far from trivial to resolve. A new approach might be needed to resolve this issue. Change-Id: I88cf75608e8d47fffab5a366a8ad1b3b70c1c11f
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/Util.java37
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java47
2 files changed, 1 insertions, 83 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/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index d1d73f4e91..c56a2a8772 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. */
@@ -6878,44 +6865,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();
/*