Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2016-11-10 10:03:41 +0000
committerIvan Furnadjiev2016-11-10 10:03:41 +0000
commit75d863544644b5702407d3706133e8a439a515de (patch)
tree8f6a304a89148fe64b70ea14f07c40f594a7a018
parent6c7eb6fd0674bb6f77d94fadd45f5488dc359539 (diff)
downloadorg.eclipse.rap-75d863544644b5702407d3706133e8a439a515de.tar.gz
org.eclipse.rap-75d863544644b5702407d3706133e8a439a515de.tar.xz
org.eclipse.rap-75d863544644b5702407d3706133e8a439a515de.zip
Fix Control layout when padding is set with custom variant
The control padding set by the themeing is buffered in the Control calss. The buffered value must be reset when custom variant is applied on the control. Change-Id: I62a6e88fff5d25b6dc41e484b5c3b088a581d9cf
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java3
-rw-r--r--tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java29
2 files changed, 32 insertions, 0 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java
index f712e75336..73c8feb945 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java
@@ -2516,6 +2516,9 @@ public abstract class Control extends Widget implements Drawable {
}
ActiveKeysUtil.preserveCancelKeys( this );
}
+ if( RWT.CUSTOM_VARIANT.equals( key ) ) {
+ bufferedPadding = null;
+ }
super.setData( key, value );
}
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java
index 5748762931..f01c8c4cc2 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java
@@ -1554,6 +1554,35 @@ public class Control_Test {
}
@Test
+ public void testPadding() throws IOException {
+ String css = "Composite { padding: 1px 2px 3px 4px }";
+ ThemeTestUtil.registerTheme( "custom", css, null );
+ ThemeTestUtil.setCurrentThemeId( "custom" );
+
+ Composite composite = new Composite( shell, SWT.NONE );
+
+ BoxDimensions expected = new BoxDimensions( 1, 2, 3, 4 );
+ assertEquals( expected, composite.getPadding() );
+ }
+
+ @Test
+ public void testPadding_afterSettingCustomVariant() throws IOException {
+ String css = "Composite { padding: 1px 2px 3px 4px } "
+ + "Composite.abc { padding: 5px 6px 7px 8px }";
+ ThemeTestUtil.registerTheme( "custom", css, null );
+ ThemeTestUtil.setCurrentThemeId( "custom" );
+
+ Composite composite = new Composite( shell, SWT.NONE );
+ // buffer the padding
+ composite.getPadding();
+ composite.setData( RWT.CUSTOM_VARIANT, "abc" );
+
+
+ BoxDimensions expected = new BoxDimensions( 5, 6, 7, 8 );
+ assertEquals( expected, composite.getPadding() );
+ }
+
+ @Test
public void testGetBorderWidth_returnsTheMaximumBorderEdgeWidth() throws IOException {
String css = "Composite { border: 1px solid black; border-top: 3px solid black; }";
ThemeTestUtil.registerTheme( "custom", css, null );

Back to the top