? cairopixel.patch.v2.diff
? ff-opt-static
? layout/style-beforeibrokeit
? layout/style/conflict.diff
? layout/style/nsRuleNode.cpp.mine
Index: dom/public/idl/css/nsIDOMCSS2Properties.idl
===================================================================
RCS file: /cvsroot/mozilla/dom/public/idl/css/nsIDOMCSS2Properties.idl,v
retrieving revision 1.28
diff -u -8 -p -r1.28 nsIDOMCSS2Properties.idl
--- dom/public/idl/css/nsIDOMCSS2Properties.idl	16 May 2007 15:51:38 -0000	1.28
+++ dom/public/idl/css/nsIDOMCSS2Properties.idl	6 Jun 2007 20:13:47 -0000
@@ -401,17 +401,17 @@ interface nsIDOMCSS2Properties : nsISupp
 
            attribute DOMString        wordSpacing;
                                         // raises(DOMException) on setting
 
            attribute DOMString        zIndex;
                                         // raises(DOMException) on setting
 };
 
-[scriptable, uuid(8c2e3658-1fe4-452a-92be-b0afaf76f897)]
+[scriptable, uuid(b5659318-4db3-463f-931e-5baf4f9850f5)]
 interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
 {
            /* Non-DOM 2 extensions */
 
            /* Mozilla extension CSS properties */
            attribute DOMString        MozAppearance;
                                         // raises(DOMException) on setting
 
@@ -546,16 +546,19 @@ interface nsIDOMNSCSS2Properties : nsIDO
 
            attribute DOMString        MozUserModify;
                                         // raises(DOMException) on setting
 
            attribute DOMString        MozUserSelect;
                                         // raises(DOMException) on setting
 
            /* CSS3 properties */
+           attribute DOMString        borderImage;
+                                        // raises(DOMException) on setting
+
            attribute DOMString        opacity;
                                         // raises(DOMException) on setting
 
            attribute DOMString        outlineOffset;
                                         // raises(DOMException) on setting
 
            /* Mozilla extensions */
            attribute DOMString        overflowX;
Index: layout/base/nsCSSRendering.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/base/nsCSSRendering.cpp,v
retrieving revision 3.318
diff -u -8 -p -r3.318 nsCSSRendering.cpp
--- layout/base/nsCSSRendering.cpp	30 May 2007 08:37:30 -0000	3.318
+++ layout/base/nsCSSRendering.cpp	6 Jun 2007 20:13:50 -0000
@@ -2566,17 +2566,17 @@ nsCSSRendering::PaintBorder(nsPresContex
 {
   nsMargin            border;
   nsStyleCoord        bordStyleRadius[4];
   PRInt32             twipsRadii[4];
   float               percent;
   nsCompatibility     compatMode = aPresContext->CompatibilityMode();
 
   SN("++ PaintBorder");
-
+  
   // Check to see if we have an appearance defined.  If so, we let the theme
   // renderer draw the border.  DO not get the data from aForFrame, since the passed in style context
   // may be different!  Always use |aStyleContext|!
   const nsStyleDisplay* displayData = aStyleContext->GetStyleDisplay();
   if (displayData->mAppearance) {
     nsITheme *theme = aPresContext->GetTheme();
     if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame, displayData->mAppearance))
       return; // Let the theme handle it.
@@ -2584,22 +2584,23 @@ nsCSSRendering::PaintBorder(nsPresContex
 
   // Get our style context's color struct.
   const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
 
   // in NavQuirks mode we want to use the parent's context as a starting point
   // for determining the background color
   const nsStyleBackground* bgColor = nsCSSRendering::FindNonTransparentBackground
     (aStyleContext, compatMode == eCompatibility_NavQuirks ? PR_TRUE : PR_FALSE);
-
+if(aBorderStyle.mBorderImage)printf("aHardBorderSize = %d\n", aHardBorderSize);
   if (aHardBorderSize > 0) {
     border.SizeTo(aHardBorderSize, aHardBorderSize, aHardBorderSize, aHardBorderSize);
   } else {
     border = aBorderStyle.GetBorder();
   }
+if(aBorderStyle.mBorderImage)printf("border: %d %d %d %d\n", border.top, border.right, border.bottom, border.left);
 
   if ((0 == border.left) && (0 == border.right) &&
       (0 == border.top) && (0 == border.bottom)) {
     // Empty border area
     return;
   }
 
   // get the radius for our border
@@ -2770,16 +2771,192 @@ nsCSSRendering::PaintBorder(nsPresContex
               compositeColors,
               aSkipSides,
               bgColor->mBackgroundColor,
               twipsPerPixel,
               aGap);
 
   ctx->Restore();
 
+  PRBool renderBorderImage = PR_FALSE;
+  if(aBorderStyle.mBorderImage) {
+    //border = aBorderStyle.mBorderImageWidth;
+    printf("PaintBorder(): x %d y %d width %d height %d\n", aBorderArea.x, aBorderArea.y, aBorderArea.width, aBorderArea.height);
+    printf("PaintBorder(): outerRect: pos %dx%d, size %dx%d\n", outerRect.x, outerRect.x, outerRect.width, outerRect.height);
+    printf("PaintBorder(): oRect: pos %fx%f, size %fx%f\n", oRect.pos.x, oRect.pos.x, oRect.size.width, oRect.size.height);
+    printf("PaintBorder(): innerRect: pos %dx%d, size %dx%d\n", innerRect.x, innerRect.x, innerRect.width, innerRect.height);
+    printf("PaintBorder(): iRect: pos %fx%f, size %fx%f\n", iRect.pos.x, iRect.pos.x, iRect.size.width, iRect.size.height);
+    nsStyleCoord borderImageSplit[4];
+    PRInt32 borderImageSplitInt[4];
+    aBorderStyle.mBorderImageSplit.GetTop(borderImageSplit[0]);
+    aBorderStyle.mBorderImageSplit.GetRight(borderImageSplit[1]);
+    aBorderStyle.mBorderImageSplit.GetBottom(borderImageSplit[2]);
+    aBorderStyle.mBorderImageSplit.GetLeft(borderImageSplit[3]);
+    
+    imgIRequest *req = aPresContext->LoadImage(aBorderStyle.mBorderImage,
+                                               aForFrame);
+    
+    PRUint32 status = imgIRequest::STATUS_ERROR;
+    if (req)
+      req->GetImageStatus(&status);
+    
+    nsCOMPtr<imgIContainer> image;
+    req->GetImage(getter_AddRefs(image));
+    
+    nsSize imageSize;
+    image->GetWidth(&imageSize.width);
+    image->GetHeight(&imageSize.height);
+    imageSize.width = nsPresContext::CSSPixelsToAppUnits(imageSize.width);
+    imageSize.height = nsPresContext::CSSPixelsToAppUnits(imageSize.height);
+    printf("PaintBorder(): image size %d %d\n", imageSize.width, imageSize.height);
+    if (req && (status & imgIRequest::STATUS_FRAME_COMPLETE || status & imgIRequest::STATUS_SIZE_AVAILABLE)) {
+      renderBorderImage = PR_TRUE;
+      // convert percentage values
+      for(int side = 0; side < 4; side++) {
+        borderImageSplitInt[side] = 0;
+
+        switch (borderImageSplit[side].GetUnit()) {
+          case eStyleUnit_Percent:
+            percent = borderImageSplit[side].GetPercentValue();
+            if (side == 0 || side == 2)
+              borderImageSplitInt[side] = (nscoord)(percent * imageSize.height);
+            else
+              borderImageSplitInt[side] = (nscoord)(percent * imageSize.width);
+            break;
+
+          case eStyleUnit_Integer:
+            borderImageSplitInt[side] = nsPresContext::CSSPixelsToAppUnits(borderImageSplit[side].GetIntValue());
+            break;
+
+          default:
+            break;
+        }
+        printf("PaintBorder(): split %d: %d\n", side, borderImageSplitInt[side]);
+      }
+      
+      nsRect rectToDraw;
+      nsRect rectToDrawSource;
+      
+      printf("keywords: %d %d\n", aBorderStyle.mBorderHorisontalFill, aBorderStyle.mBorderVerticalFill); 
+      
+      // draw top left corner
+      rectToDraw = outerRect;
+      rectToDraw.width = border.left;
+      rectToDraw.height = border.top;
+      rectToDrawSource.x = 0;
+      rectToDrawSource.y = 0;
+      rectToDrawSource.width = borderImageSplitInt[3];
+      rectToDrawSource.height = borderImageSplitInt[0];
+      nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      
+      // draw top
+      rectToDraw = outerRect;
+      rectToDraw.x += border.left;
+      rectToDraw.width -= (border.left + border.right);
+      rectToDraw.height = border.top;
+      rectToDrawSource.x = borderImageSplitInt[3];
+      rectToDrawSource.y = 0;
+      rectToDrawSource.width = imageSize.width - borderImageSplitInt[3] - borderImageSplitInt[1];
+      rectToDrawSource.height = borderImageSplitInt[0];
+      if (aBorderStyle.mBorderHorisontalFill == NS_STYLE_BORDER_IMAGE_STRETCH) {
+        nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      } else {
+        printf("horisontal not stretch, ignoring\n");
+      }
+      
+      // draw top right corner
+      rectToDraw = outerRect;
+      rectToDraw.x += outerRect.width - border.right;
+      rectToDraw.width = border.right;
+      rectToDraw.height = border.top;
+      rectToDrawSource.x = imageSize.width - borderImageSplitInt[1];
+      rectToDrawSource.y = 0;
+      rectToDrawSource.width = borderImageSplitInt[1];
+      rectToDrawSource.height = borderImageSplitInt[0];
+      nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      
+      // draw right
+      rectToDraw = outerRect;
+      rectToDraw.x += outerRect.width - border.right;
+      rectToDraw.y += border.top;
+      rectToDraw.width = border.right;
+      rectToDraw.height -= (border.top + border.bottom);
+      rectToDrawSource.x = imageSize.width - borderImageSplitInt[1];
+      rectToDrawSource.y = borderImageSplitInt[0];
+      rectToDrawSource.width = borderImageSplitInt[1];
+      rectToDrawSource.height = imageSize.height - borderImageSplitInt[0] - borderImageSplitInt[2];
+      if (aBorderStyle.mBorderVerticalFill == NS_STYLE_BORDER_IMAGE_STRETCH) {
+        nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      } else {
+        printf("horisontal not stretch, ignoring\n");
+      }
+      
+      // draw bottom right corner
+      rectToDraw = outerRect;
+      rectToDraw.x += outerRect.width - border.right;
+      rectToDraw.y += outerRect.height - border.bottom;
+      rectToDraw.width = border.right;
+      rectToDraw.height = border.bottom;
+      rectToDrawSource.x = imageSize.width - borderImageSplitInt[1];
+      rectToDrawSource.y = imageSize.height - borderImageSplitInt[2];
+      rectToDrawSource.width = borderImageSplitInt[1];
+      rectToDrawSource.height = borderImageSplitInt[2];
+      nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      
+      // draw bottom
+      rectToDraw = outerRect;
+      rectToDraw.x += border.left;
+      rectToDraw.y += outerRect.height - border.top;
+      rectToDraw.width -= (border.left + border.right);
+      rectToDraw.height = border.bottom;
+      rectToDrawSource.x = borderImageSplitInt[3];
+      rectToDrawSource.y = imageSize.height - borderImageSplitInt[2];
+      rectToDrawSource.width = imageSize.width - borderImageSplitInt[3] - borderImageSplitInt[1];
+      rectToDrawSource.height = borderImageSplitInt[2];
+      if (aBorderStyle.mBorderHorisontalFill == NS_STYLE_BORDER_IMAGE_STRETCH) {
+        nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      } else {
+        printf("horisontal not stretch, ignoring\n");
+      }
+      
+      // draw bottom left corner
+      rectToDraw = outerRect;
+      rectToDraw.y += outerRect.height - border.bottom;
+      rectToDraw.width = border.left;
+      rectToDraw.height = border.bottom;
+      rectToDrawSource.x = 0;
+      rectToDrawSource.y = imageSize.height - borderImageSplitInt[2];
+      rectToDrawSource.width = borderImageSplitInt[3];
+      rectToDrawSource.height = borderImageSplitInt[2];
+      nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      
+      // draw left
+      rectToDraw = outerRect;
+      rectToDraw.y += border.top;
+      rectToDraw.width = border.left;
+      rectToDraw.height -= (border.top + border.bottom);
+      rectToDrawSource.x = 0;
+      rectToDrawSource.y = borderImageSplitInt[0];
+      rectToDrawSource.width = borderImageSplitInt[3];
+      rectToDrawSource.height = imageSize.height - borderImageSplitInt[0] - borderImageSplitInt[2];
+      if (aBorderStyle.mBorderVerticalFill == NS_STYLE_BORDER_IMAGE_STRETCH) {
+        nsLayoutUtils::DrawImage(&aRenderingContext, image, rectToDraw, rectToDraw, &rectToDrawSource);
+      } else {
+        printf("horisontal not stretch, ignoring\n");
+      }
+      
+      //~ ctx->Save();
+      //~ ctx->Rectangle(topLeftCorner);
+      //~ ctx->SetColor(gfxRGBA(1.0, 0.0, 0.0, 0.5));
+      //~ ctx->Fill();
+      //~ ctx->Restore();
+    }
+    req = nsnull;
+  }
+  
   SN();
 }
 
 void
 nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
                              nsIRenderingContext& aRenderingContext,
                              nsIFrame* aForFrame,
                              const nsRect& aDirtyRect,
Index: layout/base/nsStyleConsts.h
===================================================================
RCS file: /cvsroot/mozilla/layout/base/nsStyleConsts.h,v
retrieving revision 3.100
diff -u -8 -p -r3.100 nsStyleConsts.h
--- layout/base/nsStyleConsts.h	16 May 2007 15:51:38 -0000	3.100
+++ layout/base/nsStyleConsts.h	6 Jun 2007 20:13:50 -0000
@@ -265,16 +265,21 @@
 #define NS_STYLE_BORDER_STYLE_INSET             7
 #define NS_STYLE_BORDER_STYLE_OUTSET            8
 #define NS_STYLE_BORDER_STYLE_HIDDEN            9
 #define NS_STYLE_BORDER_STYLE_AUTO              10 // for outline-style only
 // a bit ORed onto the style for table border collapsing indicating that the style was 
 // derived from a table with its rules attribute set
 #define NS_STYLE_BORDER_STYLE_RULES_MARKER      0x10  
 
+// See nsStyleBorder mBorderImage
+#define NS_STYLE_BORDER_IMAGE_STRETCH           0
+#define NS_STYLE_BORDER_IMAGE_REPEAT            1
+#define NS_STYLE_BORDER_IMAGE_ROUND             2
+
 // See nsStyleDisplay
 #define NS_STYLE_CLEAR_NONE                     0
 #define NS_STYLE_CLEAR_LEFT                     1
 #define NS_STYLE_CLEAR_RIGHT                    2
 #define NS_STYLE_CLEAR_LEFT_AND_RIGHT           3
 #define NS_STYLE_CLEAR_LINE                     4
 #define NS_STYLE_CLEAR_BLOCK                    5
 #define NS_STYLE_CLEAR_COLUMN                   6
Index: layout/style/nsCSSDataBlock.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSDataBlock.cpp,v
retrieving revision 1.30
diff -u -8 -p -r1.30 nsCSSDataBlock.cpp
--- layout/style/nsCSSDataBlock.cpp	18 May 2007 06:02:57 -0000	1.30
+++ layout/style/nsCSSDataBlock.cpp	6 Jun 2007 20:13:54 -0000
@@ -202,21 +202,31 @@ nsCSSCompressedDataBlock::MapRuleInfoInt
             void *prop =
                 nsCSSExpandedDataBlock::RuleDataPropertyAt(aRuleData, iProp);
             switch (nsCSSProps::kTypeTable[iProp]) {
                 case eCSSType_Value: {
                     nsCSSValue* target = NS_STATIC_CAST(nsCSSValue*, prop);
                     if (target->GetUnit() == eCSSUnit_Null) {
                         const nsCSSValue *val = ValueAtCursor(cursor);
                         NS_ASSERTION(val->GetUnit() != eCSSUnit_Null, "oops");
+                        if (iProp == eCSSProperty_border_image){
+                          printf("!!!BORDER-IMAGE!!!, unit %d\n", val->GetUnit());
+                          //exit(0);
+                        }
                         if ((iProp == eCSSProperty_background_image ||
                              iProp == eCSSProperty_list_style_image) &&
                             val->GetUnit() == eCSSUnit_URL) {
                             val->StartImageLoad(aRuleData->mPresContext->Document(),
                                                 iProp == eCSSProperty_background_image);
+                        } else if (iProp == eCSSProperty_border_image) {
+                            nsCSSValue::Array *array = val->GetArrayValue();
+                            if (array->Item(0).GetUnit() == eCSSUnit_URL) {
+                                array->Item(0).StartImageLoad(aRuleData->mPresContext->Document(), 
+                                                              PR_FALSE);
+                            }
                         }
                         *target = *val;
                         if (iProp == eCSSProperty_font_family) {
                             // XXX Are there other things like this?
                             aRuleData->mFontData->mFamilyFromHTML = PR_FALSE;
                         }
                         else if (iProp == eCSSProperty_color ||
                                  iProp == eCSSProperty_background_color ||
Index: layout/style/nsCSSParser.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSParser.cpp,v
retrieving revision 3.358
diff -u -8 -p -r3.358 nsCSSParser.cpp
--- layout/style/nsCSSParser.cpp	3 Jun 2007 21:15:45 -0000	3.358
+++ layout/style/nsCSSParser.cpp	6 Jun 2007 20:13:55 -0000
@@ -314,16 +314,17 @@ protected:
   PRBool ParseAzimuth(nsresult& aErrorCode, nsCSSValue& aValue);
   PRBool ParseBackground(nsresult& aErrorCode);
   PRBool ParseBackgroundPosition(nsresult& aErrorCode);
   PRBool ParseBackgroundPositionValues(nsresult& aErrorCode);
   PRBool ParseBorderColor(nsresult& aErrorCode);
   PRBool ParseBorderColors(nsresult& aErrorCode,
                            nsCSSValueList** aResult,
                            nsCSSProperty aProperty);
+  PRBool ParseBorderImage(nsresult& aErrorCode);
   PRBool ParseBorderSpacing(nsresult& aErrorCode);
   PRBool ParseBorderSide(nsresult& aErrorCode,
                          const nsCSSProperty aPropIDs[],
                          PRBool aSetAllSides);
   PRBool ParseBorderStyle(nsresult& aErrorCode);
   PRBool ParseBorderWidth(nsresult& aErrorCode);
   PRBool ParseBorderRadius(nsresult& aErrorCode);
   PRBool ParseOutlineRadius(nsresult& aErrorCode);
@@ -4272,16 +4273,18 @@ PRBool CSSParserImpl::ParseProperty(nsre
   case eCSSProperty_border_right_colors:
     return ParseBorderColors(aErrorCode,
                              &mTempData.mMargin.mBorderColors.mRight,
                              aPropID);
   case eCSSProperty_border_top_colors:
     return ParseBorderColors(aErrorCode,
                              &mTempData.mMargin.mBorderColors.mTop,
                              aPropID);
+  case eCSSProperty_border_image:
+    return ParseBorderImage(aErrorCode);
   case eCSSProperty_border_width:
     return ParseBorderWidth(aErrorCode);
   case eCSSProperty__moz_border_radius:
     return ParseBorderRadius(aErrorCode);
   case eCSSProperty__moz_outline_radius:
     return ParseOutlineRadius(aErrorCode);
   case eCSSProperty_clip:
     return ParseRect(mTempData.mDisplay.mClip, aErrorCode,
@@ -4410,16 +4413,17 @@ PRBool CSSParserImpl::ParseSingleValuePr
 {
   switch (aPropID) {
   case eCSSProperty_UNKNOWN:
   case eCSSProperty_background:
   case eCSSProperty_background_position:
   case eCSSProperty_border:
   case eCSSProperty_border_color:
   case eCSSProperty_border_bottom_colors:
+  case eCSSProperty_border_image:
   case eCSSProperty_border_left_colors:
   case eCSSProperty_border_right_colors:
   case eCSSProperty_border_top_colors:
   case eCSSProperty_border_spacing:
   case eCSSProperty_border_style:
   case eCSSProperty_border_bottom:
   case eCSSProperty_border_left:
   case eCSSProperty_border_right:
@@ -5056,16 +5060,121 @@ PRBool CSSParserImpl::ParseBackgroundPos
 {
   if (!ParseBackgroundPositionValues(aErrorCode) ||
       !ExpectEndProperty(aErrorCode, PR_TRUE)) 
     return PR_FALSE;
   mTempData.SetPropertyBit(eCSSProperty_background_position);
   return PR_TRUE;
 }
 
+//!! i have no idea what's supposed to inherit from where and what isn't
+PRBool CSSParserImpl::ParseBorderImage(nsresult& aErrorCode)
+{
+  printf("CSSParserImpl::ParseBorderImage()\n");fflush(NULL);
+  
+  // <uri> [<number> | <percentage>]{4} [ / <border-width>{1,4} ]? [stretch | repeat | round]{0,2}
+  nsRefPtr<nsCSSValue::Array> val = nsCSSValue::Array::Create(11);
+  if (!val) {
+    aErrorCode = NS_ERROR_OUT_OF_MEMORY;
+    return PR_FALSE;
+  }
+  
+  nsCSSValue &valueURL = val->Item(0);
+  nsCSSValue &splitTop = val->Item(1);
+  nsCSSValue &splitRight = val->Item(2);
+  nsCSSValue &splitBottom = val->Item(3);
+  nsCSSValue &splitLeft = val->Item(4);
+  nsCSSValue &borderWidthTop = val->Item(5);
+  nsCSSValue &borderWidthRight = val->Item(6);
+  nsCSSValue &borderWidthBottom = val->Item(7);
+  nsCSSValue &borderWidthLeft = val->Item(8);
+  nsCSSValue &horisontalKeyword = val->Item(9);
+  nsCSSValue &verticalKeyword = val->Item(10);
+  
+  if (ParseVariant(aErrorCode, valueURL, VARIANT_NONE, nsnull)) {
+    printf("CSSParserImpl::ParseBorderImage(): none\n");
+    return PR_TRUE;
+  }
+  
+  // <uri>
+  if (!ParseVariant(aErrorCode, valueURL, VARIANT_URL, nsnull)) {
+    return PR_FALSE;
+  }
+  printf("CSSParserImpl::ParseBorderImage(): url\n");
+  printf("CSSParserImpl::ParseBorderImage(): unit %d\n", valueURL.GetUnit());
+  
+  // [<number> | <percentage>]{4}
+  if (ParsePositiveVariant(aErrorCode, splitTop, VARIANT_INTEGER | VARIANT_PERCENT, nsnull)) {
+    if (!ParsePositiveVariant(aErrorCode, splitRight, VARIANT_INTEGER | VARIANT_PERCENT, nsnull) ||
+        !ParsePositiveVariant(aErrorCode, splitBottom, VARIANT_INTEGER | VARIANT_PERCENT, nsnull) ||
+        !ParsePositiveVariant(aErrorCode, splitLeft, VARIANT_INTEGER | VARIANT_PERCENT, nsnull)) {
+      return PR_FALSE;
+    }
+    printf("CSSParserImpl::ParseBorderImage(): four numbers: ");
+    printf("unit %d %d %d %d, ", splitTop.GetUnit(),
+                                 splitRight.GetUnit(),
+                                 splitBottom.GetUnit(),
+                                 splitLeft.GetUnit());
+    printf("value %d %d %d %d\n", splitTop.GetIntValue(),
+                                      splitRight.GetIntValue(),
+                                      splitBottom.GetIntValue(),
+                                      splitLeft.GetIntValue());
+  }
+  
+  // [ / <border-width>{1,4} ]?
+  if (ExpectSymbol(aErrorCode, '/', PR_TRUE)) {
+    printf("CSSParserImpl::ParseBorderImage(): /: ");
+    if (!ParsePositiveVariant(aErrorCode, borderWidthTop, VARIANT_HKL, nsnull)) {
+      return PR_FALSE;
+    }
+    
+    //!! don't parse keywords
+    //!! 1 to 4 not 1 or 4
+    //!! i think it crashes here if have less than 4 widths and followed by a keyboard
+    if (ParsePositiveVariant(aErrorCode, borderWidthRight, VARIANT_HKL, nsnull)) {
+      if (!ParsePositiveVariant(aErrorCode, borderWidthBottom, VARIANT_HKL, nsnull) ||
+          !ParsePositiveVariant(aErrorCode, borderWidthLeft, VARIANT_HKL, nsnull)) {
+        return PR_FALSE;
+      }
+    } else {printf("only one width: ");
+      borderWidthRight = borderWidthBottom = borderWidthLeft = borderWidthTop;
+    }printf("unit %d %d %d %d, ", borderWidthTop.GetUnit(),
+                                  borderWidthRight.GetUnit(),
+                                  borderWidthBottom.GetUnit(),
+                                  borderWidthLeft.GetUnit());
+    printf("value %f %f %f %f\n", borderWidthTop.GetFloatValue(),
+                                  borderWidthRight.GetFloatValue(),
+                                  borderWidthBottom.GetFloatValue(),
+                                  borderWidthLeft.GetFloatValue());
+    mTempData.mMargin.mBorderWidth.mTop = borderWidthTop;
+    mTempData.mMargin.mBorderWidth.mRight = borderWidthRight;
+    mTempData.mMargin.mBorderWidth.mBottom = borderWidthBottom;
+    mTempData.mMargin.mBorderWidth.mLeft = borderWidthLeft;
+    //?? check inherit?? see nsCSSParser.cpp:4192
+  }
+  
+  // [stretch | repeat | round]{0,2}
+  if (ParseEnum(aErrorCode, horisontalKeyword, nsCSSProps::kBorderImageKTable)) {
+    printf("CSSParserImpl::ParseBorderImage(): 1 keyword\n");
+    if (ParseEnum(aErrorCode, verticalKeyword, nsCSSProps::kBorderImageKTable)) {
+      printf("CSSParserImpl::ParseBorderImage(): 2 keywords\n");
+    }
+  }
+  
+  if (!ExpectEndProperty(aErrorCode, PR_TRUE)) {
+    return PR_FALSE;
+  }  
+  
+  //mTempData.SetPropertyBit(eCSSProperty_border_image);
+  
+  mTempData.mMargin.mBorderImage.SetArrayValue(val, eCSSUnit_Array);
+  printf("CSSParserImpl::ParseBorderImage(): return ok\n");
+  return PR_TRUE;
+}
+
 PRBool CSSParserImpl::ParseBackgroundPositionValues(nsresult& aErrorCode)
 {
   // First try a percentage or a length value
   nsCSSValue &xValue = mTempData.mColor.mBackPosition.mXValue,
              &yValue = mTempData.mColor.mBackPosition.mYValue;
   if (ParseVariant(aErrorCode, xValue, VARIANT_HLP, nsnull)) {
     if (eCSSUnit_Inherit == xValue.GetUnit() ||
         eCSSUnit_Initial == xValue.GetUnit()) {  // both are inherited or both are set to initial
Index: layout/style/nsCSSPropList.h
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSPropList.h,v
retrieving revision 3.77
diff -u -8 -p -r3.77 nsCSSPropList.h
--- layout/style/nsCSSPropList.h	16 May 2007 15:51:38 -0000	3.77
+++ layout/style/nsCSSPropList.h	6 Jun 2007 20:13:55 -0000
@@ -283,16 +283,17 @@ CSS_PROP_DISPLAY(-moz-binding, binding, 
 CSS_PROP_SHORTHAND(border, border, Border)
 CSS_PROP_SHORTHAND(border-bottom, border_bottom, BorderBottom)
 CSS_PROP_BORDER(border-bottom-color, border_bottom_color, BorderBottomColor, Margin, mBorderColor.mBottom, eCSSType_Value, kBorderColorKTable)
 CSS_PROP_BORDER(-moz-border-bottom-colors, border_bottom_colors, MozBorderBottomColors, Margin, mBorderColors.mBottom, eCSSType_ValueList, nsnull)
 CSS_PROP_BORDER(border-bottom-style, border_bottom_style, BorderBottomStyle, Margin, mBorderStyle.mBottom, eCSSType_Value, kBorderStyleKTable)  // on/off will need reflow
 CSS_PROP_BORDER(border-bottom-width, border_bottom_width, BorderBottomWidth, Margin, mBorderWidth.mBottom, eCSSType_Value, kBorderWidthKTable)
 CSS_PROP_TABLEBORDER(border-collapse, border_collapse, BorderCollapse, Table, mBorderCollapse, eCSSType_Value, kBorderCollapseKTable)
 CSS_PROP_SHORTHAND(border-color, border_color, BorderColor)
+CSS_PROP_BORDER(border-image, border_image, BorderImage, Margin, mBorderImage, eCSSType_Value, kBorderImageKTable)
 CSS_PROP_SHORTHAND(border-left, border_left, BorderLeft)
 CSS_PROP_BORDER(border-left-color, border_left_color, BorderLeftColor, Margin, mBorderColor.mLeft, eCSSType_Value, kBorderColorKTable)
 CSS_PROP_BORDER(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, Margin, mBorderColors.mLeft, eCSSType_ValueList, nsnull)
 CSS_PROP_BORDER(border-left-style, border_left_style, BorderLeftStyle, Margin, mBorderStyle.mLeft, eCSSType_Value, kBorderStyleKTable)  // on/off will need reflow
 CSS_PROP_BORDER(border-left-width, border_left_width, BorderLeftWidth, Margin, mBorderWidth.mLeft, eCSSType_Value, kBorderWidthKTable)
 CSS_PROP_SHORTHAND(border-right, border_right, BorderRight)
 CSS_PROP_BORDER(border-right-color, border_right_color, BorderRightColor, Margin, mBorderColor.mRight, eCSSType_Value, kBorderColorKTable)
 CSS_PROP_BORDER(-moz-border-right-colors, border_right_colors, MozBorderRightColors, Margin, mBorderColors.mRight, eCSSType_ValueList, nsnull)
Index: layout/style/nsCSSProps.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSProps.cpp,v
retrieving revision 3.150
diff -u -8 -p -r3.150 nsCSSProps.cpp
--- layout/style/nsCSSProps.cpp	16 May 2007 15:51:38 -0000	3.150
+++ layout/style/nsCSSProps.cpp	6 Jun 2007 20:13:56 -0000
@@ -333,16 +333,23 @@ const PRInt32 nsCSSProps::kBorderCollaps
 };
 
 const PRInt32 nsCSSProps::kBorderColorKTable[] = {
   eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT,
   eCSSKeyword__moz_use_text_color, NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR,
   eCSSKeyword_UNKNOWN,-1
 };
 
+const PRInt32 nsCSSProps::kBorderImageKTable[] = {
+  eCSSKeyword_stretch, NS_STYLE_BORDER_IMAGE_STRETCH,
+  eCSSKeyword_repeat, NS_STYLE_BORDER_IMAGE_REPEAT,
+  eCSSKeyword_round, NS_STYLE_BORDER_IMAGE_ROUND,
+  eCSSKeyword_UNKNOWN,-1
+};
+
 const PRInt32 nsCSSProps::kBorderStyleKTable[] = {
   eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN,
   eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED,
   eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED,
   eCSSKeyword_solid,  NS_STYLE_BORDER_STYLE_SOLID,
   eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE,
   eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE,
   eCSSKeyword_ridge,  NS_STYLE_BORDER_STYLE_RIDGE,
Index: layout/style/nsCSSProps.h
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSProps.h,v
retrieving revision 3.45
diff -u -8 -p -r3.45 nsCSSProps.h
--- layout/style/nsCSSProps.h	16 May 2007 15:51:38 -0000	3.45
+++ layout/style/nsCSSProps.h	6 Jun 2007 20:13:56 -0000
@@ -117,16 +117,17 @@ public:
   static const PRInt32 kBackgroundClipKTable[];
   static const PRInt32 kBackgroundColorKTable[];
   static const PRInt32 kBackgroundInlinePolicyKTable[];
   static const PRInt32 kBackgroundOriginKTable[];
   static const PRInt32 kBackgroundPositionKTable[];
   static const PRInt32 kBackgroundRepeatKTable[];
   static const PRInt32 kBorderCollapseKTable[];
   static const PRInt32 kBorderColorKTable[];
+  static const PRInt32 kBorderImageKTable[];
   static const PRInt32 kBorderStyleKTable[];
   static const PRInt32 kBorderWidthKTable[];
   static const PRInt32 kBoxAlignKTable[];
   static const PRInt32 kBoxDirectionKTable[];
   static const PRInt32 kBoxOrientKTable[];
   static const PRInt32 kBoxPackKTable[];
 #ifdef MOZ_SVG
   static const PRInt32 kDominantBaselineKTable[];
Index: layout/style/nsCSSStruct.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSStruct.cpp,v
retrieving revision 3.154
diff -u -8 -p -r3.154 nsCSSStruct.cpp
--- layout/style/nsCSSStruct.cpp	16 May 2007 15:51:38 -0000	3.154
+++ layout/style/nsCSSStruct.cpp	6 Jun 2007 20:13:56 -0000
@@ -316,17 +316,18 @@ nsCSSMargin::nsCSSMargin(const nsCSSMarg
     mBorderColors(aCopy.mBorderColors),
     mBorderStyle(aCopy.mBorderStyle),
     mBorderRadius(aCopy.mBorderRadius),
     mOutlineWidth(aCopy.mOutlineWidth),
     mOutlineColor(aCopy.mOutlineColor),
     mOutlineStyle(aCopy.mOutlineStyle),
     mOutlineOffset(aCopy.mOutlineOffset),
     mOutlineRadius(aCopy.mOutlineRadius),
-    mFloatEdge(aCopy.mFloatEdge)
+    mFloatEdge(aCopy.mFloatEdge),
+    mBorderImage(aCopy.mBorderImage)
 {
   MOZ_COUNT_CTOR(nsCSSMargin);
 }
 
 nsCSSMargin::~nsCSSMargin(void)
 {
   MOZ_COUNT_DTOR(nsCSSMargin);
 }
Index: layout/style/nsCSSStruct.h
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsCSSStruct.h,v
retrieving revision 3.54
diff -u -8 -p -r3.54 nsCSSStruct.h
--- layout/style/nsCSSStruct.h	16 May 2007 15:51:38 -0000	3.54
+++ layout/style/nsCSSStruct.h	6 Jun 2007 20:13:56 -0000
@@ -308,16 +308,17 @@ struct nsCSSMargin : public nsCSSStruct 
   nsCSSRect   mBorderStyle;
   nsCSSRect   mBorderRadius;  // (extension)
   nsCSSValue  mOutlineWidth;
   nsCSSValue  mOutlineColor;
   nsCSSValue  mOutlineStyle;
   nsCSSValue  mOutlineOffset;
   nsCSSRect   mOutlineRadius; // (extension)
   nsCSSValue  mFloatEdge; // NEW
+  nsCSSValue  mBorderImage;
 };
 
 struct nsRuleDataMargin : public nsCSSMargin {
 };
 
 struct nsCSSPosition : public nsCSSStruct  {
   nsCSSPosition(void);
   nsCSSPosition(const nsCSSPosition& aCopy);
Index: layout/style/nsRuleNode.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsRuleNode.cpp,v
retrieving revision 1.205
diff -u -8 -p -r1.205 nsRuleNode.cpp
--- layout/style/nsRuleNode.cpp	23 May 2007 05:55:03 -0000	1.205
+++ layout/style/nsRuleNode.cpp	6 Jun 2007 20:13:56 -0000
@@ -3306,17 +3306,88 @@ nsRuleNode::ComputeBorderData(nsStyleStr
         border->SetBorderWidth(side, parentBorder->GetBorderWidth(side));
       }
       else if (eCSSUnit_Initial == value.GetUnit()) {
         border->SetBorderWidth(side,
           (mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]);
       }
     }
   }
-
+  
+  // border-image
+  if (eCSSUnit_Array == marginData.mBorderImage.GetUnit()) {
+    // this is here so nsCSSRendering::PaintBorder() is called, i don't know
+    // what it does exactly. defined in nsStyleStruct.h:195
+    // also?
+    border->SetBorderStyle(0, BORDER_COLOR_FOREGROUND);
+    border->SetBorderStyle(1, BORDER_COLOR_FOREGROUND);
+    border->SetBorderStyle(2, BORDER_COLOR_FOREGROUND);
+    border->SetBorderStyle(3, BORDER_COLOR_FOREGROUND);
+    //~ border->SetBorderStyle(0, NS_STYLE_BORDER_STYLE_SOLID);
+    //~ border->SetBorderStyle(1, NS_STYLE_BORDER_STYLE_SOLID);
+    //~ border->SetBorderStyle(2, NS_STYLE_BORDER_STYLE_SOLID);
+    //~ border->SetBorderStyle(3, NS_STYLE_BORDER_STYLE_SOLID);
+    // the image itself
+    nsCSSValue::Array *arr = marginData.mBorderImage.GetArrayValue();
+    
+    border->mBorderImage = arr->Item(0).GetImageValue();
+    printf("ComputeBorderData() set mBorderImage to something\n");
+    
+    // the numbers saying where to split the image
+    if (eCSSUnit_Null == arr->Item(1).GetUnit()) {
+      // use 1/3 for each side
+      ;
+    } else {
+      for (PRInt32 side = 0; side < 4; side++) {
+        if (SetCoord(arr->Item(side + 1), coord, parentCoord, SETCOORD_INTEGER | SETCOORD_PERCENT, 
+                     aContext, mPresContext, inherited)) {
+          if (coord.GetUnit() == eStyleUnit_Integer ||
+              coord.GetUnit() == eStyleUnit_Percent) {
+            border->mBorderImageSplit.Set(side, coord);
+          }
+        }
+      }
+      // make sure the values will fit in the image
+    }
+    
+    // possible replacement for border-width
+    if (eCSSUnit_Null == arr->Item(5).GetUnit()) {
+      // copy from border-width
+      ;
+    } else {
+      for (PRInt32 side = 0; side < 4; side++) {
+        if (SetCoord(arr->Item(side + 5), coord, parentCoord, SETCOORD_LENGTH, 
+                     aContext, mPresContext, inherited)) {
+          if (coord.GetUnit() == eStyleUnit_Coord) {
+            border->mBorderImageWidth.side(side) = coord.GetCoordValue();
+            border->SetBorderWidth(side, coord.GetCoordValue());
+          }
+        }
+      }
+    }
+    
+    // stretch/round/repeat keywords
+    if (eCSSUnit_Null == arr->Item(9).GetUnit()) {
+      // both horisontal and vertical are stretch
+      border->mBorderHorisontalFill = NS_STYLE_BORDER_IMAGE_STRETCH;
+      border->mBorderVerticalFill = NS_STYLE_BORDER_IMAGE_STRETCH;
+    } else {
+      // have horisontal value
+      border->mBorderHorisontalFill = arr->Item(9).GetIntValue();
+      if (eCSSUnit_Null == arr->Item(10).GetUnit()) {
+        // vertical same as horisontal
+        border->mBorderVerticalFill = border->mBorderHorisontalFill;
+      } else {
+        // have vertcal value
+        border->mBorderVerticalFill = arr->Item(10).GetIntValue();
+      }
+    }
+    
+  } // border-image
+  
   // border-style, border-*-style: enum, none, inherit
   const nsCSSRect& ourStyle = marginData.mBorderStyle;
   { // scope for compilers with broken |for| loop scoping
     NS_FOR_CSS_SIDES(side) {
       const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
       nsCSSUnit unit = value.GetUnit();
       if (eCSSUnit_Enumerated == unit) {
         border->SetBorderStyle(side, value.GetIntValue());
Index: layout/style/nsStyleStruct.h
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsStyleStruct.h,v
retrieving revision 3.116
diff -u -8 -p -r3.116 nsStyleStruct.h
--- layout/style/nsStyleStruct.h	16 May 2007 21:08:51 -0000	3.116
+++ layout/style/nsStyleStruct.h	6 Jun 2007 20:13:56 -0000
@@ -331,16 +331,21 @@ struct nsStyleBorder: public nsStyleStru
   nsChangeHint CalcDifference(const nsStyleBorder& aOther) const;
 #ifdef DEBUG
   static nsChangeHint MaxDifference();
 #endif
  
   nsStyleSides  mBorderRadius;    // [reset] length, percent
   PRUint8       mFloatEdge;       // [reset] see nsStyleConsts.h
   nsBorderColors** mBorderColors; // [reset] multiple levels of color for a border.
+  nsCOMPtr<imgIRequest> mBorderImage; //?? [reset]
+  nsStyleSides  mBorderImageSplit; //?? [reset]
+  nsMargin      mBorderImageWidth; //?? [reset]
+  PRUint8       mBorderHorisontalFill; //?? [reset]
+  PRUint8       mBorderVerticalFill; //?? [reset]
 
   void EnsureBorderColors() {
     if (!mBorderColors) {
       mBorderColors = new nsBorderColors*[4];
       if (mBorderColors)
         for (PRInt32 i = 0; i < 4; i++)
           mBorderColors[i] = nsnull;
     }
@@ -465,17 +470,17 @@ struct nsStyleBorder: public nsStyleStru
 
   void SetBorderToForeground(PRUint8 aSide)
   {
     NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side"); 
     mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
     mBorderStyle[aSide] |= BORDER_COLOR_FOREGROUND; 
   }
 
-protected:
+public:
   // mActualBorder holds the CSS2.1 actual border-width values.  In
   // particular, these widths take into account the border-style for the
   // relevant side and the values are rounded to the nearest device pixel.
   nsMargin      mActualBorder;
 
   // mBorder holds the nscoord values for the border widths as they would be if
   // all the border-style values were visible (not hidden or none).  This
   // member exists solely so that when we create structs using the copy
Index: layout/style/nsStyleStructList.h
===================================================================
RCS file: /cvsroot/mozilla/layout/style/nsStyleStructList.h,v
retrieving revision 3.14
diff -u -8 -p -r3.14 nsStyleStructList.h
--- layout/style/nsStyleStructList.h	27 Dec 2006 14:21:43 -0000	3.14
+++ layout/style/nsStyleStructList.h	6 Jun 2007 20:13:56 -0000
@@ -61,105 +61,105 @@
 #endif
 
 #ifdef STYLE_STRUCT_TEST
 #define STYLE_STRUCT_TEST_CODE(c) c
 #else
 #define STYLE_STRUCT_TEST_CODE(c)
 #endif
 
-  STYLE_STRUCT_TEST_CODE(if (STYLE_STRUCT_TEST < 8) {)
-  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST < 4) {)
-  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 2) {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 0) {)
+  STYLE_STRUCT_TEST_CODE(if (STYLE_STRUCT_TEST < 8) {                         )
+  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST < 4) {                       )
+  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 2) {                     )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 0) {                  )
 STYLE_STRUCT_INHERITED(Font, CheckFontCallback, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(      } else {)
-STYLE_STRUCT_INHERITED(Color, CheckColorCallback, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    } else {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 2) {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
+STYLE_STRUCT_INHERITED(Color, CheckColorCallback, (SSARG_PRESCONTEXT)         )
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    } else {                                         )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 2) {                  )
 STYLE_STRUCT_RESET(Background, nsnull, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_INHERITED(List, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    })
-  STYLE_STRUCT_TEST_CODE(  } else {)
-  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 6) {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 4) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    }                                                )
+  STYLE_STRUCT_TEST_CODE(  } else {                                           )
+  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 6) {                     )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 4) {                  )
 STYLE_STRUCT_RESET(Position, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_INHERITED(Text, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    } else {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 6) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    } else {                                         )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 6) {                  )
 STYLE_STRUCT_RESET(TextReset, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_RESET(Display, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    })
-  STYLE_STRUCT_TEST_CODE(  })
-  STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 16) {)
-  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST < 12) {)
-  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 10) {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 8) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    }                                                )
+  STYLE_STRUCT_TEST_CODE(  }                                                  )
+  STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 16) {                 )
+  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST < 12) {                      )
+  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 10) {                    )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 8) {                  )
 STYLE_STRUCT_INHERITED(Visibility, nsnull, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_RESET(Content, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    } else {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 10) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    } else {                                         )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 10) {                 )
 STYLE_STRUCT_INHERITED(Quotes, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_INHERITED(UserInterface, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    })
