From: Tapio Aali Date: Wed, 23 May 2012 09:01:22 +0000 (+0000) Subject: Fixed styles that were left lingering while changing the orientation of a slider... X-Git-Tag: 7.0.0.alpha3~138^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=edf451f67f4d50d5baeb4ae9ceaa6746eb6fa10c;p=vaadin-framework.git Fixed styles that were left lingering while changing the orientation of a slider (#7002). svn changeset:23813/svn branch:6.8 --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSlider.java b/src/com/vaadin/terminal/gwt/client/ui/VSlider.java index 4a46346613..e605c6fe12 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VSlider.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VSlider.java @@ -200,8 +200,12 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field, private void buildBase() { final String styleAttribute = vertical ? "height" : "width"; + final String oppositeStyleAttribute = vertical ? "width" : "height"; final String domProperty = vertical ? "offsetHeight" : "offsetWidth"; + // clear unnecessary opposite style attribute + DOM.setStyleAttribute(base, oppositeStyleAttribute, ""); + final Element p = DOM.getParent(getElement()); if (DOM.getElementPropertyInt(p, domProperty) > 50) { if (vertical) { @@ -235,10 +239,15 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field, private void buildHandle() { final String styleAttribute = vertical ? "height" : "width"; final String handleAttribute = vertical ? "marginTop" : "marginLeft"; + final String oppositeHandleAttribute = vertical ? "marginLeft" + : "marginTop"; final String domProperty = vertical ? "offsetHeight" : "offsetWidth"; DOM.setStyleAttribute(handle, handleAttribute, "0"); + // clear unnecessary opposite handle attribute + DOM.setStyleAttribute(handle, oppositeHandleAttribute, ""); + if (scrollbarStyle) { // Only stretch the handle if scrollbar style is set. int s = (int) (Double.parseDouble(DOM.getElementProperty(base, @@ -356,7 +365,7 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field, } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) { feedbackPopup.show(); } - if(Util.isTouchEvent(event)) { + if (Util.isTouchEvent(event)) { event.preventDefault(); // avoid simulated events event.stopPropagation(); } diff --git a/tests/testbench/com/vaadin/tests/components/slider/SliderOrientation.html b/tests/testbench/com/vaadin/tests/components/slider/SliderOrientation.html new file mode 100644 index 0000000000..174ddca016 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/slider/SliderOrientation.html @@ -0,0 +1,72 @@ + + + + + + +SliderOrientation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SliderOrientation
open/run/com.vaadin.tests.components.slider.SliderTest?restartApplication
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::PID_Smenu#item05,6
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[0]/VMenuBar[0]#item441,7
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[1]/VMenuBar[0]#item337,3
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[2]/VMenuBar[0]#item119,7
screenCapturechange-orientation-to-vertical
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::PID_Smenu#item033,1
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[0]/VMenuBar[0]#item463,11
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[1]/VMenuBar[0]#item330,1
mouseClickvaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[2]/VMenuBar[0]#item010,10
screenCapturechange-orientation-to-horizontal
+ +