Browse Source

fixes #3764, yet another webkit scrollbar issue fixed. Hopefully got it fixed without regressions (fought whole day with them).

svn changeset:10530/svn branch:6.2
tags/6.7.0.beta1
Matti Tahvonen 14 years ago
parent
commit
1014f35989

+ 15
- 4
src/com/vaadin/terminal/gwt/client/Util.java View File

@@ -548,18 +548,29 @@ public class Util {
if ("hidden".equals(originalOverflow)) {
return;
}

// check the scrolltop value before hiding the element
final int scrolltop = elem.getScrollTop();
elem.getStyle().setProperty("overflow", "hidden");

DeferredCommand.addCommand(new Command() {
public void execute() {
// Dough, Safari scroll auto means actually just a moped
elem.getStyle().setProperty("overflow", originalOverflow);
if (elem.getScrollTop() > 0) {

if (scrolltop > 0 || elem.getScrollTop() > 0) {
int scrollvalue = scrolltop;
if (scrolltop == 0) {
// mysterious are the ways of webkits scrollbar
// handling. In some cases webkit reports bad (0)
// scrolltop before hiding the elment temporary,
// sometimes after.
scrollvalue = elem.getScrollTop();
}
// fix another bug where scrollbar remains in wrong
// position
int scrolltop = elem.getScrollTop();
elem.setScrollTop(scrolltop - 1);
elem.setScrollTop(scrolltop);
elem.setScrollTop(scrollvalue - 1);
elem.setScrollTop(scrollvalue);
}
}
});

+ 19
- 6
src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java View File

@@ -2702,10 +2702,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
if (currentlyVisible < pageLength
&& currentlyVisible < totalRows) {
// shake scrollpanel to fill empty space
bodyContainer.setScrollPosition(bodyContainer
.getScrollPosition() + 1);
bodyContainer.setScrollPosition(bodyContainer
.getScrollPosition() - 1);
bodyContainer.setScrollPosition(scrollTop + 1);
bodyContainer.setScrollPosition(scrollTop - 1);
}
}
}
@@ -2876,6 +2874,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
}

private int contentAreaBorderHeight = -1;
private int scrollLeft;
private int scrollTop;

/**
* @return border top + border bottom of the scrollable area of table
@@ -2954,8 +2954,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
* user scrolls
*/
public void onScroll(ScrollEvent event) {
int scrollLeft = bodyContainer.getElement().getScrollLeft();
int scrollTop = bodyContainer.getScrollPosition();
scrollLeft = bodyContainer.getElement().getScrollLeft();
scrollTop = bodyContainer.getScrollPosition();
if (!initializedAndAttached) {
return;
}
@@ -2967,6 +2967,19 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {

rowRequestHandler.cancel();

if (BrowserInfo.get().isSafari() && event != null && scrollTop == 0) {
// due to the webkitoverflowworkaround, top may sometimes report 0
// for webkit, although it really is not. Expecting to have the
// correct
// value available soon.
DeferredCommand.addCommand(new Command() {
public void execute() {
onScroll(null);
}
});
return;
}

// fix headers horizontal scrolling
tHead.setHorizontalScrollPosition(scrollLeft);


Loading…
Cancel
Save