-  STYLE_STRUCT_TEST_CODE(  } else {)
-  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 14) {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 12) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    }                                                )
+  STYLE_STRUCT_TEST_CODE(  } else {                                           )
+  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST < 14) {                    )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 12) {                 )
 STYLE_STRUCT_RESET(UIReset, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_RESET(Table, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    } else {)
-  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 14) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    } else {                                         )
+  STYLE_STRUCT_TEST_CODE(      if (STYLE_STRUCT_TEST == 14) {                 )
 STYLE_STRUCT_INHERITED(TableBorder, nsnull, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(      } else {)
+  STYLE_STRUCT_TEST_CODE(      } else {                                       )
 STYLE_STRUCT_RESET(Margin, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(      })
-  STYLE_STRUCT_TEST_CODE(    })
-  STYLE_STRUCT_TEST_CODE(  })
-  STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 20) {)
-  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST < 18) {)
-  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST == 16) {)
+  STYLE_STRUCT_TEST_CODE(      }                                              )
+  STYLE_STRUCT_TEST_CODE(    }                                                )
+  STYLE_STRUCT_TEST_CODE(  }                                                  )
+  STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 20) {                 )
+  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST < 18) {                      )
+  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST == 16) {                   )
 STYLE_STRUCT_RESET(Padding, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(    } else {)
+  STYLE_STRUCT_TEST_CODE(    } else {                                         )
 STYLE_STRUCT_RESET(Border, nsnull, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(    })
-  STYLE_STRUCT_TEST_CODE(  } else {)
-  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST == 18) {)
+  STYLE_STRUCT_TEST_CODE(    }                                                )
+  STYLE_STRUCT_TEST_CODE(  } else {                                           )
+  STYLE_STRUCT_TEST_CODE(    if (STYLE_STRUCT_TEST == 18) {                   )
 STYLE_STRUCT_RESET(Outline, nsnull, (SSARG_PRESCONTEXT))
-  STYLE_STRUCT_TEST_CODE(    } else {)
+  STYLE_STRUCT_TEST_CODE(    } else {                                         )
 STYLE_STRUCT_RESET(XUL, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(    })
-  STYLE_STRUCT_TEST_CODE(  })
+  STYLE_STRUCT_TEST_CODE(    }                                                )
+  STYLE_STRUCT_TEST_CODE(  }                                                  )
 #ifndef MOZ_SVG
