Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 189673 Details for
Bug 324436
[Theming] Implement themeable shadow effects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
server-side implementation
server-side_shadows.patch (text/plain), 45.13 KB, created by
Ivan Furnadjiev
on 2011-02-24 02:34:45 EST
(
hide
)
Description:
server-side implementation
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2011-02-24 02:34:45 EST
Size:
45.13 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/rwt/internal/theme/QxColor.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/QxColor.java,v >retrieving revision 1.9 >diff -u -r1.9 QxColor.java >--- src/org/eclipse/rwt/internal/theme/QxColor.java 8 Oct 2010 13:14:20 -0000 1.9 >+++ src/org/eclipse/rwt/internal/theme/QxColor.java 24 Feb 2011 07:32:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2007, 2011 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * Innoopract Informationssysteme GmbH - initial API and implementation >+ * EclipseSource - ongoing development > ******************************************************************************/ > > package org.eclipse.rwt.internal.theme; >@@ -24,9 +25,9 @@ > > private static final Map NAMED_COLORS = new HashMap(); > >- public static final QxColor BLACK = new QxColor( 0, 0, 0 ); >+ public static final QxColor BLACK = new QxColor( 0, 0, 0, 1f ); > >- public static final QxColor WHITE = new QxColor( 255, 255, 255 ); >+ public static final QxColor WHITE = new QxColor( 255, 255, 255, 1f ); > > public static final QxColor TRANSPARENT = new QxColor(); > >@@ -35,8 +36,8 @@ > public final int green; > > public final int blue; >- >- public final boolean transparent; >+ >+ public final float alpha; > > static { > // register 16 standard HTML colors >@@ -62,14 +63,18 @@ > this.red = 0; > this.green = 0; > this.blue = 0; >- this.transparent = true; >+ this.alpha = 0f; > } > >- private QxColor( final int red, final int green, final int blue ) { >+ private QxColor( final int red, >+ final int green, >+ final int blue, >+ final float alpha ) >+ { > this.red = red; > this.green = green; > this.blue = blue; >- this.transparent = false; >+ this.alpha = alpha; > } > > public static QxColor create( final int red, final int green, final int blue ) >@@ -80,11 +85,33 @@ > } else if( red == 255 && green == 255 && blue == 255 ) { > result = WHITE; > } else { >- result = new QxColor( red, green, blue ); >+ result = new QxColor( red, green, blue, 1f ); >+ } >+ return result; >+ } >+ >+ public static QxColor create( final int red, >+ final int green, >+ final int blue, >+ final float alpha ) >+ { >+ checkAlpha( alpha ); >+ QxColor result; >+ if( alpha == 1f ) { >+ result = create( red, green, blue ); >+ } else { >+ result = new QxColor( red, green, blue, alpha ); > } > return result; > } > >+ private static void checkAlpha( final float alpha ) { >+ if( alpha < 0 || alpha > 1 ) { >+ String msg = "Alpha out of range [ 0, 1 ]: " + alpha; >+ throw new IllegalArgumentException( msg ); >+ } >+ } >+ > public static QxColor valueOf( final String input ) { > QxColor result; > if( input == null ) { >@@ -94,6 +121,7 @@ > result = TRANSPARENT; > } else { > int red, green, blue; >+ float alpha = 1f; > String lowerCaseInput = input.toLowerCase( Locale.ENGLISH ); > if( input.startsWith( "#" ) ) { > try { >@@ -124,11 +152,14 @@ > blue = values[ 2 ]; > } else { > String[] parts = input.split( "\\s*,\\s*" ); >- if( parts.length == 3 ) { >+ if( parts.length >= 3 && parts.length <= 4 ) { > try { > red = Integer.parseInt( parts[ 0 ] ); > green = Integer.parseInt( parts[ 1 ] ); > blue = Integer.parseInt( parts[ 2 ] ); >+ if( parts.length == 4 ) { >+ alpha = Float.parseFloat( parts[ 3 ] ); >+ } > } catch( final NumberFormatException e ) { > String pattern = "Illegal number format in color definition ''{0}''"; > Object[] arguments = new Object[] { input }; >@@ -142,13 +173,25 @@ > throw new IllegalArgumentException( message ); > } > } >- result = create( red, green, blue ); >+ result = create( red, green, blue, alpha ); > } > return result; > } > >+ public boolean isTransparent() { >+ return alpha == 0f; >+ } >+ > public String toDefaultString() { >- return transparent ? TRANSPARENT_STR : toHtmlString( red, green, blue ); >+ String result; >+ if( isTransparent() ) { >+ result = TRANSPARENT_STR; >+ } else if( alpha == 1f ) { >+ result = toHtmlString( red, green, blue ); >+ } else { >+ result = toRgbaString( red, green, blue, alpha ); >+ } >+ return result; > } > > public boolean equals( final Object obj ) { >@@ -159,18 +202,24 @@ > QxColor other = ( QxColor )obj; > result = other.red == red > && other.green == green >- && other.blue == blue; >+ && other.blue == blue >+ && other.alpha == alpha; > } > return result; > } > > public int hashCode() { >- return transparent ? -1 : red + green * 256 + blue * 65536; >+ int result = 41; >+ result += 19 * result + red; >+ result += 19 * result + green; >+ result += 19 * result + blue; >+ result += 19 * result + Float.floatToIntBits( alpha ); >+ return result; > } > > public String toString() { >- String colors = red + ", " + green + ", " + blue; >- return "QxColor{ " + ( transparent ? TRANSPARENT_STR : colors ) + " }"; >+ String colors = red + ", " + green + ", " + blue + ", " + alpha; >+ return "QxColor{ " + ( alpha == 0f ? TRANSPARENT_STR : colors ) + " }"; > } > > public static String toHtmlString( final int red, >@@ -187,7 +236,7 @@ > > public static Color createColor( final QxColor color ) { > Color result = null; >- if( !color.transparent ) { >+ if( color.alpha == 1f ) { > result = Graphics.getColor( color.red, color.green, color.blue ); > } > return result; >@@ -197,4 +246,22 @@ > String hex = Integer.toHexString( value ); > return hex.length() == 1 ? "0" + hex : hex; > } >+ >+ private static String toRgbaString( final int red, >+ final int green, >+ final int blue, >+ final float alpha ) >+ { >+ StringBuffer sb = new StringBuffer(); >+ sb.append( "rgba(" ); >+ sb.append( red ); >+ sb.append( "," ); >+ sb.append( green ); >+ sb.append( "," ); >+ sb.append( blue ); >+ sb.append( "," ); >+ sb.append( alpha ); >+ sb.append( ")" ); >+ return sb.toString(); >+ } > } >Index: src/org/eclipse/rwt/internal/theme/QxShadow.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/theme/QxShadow.java >diff -N src/org/eclipse/rwt/internal/theme/QxShadow.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rwt/internal/theme/QxShadow.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,158 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 EclipseSource and others. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, >+ * and is available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * EclipseSource - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rwt.internal.theme; >+ >+ >+public class QxShadow implements QxType { >+ >+ public static final QxShadow NONE >+ = new QxShadow( false, 0 , 0, 0, 0, null, 0 ); >+ >+ public final boolean inset; >+ public final int offsetX; >+ public final int offsetY; >+ public final int blur; >+ public final int spread; >+ public final String color; >+ public final float opacity; >+ >+ private QxShadow( final boolean inset, >+ final int offsetX, >+ final int offsetY, >+ final int blur, >+ final int spread, >+ final String color, >+ final float opacity ) >+ { >+ this.inset = inset; >+ this.offsetX = offsetX; >+ this.offsetY = offsetY; >+ this.blur = blur; >+ this.spread = spread; >+ this.color = color; >+ this.opacity = opacity; >+ } >+ >+ public static QxShadow create( final boolean inset, >+ final int offsetX, >+ final int offsetY, >+ final int blur, >+ final int spread, >+ final QxColor color ) >+ { >+ String msg; >+ if( inset ) { >+ msg = "Shadow \"inset\" keyword is not supported"; >+ throw new IllegalArgumentException( msg ); >+ } >+ if( blur < 0 ) { >+ msg = "Shadow blur distance can't be negative"; >+ throw new IllegalArgumentException( msg ); >+ } >+ if( spread != 0 ) { >+ msg = "Shadow spread distance is not supported"; >+ throw new IllegalArgumentException( msg ); >+ } >+ if( color == null ) { >+ throw new NullPointerException( "null argument" ); >+ } >+ String htmlColor = QxColor.toHtmlString( color.red, >+ color.green, >+ color.blue ); >+ return new QxShadow( inset, >+ offsetX, >+ offsetY, >+ blur, >+ spread, >+ htmlColor, >+ color.alpha ); >+ } >+ >+ public boolean equals( final Object obj ) { >+ boolean result = false; >+ if( obj == this ) { >+ result = true; >+ } else if( obj instanceof QxShadow ) { >+ QxShadow other = ( QxShadow )obj; >+ result = other.inset == inset >+ && other.offsetX == offsetX >+ && other.offsetY == offsetY >+ && other.blur == blur >+ && other.spread == spread >+ && ( color == null >+ ? other.color == null >+ : color.equals( other.color ) ) >+ && other.opacity == opacity; >+ } >+ return result; >+ } >+ >+ public int hashCode() { >+ int result = 17; >+ result += 11 * result + offsetX; >+ result += 11 * result + offsetY; >+ result += 11 * result + blur; >+ result += 11 * result + spread; >+ if( color != null ) { >+ result += 11 * result + color.hashCode(); >+ } >+ result += 11 * result + Float.floatToIntBits( opacity ); >+ result += inset ? 0 : 11 * result + 13; >+ return result; >+ } >+ >+ public String toDefaultString() { >+ StringBuffer buffer = new StringBuffer(); >+ if( color == null ) { >+ buffer.append( "none" ); >+ } else { >+ if( inset ) { >+ buffer.append( "inset " ); >+ } >+ buffer.append( offsetX ); >+ buffer.append( "px " ); >+ buffer.append( offsetY ); >+ buffer.append( "px " ); >+ buffer.append( blur ); >+ buffer.append( "px " ); >+ buffer.append( spread ); >+ buffer.append( "px " ); >+ buffer.append( "rgba( " ); >+ QxColor qxColor = QxColor.valueOf( color ); >+ buffer.append( qxColor.red ); >+ buffer.append( ", " ); >+ buffer.append( qxColor.green ); >+ buffer.append( ", " ); >+ buffer.append( qxColor.blue ); >+ buffer.append( ", " ); >+ buffer.append( opacity ); >+ buffer.append( " )" ); >+ } >+ return buffer.toString(); >+ } >+ >+ public String toString() { >+ StringBuffer buffer = new StringBuffer(); >+ buffer.append( inset ); >+ buffer.append( ", " ); >+ buffer.append( offsetX ); >+ buffer.append( ", " ); >+ buffer.append( offsetY ); >+ buffer.append( ", " ); >+ buffer.append( blur ); >+ buffer.append( ", " ); >+ buffer.append( spread ); >+ buffer.append( ", " ); >+ buffer.append( color ); >+ buffer.append( ", " ); >+ buffer.append( opacity ); >+ return "QxShadow{ " + buffer.toString() + " }"; >+ } >+} >Index: src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java,v >retrieving revision 1.12 >diff -u -r1.12 ThemeStoreWriter.java >--- src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java 20 Dec 2010 14:51:08 -0000 1.12 >+++ src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java 24 Feb 2011 07:32:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. >+ * Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 which accompanies this distribution, > * and is available at http://www.eclipse.org/legal/epl-v10.html >@@ -54,6 +54,7 @@ > JsonObject borderMap = new JsonObject(); > JsonObject cursorMap = new JsonObject(); > JsonObject animationMap = new JsonObject(); >+ JsonObject shadowMap = new JsonObject(); > QxType[] values = new QxType[ valueSet.size() ]; > valueSet.toArray( values ); > for( int i = 0; i < values.length; i++ ) { >@@ -94,7 +95,7 @@ > } > } else if( value instanceof QxColor ) { > QxColor color = ( QxColor )value; >- if( color.transparent ) { >+ if( color.isTransparent() ) { > colorMap.append( key, "undefined" ); > } else { > colorMap.append( key, QxColor.toHtmlString( color.red, >@@ -137,6 +138,21 @@ > currentAnimationArray ); > } > animationMap.append( key, animationObject ); >+ } else if( value instanceof QxShadow ) { >+ QxShadow shadow = ( QxShadow )value; >+ if( shadow.equals( QxShadow.NONE ) ) { >+ shadowMap.append( key, JsonValue.NULL ); >+ } else { >+ JsonArray shadowArray = new JsonArray(); >+ shadowArray.append( shadow.inset ); >+ shadowArray.append( shadow.offsetX ); >+ shadowArray.append( shadow.offsetY ); >+ shadowArray.append( shadow.blur ); >+ shadowArray.append( shadow.spread ); >+ shadowArray.append( shadow.color ); >+ shadowArray.append( shadow.opacity ); >+ shadowMap.append( key, shadowArray ); >+ } > } > } > JsonObject valuesMap = new JsonObject(); >@@ -149,6 +165,7 @@ > valuesMap.append( "borders", borderMap ); > valuesMap.append( "cursors", cursorMap ); > valuesMap.append( "animations", animationMap ); >+ valuesMap.append( "shadows", shadowMap ); > return valuesMap; > } > >Index: src/org/eclipse/rwt/internal/theme/css/PropertyResolver.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/css/PropertyResolver.java,v >retrieving revision 1.23 >diff -u -r1.23 PropertyResolver.java >--- src/org/eclipse/rwt/internal/theme/css/PropertyResolver.java 21 Jan 2011 22:20:07 -0000 1.23 >+++ src/org/eclipse/rwt/internal/theme/css/PropertyResolver.java 24 Feb 2011 07:32:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2010 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2008, 2011 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -119,6 +119,8 @@ > result = readFloat( unit ); > } else if( isAnimationProperty( name ) ) { > result = readAnimation( unit ); >+ } else if( isShadowProperty( name ) ) { >+ result = readShadow( unit ); > } else { > throw new IllegalArgumentException( "Unknown property " + name ); > } >@@ -183,6 +185,61 @@ > return result; > } > >+ static QxColor readColorWithAlpha( final LexicalUnit unit ) { >+ QxColor result = null; >+ int[] values = new int[ 3 ]; >+ float alpha = 1f; >+ short type = unit.getLexicalUnitType(); >+ if( type == LexicalUnit.SAC_FUNCTION >+ && "rgba".equals( unit.getFunctionName() ) ) >+ { >+ LexicalUnit nextUnit = unit.getParameters(); >+ boolean ok = nextUnit != null; >+ boolean mixedTypes = false; >+ short previousType = -1; >+ int pos = 0; >+ while( ok ) { >+ type = nextUnit.getLexicalUnitType(); >+ if( pos == 0 || pos == 2 || pos == 4 ) { >+ // color number >+ if( type == LexicalUnit.SAC_INTEGER ) { >+ values[ pos / 2 ] = normalizeRGBValue( nextUnit.getIntegerValue() ); >+ } else if( type == LexicalUnit.SAC_PERCENTAGE ) { >+ float percentValue >+ = normalizePercentValue( nextUnit.getFloatValue() ); >+ values[ pos / 2 ] = ( int )( 255 * percentValue / 100 ); >+ } else { >+ ok = false; >+ } >+ mixedTypes = previousType != -1 && previousType != type; >+ previousType = type; >+ } else if( pos == 1 || pos == 3 || pos == 5 ) { >+ // comma >+ if( type != LexicalUnit.SAC_OPERATOR_COMMA ) { >+ ok = false; >+ } >+ } else if( pos == 6 ) { >+ // alpha number >+ if( type == LexicalUnit.SAC_REAL ) { >+ alpha = normalizeAlphaValue( nextUnit.getFloatValue() ); >+ } else { >+ ok = false; >+ } >+ } >+ pos++; >+ nextUnit = nextUnit.getNextLexicalUnit(); >+ ok &= nextUnit != null && pos < 7 && !mixedTypes; >+ } >+ if( pos == 7 ) { >+ result = QxColor.create( values[ 0 ], values[ 1 ], values[ 2 ], alpha ); >+ } >+ } >+ if( result == null ) { >+ throw new IllegalArgumentException( "Failed to parse rgba color" ); >+ } >+ return result; >+ } >+ > static boolean isDimensionProperty( final String property ) { > return "spacing".equals( property ) > || "width".equals( property ) >@@ -771,6 +828,75 @@ > return result; > } > >+ static boolean isShadowProperty( final String property ) { >+ return "box-shadow".equals( property ); >+ } >+ >+ static QxShadow readShadow( final LexicalUnit unit ) { >+ QxShadow result = null; >+ boolean inset = false; >+ Integer offsetX = null; >+ Integer offsetY = null; >+ int blur = 0; >+ int spread = 0; >+ QxColor color = QxColor.BLACK; >+ LexicalUnit nextUnit = unit; >+ short type = nextUnit.getLexicalUnitType(); >+ if( type == LexicalUnit.SAC_IDENT ) { >+ String value = nextUnit.getStringValue(); >+ if( NONE.equals( value ) ) { >+ result = QxShadow.NONE; >+ } else if( INSET.equals( value ) ) { >+ inset = true; >+ } >+ nextUnit = nextUnit.getNextLexicalUnit(); >+ } >+ if( result == null ) { >+ boolean ok = true; >+ int pos = 0; >+ while( nextUnit != null && ok ) { >+ pos++; >+ Integer nextValue = readSingleLengthUnit( nextUnit ); >+ ok &= nextValue != null && pos <= 4; >+ if( ok ) { >+ if( pos == 1 ) { >+ offsetX = nextValue; >+ } else if( pos == 2 ) { >+ offsetY = nextValue; >+ } else if( pos == 3 ) { >+ blur = nextValue.intValue(); >+ } else if( pos == 4 ) { >+ spread = nextValue.intValue(); >+ } >+ nextUnit = nextUnit.getNextLexicalUnit(); >+ } >+ } >+ if( nextUnit != null ) { >+ type = nextUnit.getLexicalUnitType(); >+ if( type == LexicalUnit.SAC_FUNCTION >+ && "rgba".equals( nextUnit.getFunctionName() ) ) >+ { >+ color = readColorWithAlpha( nextUnit ); >+ } else { >+ color = readColor( nextUnit ); >+ } >+ } >+ } >+ if( offsetX != null && offsetY != null ) { >+ result = QxShadow.create( inset, >+ offsetX.intValue(), >+ offsetY.intValue(), >+ blur, >+ spread, >+ color ); >+ } >+ if( result == null ) { >+ throw new IllegalArgumentException( "Failed to parse shadow " >+ + toString( unit ) ); >+ } >+ return result; >+ } >+ > private static Integer readSingleLengthUnit( final LexicalUnit unit ) { > Integer result = null; > short type = unit.getLexicalUnitType(); >@@ -795,6 +921,16 @@ > return result; > } > >+ private static float normalizeAlphaValue( final float input ) { >+ float result = input; >+ if( input < 0 ) { >+ result = 0f; >+ } else if( input > 1 ) { >+ result = 1f; >+ } >+ return result; >+ } >+ > private static float normalizePercentValue( final float input ) { > float result = input; > if( input < 0f ) { >Index: src/org/eclipse/swt/internal/widgets/shellkit/Shell.default.css >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/widgets/shellkit/Shell.default.css,v >retrieving revision 1.13 >diff -u -r1.13 Shell.default.css >--- src/org/eclipse/swt/internal/widgets/shellkit/Shell.default.css 29 Dec 2010 00:57:30 -0000 1.13 >+++ src/org/eclipse/swt/internal/widgets/shellkit/Shell.default.css 24 Feb 2011 07:32:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2010 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2008, 2011 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -18,6 +18,7 @@ > padding: 0px; > background-image: none; > opacity: 1; >+ box-shadow: none; > } > > Shell[TITLE], Shell[BORDER] { >Index: src/org/eclipse/swt/internal/widgets/shellkit/Shell.theme.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/widgets/shellkit/Shell.theme.xml,v >retrieving revision 1.38 >diff -u -r1.38 Shell.theme.xml >--- src/org/eclipse/swt/internal/widgets/shellkit/Shell.theme.xml 6 Feb 2011 16:57:15 -0000 1.38 >+++ src/org/eclipse/swt/internal/widgets/shellkit/Shell.theme.xml 24 Feb 2011 07:32:22 -0000 >@@ -1,6 +1,6 @@ > <?xml version="1.0" encoding="UTF-8" ?> > <!-- >- Copyright (c) 2008, 2009 Innoopract Informationssysteme GmbH. >+ Copyright (c) 2008, 2011 Innoopract Informationssysteme GmbH. > All rights reserved. This program and the accompanying materials > are made available under the terms of the Eclipse Public License v1.0 > which accompanies this distribution, and is available at >@@ -35,8 +35,11 @@ > <property name="background-color" > description="Background color for shells." /> > >- <property name="opacity" >- description="The opacity of the shell. A value between 0 and 1." /> >+ <property name="opacity" >+ description="The opacity of the shell. A value between 0 and 1." /> >+ >+ <property name="box-shadow" >+ description="The shadow behind the shell." /> > > <style name="BORDER" > description="Indicates that the shell should have a border." /> >#P org.eclipse.rap.rwt.q07 >Index: js/org/eclipse/swt/theme/ThemeStore.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/js/org/eclipse/swt/theme/ThemeStore.js,v >retrieving revision 1.31 >diff -u -r1.31 ThemeStore.js >--- js/org/eclipse/swt/theme/ThemeStore.js 27 Jan 2011 11:57:48 -0000 1.31 >+++ js/org/eclipse/swt/theme/ThemeStore.js 24 Feb 2011 07:32:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2010 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2007, 2011 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -31,7 +31,8 @@ > colors : {}, > borders : {}, > cursors : {}, >- animations : {} >+ animations : {}, >+ shadows : {} > }; > this._cssValues = {}; > this._statesMap = { >Index: js/org/eclipse/swt/theme/ThemeValues.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/js/org/eclipse/swt/theme/ThemeValues.js,v >retrieving revision 1.33 >diff -u -r1.33 ThemeValues.js >--- js/org/eclipse/swt/theme/ThemeValues.js 1 Feb 2011 14:07:40 -0000 1.33 >+++ js/org/eclipse/swt/theme/ThemeValues.js 24 Feb 2011 07:32:23 -0000 >@@ -168,7 +168,14 @@ > getCssAnimation : function( element, key ) { > var vkey = this._store.getCssValue( element, this._states, key ); > var values = this._store.getThemeValues(); >- var result = values.animations[ vkey ]; >+ var result = values.animations[ vkey ]; >+ return result; >+ }, >+ >+ getCssShadow : function( element, key ) { >+ var vkey = this._store.getCssValue( element, this._states, key ); >+ var values = this._store.getThemeValues(); >+ var result = values.shadows[ vkey ]; > return result; > } > >#P org.eclipse.rap.rwt.test >Index: src/org/eclipse/rwt/internal/theme/QxColor_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/theme/QxColor_Test.java,v >retrieving revision 1.7 >diff -u -r1.7 QxColor_Test.java >--- src/org/eclipse/rwt/internal/theme/QxColor_Test.java 8 Oct 2010 13:14:21 -0000 1.7 >+++ src/org/eclipse/rwt/internal/theme/QxColor_Test.java 24 Feb 2011 07:32:24 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2009 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2007, 2011 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -39,12 +39,30 @@ > } > } > >+ public void testIllegalArguments_OutOfRangeAlpha() { >+ try { >+ QxColor.valueOf( "1, 2, 3, 1.01" ); >+ fail( "Exception expected" ); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ >+ public void testIllegalArguments_NegativeAlpha() { >+ try { >+ QxColor.valueOf( "1, 2, 3, -0.01" ); >+ fail( "Exception expected" ); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ > public void test6HexNotation() { > QxColor color1 = QxColor.valueOf( "#0023ff" ); > assertEquals( 0, color1.red ); > assertEquals( 35, color1.green ); > assertEquals( 255, color1.blue ); >- assertFalse( color1.transparent ); >+ assertEquals( 1f, color1.alpha, 0 ); > QxColor color2 = QxColor.valueOf( "#efeFEF" ); > assertEquals( 239, color2.red ); > assertEquals( 239, color2.green ); >@@ -56,7 +74,7 @@ > assertEquals( 0, color1.red ); > assertEquals( 51, color1.green ); > assertEquals( 255, color1.blue ); >- assertFalse( color1.transparent ); >+ assertEquals( 1f, color1.alpha, 0 ); > QxColor color2 = QxColor.valueOf( "#ccc" ); > assertEquals( 204, color2.red ); > assertEquals( 204, color2.green ); >@@ -69,7 +87,7 @@ > assertEquals( 255, color1.red ); > assertEquals( 0, color1.green ); > assertEquals( 0, color1.blue ); >- assertFalse( color1.transparent ); >+ assertEquals( 1f, color1.alpha, 0 ); > QxColor color2 = QxColor.valueOf( "blue" ); > assertEquals( 0, color2.red ); > assertEquals( 0, color2.green ); >@@ -81,11 +99,19 @@ > assertEquals( 100, color.red ); > assertEquals( 23, color.green ); > assertEquals( 42, color.blue ); >- assertFalse( color.transparent ); >+ assertEquals( 1f, color.alpha, 0 ); >+ } >+ >+ public void testCommaSeparatedValues_WithAlpha() { >+ QxColor color = QxColor.valueOf( "100, 23, 42, 0.5" ); >+ assertEquals( 100, color.red ); >+ assertEquals( 23, color.green ); >+ assertEquals( 42, color.blue ); >+ assertEquals( 0.5, color.alpha, 0 ); > } > > public void testTransparent() { >- assertTrue( QxColor.TRANSPARENT.transparent ); >+ assertTrue( QxColor.TRANSPARENT.isTransparent() ); > } > > public void testShared() { >@@ -100,13 +126,28 @@ > > public void testToString() { > QxColor color = QxColor.valueOf( "100, 23, 42" ); >- assertEquals( "QxColor{ 100, 23, 42 }", color.toString() ); >+ assertEquals( "QxColor{ 100, 23, 42, 1.0 }", color.toString() ); >+ } >+ >+ public void testToString_WithAlpha() { >+ QxColor color = QxColor.valueOf( "100, 23, 42, 0.5" ); >+ assertEquals( "QxColor{ 100, 23, 42, 0.5 }", color.toString() ); > } > > public void testDefaultString() { > QxColor color = QxColor.valueOf( "100, 23, 42" ); > assertEquals( "#64172a", color.toDefaultString() ); > } >+ >+ public void testDefaultString_Transparent() { >+ QxColor color = QxColor.valueOf( "100, 23, 42, 0" ); >+ assertEquals( "transparent", color.toDefaultString() ); >+ } >+ >+ public void testDefaultString_WithAlpha() { >+ QxColor color = QxColor.valueOf( "100, 23, 42, 0.5" ); >+ assertEquals( "rgba(100,23,42,0.5)", color.toDefaultString() ); >+ } > > public void testWithTurkishLocale() { > Locale originalLocale = Locale.getDefault(); >Index: src/org/eclipse/rwt/internal/theme/QxShadow_Test.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/theme/QxShadow_Test.java >diff -N src/org/eclipse/rwt/internal/theme/QxShadow_Test.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rwt/internal/theme/QxShadow_Test.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,113 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 EclipseSource and others. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, >+ * and is available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * EclipseSource - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.rwt.internal.theme; >+ >+import junit.framework.TestCase; >+ >+ >+public class QxShadow_Test extends TestCase { >+ >+ public void testIllegalArguments_Inset() { >+ try { >+ QxShadow.create( true, 10, 10, 0, 0, QxColor.BLACK ); >+ fail( "Exception expected" ); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ >+ public void testIllegalArguments_NegativeBlur() { >+ try { >+ QxShadow.create( false, 10, 10, -10, 0, QxColor.BLACK ); >+ fail( "Exception expected" ); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ >+ public void testIllegalArguments_SpreadNotZero() { >+ try { >+ QxShadow.create( false, 10, 10, 0, 10, QxColor.BLACK ); >+ fail( "Exception expected" ); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ >+ public void testIllegalArguments_NullColor() { >+ try { >+ QxShadow.create( false, 10, 10, 0, 0, null ); >+ fail( "Exception expected" ); >+ } catch( NullPointerException e ) { >+ // expected >+ } >+ } >+ >+ public void testCreate_WithoutOpacity() { >+ QxShadow shadow = QxShadow.create( false, 10, 10, 0, 0, QxColor.BLACK ); >+ assertNotNull( shadow ); >+ assertFalse( shadow.inset ); >+ assertEquals( 10, shadow.offsetX ); >+ assertEquals( 10, shadow.offsetY ); >+ assertEquals( 0, shadow.blur ); >+ assertEquals( 0, shadow.spread ); >+ assertEquals( QxColor.BLACK.toDefaultString(), shadow.color ); >+ assertEquals( 1f, shadow.opacity, 0 ); >+ } >+ >+ public void testCreate_WithOpacity() { >+ QxColor color = QxColor.valueOf( "0, 0, 0, 0.5" ); >+ QxShadow shadow = QxShadow.create( false, 10, 10, 0, 0, color ); >+ assertNotNull( shadow ); >+ assertFalse( shadow.inset ); >+ assertEquals( 10, shadow.offsetX ); >+ assertEquals( 10, shadow.offsetY ); >+ assertEquals( 0, shadow.blur ); >+ assertEquals( 0, shadow.spread ); >+ assertEquals( QxColor.BLACK.toDefaultString(), shadow.color ); >+ assertEquals( 0.5, shadow.opacity, 0 ); >+ } >+ >+ public void testNoneShadow() { >+ QxShadow shadow = QxShadow.NONE; >+ assertFalse( shadow.inset ); >+ assertEquals( 0, shadow.offsetX ); >+ assertEquals( 0, shadow.offsetY ); >+ assertEquals( 0, shadow.blur ); >+ assertEquals( 0, shadow.spread ); >+ assertNull( shadow.color ); >+ assertEquals( 0, shadow.opacity, 0 ); >+ } >+ >+ public void testToString() { >+ QxShadow shadow = QxShadow.create( false, 10, 10, 0, 0, QxColor.BLACK ); >+ String expected = "QxShadow{ false, 10, 10, 0, 0, #000000, 1.0 }"; >+ assertEquals( expected, shadow.toString() ); >+ } >+ >+ public void testToDefaultString() { >+ QxColor color = QxColor.valueOf( "0, 0, 0, 0.5" ); >+ QxShadow shadow = QxShadow.create( false, 10, 10, 0, 0, color ); >+ String expected = "10px 10px 0px 0px rgba( 0, 0, 0, 0.5 )"; >+ assertEquals( expected, shadow.toDefaultString() ); >+ } >+ >+ public void testToDefaultString_NoneShadow() { >+ QxShadow shadow = QxShadow.NONE; >+ String expected = "none"; >+ assertEquals( expected, shadow.toDefaultString() ); >+ } >+ >+ public void testEquals() { >+ QxShadow shadow1 = QxShadow.create( false, 10, 10, 0, 0, QxColor.BLACK ); >+ QxShadow shadow2 = QxShadow.create( false, 10, 10, 0, 0, QxColor.BLACK ); >+ assertTrue( shadow1.equals( shadow2 ) ); >+ } >+} >Index: src/org/eclipse/rwt/internal/theme/ThemeStoreWriter_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/theme/ThemeStoreWriter_Test.java,v >retrieving revision 1.5 >diff -u -r1.5 ThemeStoreWriter_Test.java >--- src/org/eclipse/rwt/internal/theme/ThemeStoreWriter_Test.java 19 Nov 2010 17:11:04 -0000 1.5 >+++ src/org/eclipse/rwt/internal/theme/ThemeStoreWriter_Test.java 24 Feb 2011 07:32:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. >+ * Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 which accompanies this distribution, > * and is available at http://www.eclipse.org/legal/epl-v10.html >@@ -45,7 +45,8 @@ > expected = "\"cd56ce7d\": [ \"cd56ce7d\", 50, 100 ]"; > assertTrue( output.indexOf( expected ) != -1 ); > // conditional colors >- expected = "\"color\": [ [ [ \"[BORDER\" ], \"ff\" ], [ [], \"0\" ] ]"; >+ expected = "\"color\": [ [ [ \"[BORDER\" ], " >+ + "\"400339c0\" ], [ [], \"3fe41900\" ] ]"; > assertTrue( output.indexOf( expected ) != -1 ); > // conditional background-images > expected = "\"background-image\": " >@@ -72,7 +73,7 @@ > + "\"slideIn\": [ 2000, \"easeIn\" ],\n" > + "\"slideOut\": [ 2000, \"easeOut\" ]\n" > + "}\n" >- + "}\n"; >+ + "},\n"; > assertTrue( output.indexOf( expected ) != -1 ); > expected = "\"Menu\": {\n" > + "\"animation\": [ [ [], \"2e5f3d63\" ] ]\n" >@@ -146,6 +147,30 @@ > assertTrue( output.indexOf( expected ) != -1 ); > } > >+ public void testWriteShadow() throws Exception { >+ ThemeCssElement element = new ThemeCssElement( "Shell" ); >+ element.addProperty( "box-shadow" ); >+ IThemeCssElement[] elements = new IThemeCssElement[] { element }; >+ ThemeStoreWriter storeWriter = new ThemeStoreWriter( elements ); >+ String themeId = "myTheme"; >+ String cssCode >+ = "Shell { box-shadow: 10px 10px 3px 0 rgba( 0, 0, 0, 0.5 ); }\n"; >+ ResourceLoader loader >+ = ThemeTestUtil.createResourceLoader( Fixture.class ); >+ ThemeTestUtil.registerCustomTheme( themeId, cssCode, loader ); >+ Theme theme = ThemeManager.getInstance().getTheme( themeId ); >+ storeWriter.addTheme( theme, true ); >+ String output = storeWriter.createJs(); >+ String expected = "\"shadows\": {\n" >+ + "\"2aedfabd\": [ false, 10, 10, 3, 0, \"#000000\", 0.5 ]\n" >+ + "}\n"; >+ assertTrue( output.indexOf( expected ) != -1 ); >+ expected = "\"Shell\": {\n" >+ + "\"box-shadow\": [ [ [], \"2aedfabd\" ] ]\n" >+ + "}"; >+ assertTrue( output.indexOf( expected ) != -1 ); >+ } >+ > protected void setUp() throws Exception { > Fixture.setUp(); > Fixture.fakeNewRequest(); >Index: src/org/eclipse/rwt/internal/theme/css/PropertyResolver_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/theme/css/PropertyResolver_Test.java,v >retrieving revision 1.20 >diff -u -r1.20 PropertyResolver_Test.java >--- src/org/eclipse/rwt/internal/theme/css/PropertyResolver_Test.java 3 Dec 2010 07:55:50 -0000 1.20 >+++ src/org/eclipse/rwt/internal/theme/css/PropertyResolver_Test.java 24 Feb 2011 07:32:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2010 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2008, 2011 Innoopract Informationssysteme GmbH. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -77,6 +77,78 @@ > } > } > >+ public void testColorWithAlpha() throws Exception { >+ String input = "rgba( 1, 2, 3, 0.25 )"; >+ QxColor result >+ = PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.red ); >+ assertEquals( 2, result.green ); >+ assertEquals( 3, result.blue ); >+ assertEquals( 0.25, result.alpha, 0 ); >+ } >+ >+ public void testColorWithAlpha_Percents() throws Exception { >+ String input = "rgba( 0%, 50%, 100%, 0.25 )"; >+ QxColor result >+ = PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 0, result.red ); >+ assertEquals( 127, result.green ); >+ assertEquals( 255, result.blue ); >+ assertEquals( 0.25, result.alpha, 0 ); >+ } >+ >+ public void testColorWithAlpha_NoTransparency() throws Exception { >+ String input = "rgba( 0, 0, 0, 1 )"; >+ QxColor result >+ = PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ assertSame( QxColor.BLACK, result ); >+ } >+ >+ public void testColorWithAlpha_NormalizeNegativeAlpha() throws Exception { >+ String input = "rgba( 1, 2, 3, -0.1 )"; >+ QxColor result >+ = PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.red ); >+ assertEquals( 2, result.green ); >+ assertEquals( 3, result.blue ); >+ assertEquals( 0f, result.alpha, 0 ); >+ } >+ >+ public void testColorWithAlpha_NormalizePositiveAlpha() throws Exception { >+ String input = "rgba( 1, 2, 3, 1.1 )"; >+ QxColor result >+ = PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.red ); >+ assertEquals( 2, result.green ); >+ assertEquals( 3, result.blue ); >+ assertEquals( 1f, result.alpha, 0 ); >+ } >+ >+ public void testColorWithAlpha_NormalizeColorValue() throws Exception { >+ String input = "rgba( -10, 127, 300, 0.25 )"; >+ QxColor result >+ = PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 0, result.red ); >+ assertEquals( 127, result.green ); >+ assertEquals( 255, result.blue ); >+ assertEquals( 0.25, result.alpha, 0 ); >+ } >+ >+ public void testColorWithAlpha_MixedValues() throws Exception { >+ String input = "rgba( 0%, 50, 100, 0.25 )"; >+ try { >+ PropertyResolver.readColorWithAlpha( parseProperty( input ) ); >+ fail(); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ > public void testDimension() throws Exception { > QxDimension zero = PropertyResolver.readDimension( parseProperty( "0px" ) ); > assertNotNull( zero ); >@@ -652,6 +724,119 @@ > } > } > >+ public void testShadow_XYOffsetOnlyNotation() throws Exception { >+ String input = "1px 2px"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 0, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#000000", result.color ); >+ assertEquals( 1f, result.opacity, 0 ); >+ } >+ >+ public void testShadow_OffsetXYBlurNotation() throws Exception { >+ String input = "1px 2px 3px"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 3, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#000000", result.color ); >+ assertEquals( 1f, result.opacity, 0 ); >+ } >+ >+ public void testShadow_XYOffsetBlurSpreadNotation() throws Exception { >+ String input = "1px 2px 0 0"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 0, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#000000", result.color ); >+ assertEquals( 1f, result.opacity, 0 ); >+ } >+ >+ public void testShadow_FullNotation_NamedColor() throws Exception { >+ String input = "1px 2px 0px 0 red"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 0, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#ff0000", result.color ); >+ assertEquals( 1f, result.opacity, 0 ); >+ } >+ >+ public void testShadow_FullNotation_HexColor() throws Exception { >+ String input = "1px 2px 0px 0 #FF0000"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 0, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#ff0000", result.color ); >+ assertEquals( 1f, result.opacity, 0 ); >+ } >+ >+ public void testShadow_FullNotation_RgbColor() throws Exception { >+ String input = "1px 2px 3px 0 rgb( 1, 2, 3 )"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 3, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#010203", result.color ); >+ assertEquals( 1f, result.opacity, 0 ); >+ } >+ >+ public void testShadow_FullNotation_RgbaColor() throws Exception { >+ String input = "1px 2px 0px 0 rgba( 1, 2, 3, 0.25 )"; >+ QxShadow result = PropertyResolver.readShadow( parseProperty( input ) ); >+ assertNotNull( result ); >+ assertEquals( 1, result.offsetX ); >+ assertEquals( 2, result.offsetY ); >+ assertEquals( 0, result.blur ); >+ assertEquals( 0, result.spread ); >+ assertEquals( "#010203", result.color ); >+ assertEquals( 0.25, result.opacity, 0 ); >+ } >+ >+ public void testShadow_WithoutOffsetY() throws Exception { >+ try { >+ PropertyResolver.readShadow( parseProperty( "1px" ) ); >+ fail(); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ >+ public void testShadow_MissingRgbaParameters() throws Exception { >+ String input = "1px 2px 0px 0 rgba( 1, 2, 0.25 )"; >+ try { >+ PropertyResolver.readShadow( parseProperty( input ) ); >+ fail(); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ >+ public void testShadow_NonZeroSpread() throws Exception { >+ String input = "1px 2px 3px 3px rgba( 1, 2, 3, 0.25 )"; >+ try { >+ PropertyResolver.readShadow( parseProperty( input ) ); >+ fail(); >+ } catch( IllegalArgumentException e ) { >+ // expected >+ } >+ } >+ > public void testIsColorProperty() { > assertFalse( PropertyResolver.isColorProperty( "border" ) ); > assertTrue( PropertyResolver.isColorProperty( "color" ) ); >@@ -685,6 +870,10 @@ > assertTrue( PropertyResolver.isAnimationProperty( "animation" ) ); > } > >+ public void testIsShadowProperty() { >+ assertTrue( PropertyResolver.isShadowProperty( "box-shadow" ) ); >+ } >+ > public void testResolveProperty() throws Exception { > LexicalUnit unit = parseProperty( "white" ); > QxType value = PropertyResolver.resolveProperty( "color", unit, null );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 324436
:
189536
|
189673
|
189674
|
192013