示例#1
0
 public void doLayout(
     int availWidth,
     int availHeight,
     boolean expandWidth,
     boolean expandHeight,
     FloatingBoundsSource floatBoundsSource,
     int defaultOverflowX,
     int defaultOverflowY,
     boolean sizeOnly) {
   RenderState renderState = this.modelNode.getRenderState();
   int counterStart = 1;
   Object rootNode = this.modelNode;
   if (!(rootNode instanceof HTMLElementImpl)) {
     return;
   }
   HTMLElementImpl rootElement = (HTMLElementImpl) rootNode;
   String startText = rootElement.getAttribute("start");
   if (startText != null) {
     try {
       counterStart = Integer.parseInt(startText);
     } catch (NumberFormatException nfe) {
       // ignore
     }
   }
   renderState.resetCount(DEFAULT_COUNTER_NAME, this.listNesting, counterStart);
   super.doLayout(
       availWidth,
       availHeight,
       expandWidth,
       expandHeight,
       floatBoundsSource,
       defaultOverflowX,
       defaultOverflowY,
       sizeOnly);
 }
示例#2
0
 public BorderInfo getBorderInfo() {
   BorderInfo binfo = this.borderInfo;
   if (binfo != INVALID_BORDER_INFO) {
     return binfo;
   }
   binfo = super.getBorderInfo();
   if (binfo == null
       || (binfo.topStyle == HtmlValues.BORDER_STYLE_NONE
           && binfo.bottomStyle == HtmlValues.BORDER_STYLE_NONE
           && binfo.leftStyle == HtmlValues.BORDER_STYLE_NONE
           && binfo.rightStyle == HtmlValues.BORDER_STYLE_NONE)) {
     if (binfo == null) {
       binfo = new BorderInfo();
     }
     HTMLElementImpl element = this.element;
     if (element != null) {
       String border = element.getAttribute("border");
       if (border != null) {
         border = border.trim();
         int value;
         int valueType;
         if (border.endsWith("%")) {
           valueType = HtmlInsets.TYPE_PERCENT;
           try {
             value = Integer.parseInt(border.substring(0, border.length() - 1));
           } catch (NumberFormatException nfe) {
             value = 0;
           }
         } else {
           valueType = HtmlInsets.TYPE_PIXELS;
           try {
             value = Integer.parseInt(border);
           } catch (NumberFormatException nfe) {
             value = 0;
           }
         }
         HtmlInsets borderInsets = new HtmlInsets();
         borderInsets.top = borderInsets.left = borderInsets.right = borderInsets.bottom = value;
         borderInsets.topType =
             borderInsets.leftType = borderInsets.rightType = borderInsets.bottomType = valueType;
         binfo.insets = borderInsets;
         if (binfo.topColor == null) {
           binfo.topColor = Color.BLACK;
         }
         if (binfo.leftColor == null) {
           binfo.leftColor = Color.BLACK;
         }
         if (binfo.rightColor == null) {
           binfo.rightColor = Color.BLACK;
         }
         if (binfo.bottomColor == null) {
           binfo.bottomColor = Color.BLACK;
         }
         if (value != 0) {
           binfo.topStyle =
               binfo.leftStyle =
                   binfo.rightStyle = binfo.bottomStyle = HtmlValues.BORDER_STYLE_SOLID;
         }
       }
     }
   }
   this.borderInfo = binfo;
   return binfo;
 }