-  STYLE_STRUCT_TEST_CODE(} else {)
+  STYLE_STRUCT_TEST_CODE(} else {                                             )
   STYLE_STRUCT_TEST_CODE(  NS_ASSERTION(STYLE_STRUCT_TEST == 20, "out of range");)
 #else
-  STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 22) {)
-  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST == 20) {)
+  STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 22) {                 )
+  STYLE_STRUCT_TEST_CODE(  if (STYLE_STRUCT_TEST == 20) {                     )
 STYLE_STRUCT_INHERITED(SVG, nsnull, ())
-  STYLE_STRUCT_TEST_CODE(  } else {)
+  STYLE_STRUCT_TEST_CODE(  } else {                                           )
 STYLE_STRUCT_RESET(SVGReset,nsnull, ())
-  STYLE_STRUCT_TEST_CODE(  })
-  STYLE_STRUCT_TEST_CODE(} else {)
+  STYLE_STRUCT_TEST_CODE(  }                                                  )
+  STYLE_STRUCT_TEST_CODE(} else {                                             )
   STYLE_STRUCT_TEST_CODE(  NS_ASSERTION(STYLE_STRUCT_TEST == 22, "out of range");)
 #endif
   STYLE_STRUCT_RESET(Column, nsnull, ())
-STYLE_STRUCT_TEST_CODE(})
+  STYLE_STRUCT_TEST_CODE(}                                                    )
       
 #ifdef UNDEF_STYLE_STRUCT_INHERITED
 #undef STYLE_STRUCT_INHERITED
 #undef UNDEF_STYLE_STRUCT_INHERITED
 #endif
 
 #ifdef UNDEF_STYLE_STRUCT_RESET
 #undef STYLE_STRUCT_RESET
