You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2015/10/27 12:34:14 UTC

svn commit: r1710787 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java

Author: deki
Date: Tue Oct 27 11:34:14 2015
New Revision: 1710787

URL: http://svn.apache.org/viewvc?rev=1710787&view=rev
Log:
improve robustness

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java?rev=1710787&r1=1710786&r2=1710787&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java Tue Oct 27 11:34:14 2015
@@ -102,8 +102,14 @@ without shadow
       writer.writeClassAttribute(Classes.create(box, "shadow"));
 
       final Style shadow = new Style();
-      shadow.setWidth(box.getCurrentWidth().subtract(1));
-      shadow.setHeight(box.getCurrentHeight().subtract(1));
+      Measure boxCurrentWidth = box.getCurrentWidth();
+      if (boxCurrentWidth!=null) {
+        shadow.setWidth(boxCurrentWidth.subtract(1));
+      }
+      Measure boxCurrentHeight = box.getCurrentHeight();
+      if (boxCurrentHeight!=null) {
+        shadow.setHeight(boxCurrentHeight.subtract(1));
+      }
       writer.writeStyleAttribute(shadow);
 
       // border begin
@@ -111,8 +117,12 @@ without shadow
       writer.writeClassAttribute(Classes.create(box, "border"));
 
       final Style border = new Style();
-      border.setWidth(box.getCurrentWidth().subtract(3));
-      border.setHeight(box.getCurrentHeight().subtract(3));
+      if (boxCurrentWidth!=null) {
+        border.setWidth(boxCurrentWidth.subtract(3));
+      }
+      if (boxCurrentHeight!=null) {
+        border.setHeight(boxCurrentHeight.subtract(3));
+      }
       writer.writeStyleAttribute(border);
     }
 
@@ -142,8 +152,12 @@ without shadow
     final Measure borderRight = box.getBorderRight();
     final Measure borderTop = box.getBorderTop();
     final Measure borderBottom = box.getBorderBottom();
-    style.setWidth(style.getWidth().subtract(borderLeft).subtract(borderRight));
-    style.setHeight(style.getHeight().subtract(borderTop).subtract(borderBottom));
+    if (style.getWidth()!=null) {
+      style.setWidth(style.getWidth().subtract(borderLeft).subtract(borderRight));
+    }
+    if (style.getHeight()!=null) {
+      style.setHeight(style.getHeight().subtract(borderTop).subtract(borderBottom));
+    }
     style.setLeft(borderLeft);
     style.setTop(borderTop);
     writer.writeStyleAttribute(style);