diff --git a/src/HTML_Renderer/org/lobobrowser/html/renderer/BaseElementRenderable.java b/src/HTML_Renderer/org/lobobrowser/html/renderer/BaseElementRenderable.java index 5f953022..840fc3e5 100644 --- a/src/HTML_Renderer/org/lobobrowser/html/renderer/BaseElementRenderable.java +++ b/src/HTML_Renderer/org/lobobrowser/html/renderer/BaseElementRenderable.java @@ -762,20 +762,46 @@ private void prePaintBorder(final java.awt.Graphics g, int totalWidth, int total if (btop > 0) { g.setColor(this.getBorderTopColor()); + final Color borderTopDarkColor = g.getColor().darker(); + final Color borderTopLightColor = g.getColor().brighter(); final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.topStyle; if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) { final int topMid = startY + (btop / 2); GUITasks.drawDotted(g, startX, topMid, startX + totalWidth, topMid, btop); } else { + int btopBy3 = btop / 3; + int btopBy2 = btop / 2; + if (borderStyle == HtmlValues.BORDER_STYLE_INSET) { + g.setColor(borderTopDarkColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) { + g.setColor(borderTopLightColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + g.setColor(borderTopDarkColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + g.setColor(borderTopLightColor); + } for (int i = 0; i < btop; i++) { final int leftOffset = (i * bleft) / btop; final int rightOffset = (i * bright) / btop; - if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) { GUITasks.drawDashed(g, startX + leftOffset, startY + i, (startX + totalWidth) - rightOffset - 1, startY + i, 10 + btop, 6); } else { + if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + if (i == btopBy2) { + g.setColor(borderTopLightColor); + } + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + if (i == btopBy2) { + g.setColor(borderTopDarkColor); + } + } g.drawLine(startX + leftOffset, startY + i, (startX + totalWidth) - rightOffset - 1, startY + i); + if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) { + if (i == btopBy3) { + i += btopBy3; + } + } } } } @@ -783,19 +809,46 @@ private void prePaintBorder(final java.awt.Graphics g, int totalWidth, int total if (bright > 0) { final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.rightStyle; g.setColor(this.getBorderRightColor()); + final Color borderRightLightColor = g.getColor().brighter(); + final Color borderRightDarkColor = g.getColor().darker(); final int lastX = (startX + totalWidth) - 1; if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) { final int rightMid = lastX - (bright / 2); GUITasks.drawDotted(g, rightMid, startY, rightMid, startY + totalHeight, bright); } else { + int brightBy3 = bright / 3; + int brightBy2 = bright / 2; + if (borderStyle == HtmlValues.BORDER_STYLE_INSET) { + g.setColor(borderRightLightColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) { + g.setColor(borderRightDarkColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + g.setColor(borderRightLightColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + g.setColor(borderRightDarkColor); + } for (int i = 0; i < bright; i++) { final int topOffset = (i * btop) / bright; final int bottomOffset = (i * bbottom) / bright; if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) { GUITasks.drawDashed(g, lastX - i, startY + topOffset, lastX - i, (startY + totalHeight) - bottomOffset - 1, 10 + bright, 6); } else { + if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + if (i == brightBy2) { + g.setColor(borderRightDarkColor); + } + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + if (i == brightBy2) { + g.setColor(borderRightLightColor); + } + } g.drawLine(lastX - i, startY + topOffset, lastX - i, (startY + totalHeight) - bottomOffset - 1); + if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) { + if (i == brightBy3) { + i += brightBy3; + } + } } } } @@ -803,19 +856,47 @@ private void prePaintBorder(final java.awt.Graphics g, int totalWidth, int total if (bbottom > 0) { final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.bottomStyle; g.setColor(this.getBorderBottomColor()); + final Color borderBottomDarkColor = g.getColor().darker(); + final Color borderBottomLightColor = g.getColor().brighter(); + final int lastY = (startY + totalHeight) - 1; if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) { final int bottomMid = lastY - (bbottom / 2); GUITasks.drawDotted(g, startX, bottomMid, startX + totalWidth, bottomMid, bbottom); } else { + int bbottomBy3 = bbottom / 3; + int bbottomBy2 = bbottom / 2; + if (borderStyle == HtmlValues.BORDER_STYLE_INSET) { + g.setColor(borderBottomLightColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) { + g.setColor(borderBottomDarkColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + g.setColor(borderBottomLightColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + g.setColor(borderBottomDarkColor); + } for (int i = 0; i < bbottom; i++) { final int leftOffset = (i * bleft) / bbottom; final int rightOffset = (i * bright) / bbottom; if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) { GUITasks.drawDashed(g, startX + leftOffset, lastY - i, (startX + totalWidth) - rightOffset - 1, lastY - i, 10 + bbottom, 6); } else { + if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + if (i == bbottomBy2) { + g.setColor(borderBottomDarkColor); + } + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + if (i == bbottomBy2) { + g.setColor(borderBottomLightColor); + } + } g.drawLine(startX + leftOffset, lastY - i, (startX + totalWidth) - rightOffset - 1, lastY - i); + if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) { + if (i == bbottomBy3) { + i += bbottomBy3; + } + } } } } @@ -823,11 +904,24 @@ private void prePaintBorder(final java.awt.Graphics g, int totalWidth, int total if (bleft > 0) { final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.leftStyle; g.setColor(this.getBorderLeftColor()); + final Color borderLeftDarkColor = g.getColor().darker(); + final Color borderLeftLightColor = g.getColor().brighter(); if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) { final int leftMid = startX + (bleft / 2); GUITasks.drawDotted(g, leftMid, startY, leftMid, startY + totalHeight, bleft); } else { + int bleftBy3 = bleft / 3; + int bleftBy2 = bleft / 2; + if (borderStyle == HtmlValues.BORDER_STYLE_INSET) { + g.setColor(borderLeftDarkColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) { + g.setColor(borderLeftLightColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + g.setColor(borderLeftDarkColor); + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + g.setColor(borderLeftLightColor); + } for (int i = 0; i < bleft; i++) { final int topOffset = (i * btop) / bleft; final int bottomOffset = (i * bbottom) / bleft; @@ -835,7 +929,21 @@ private void prePaintBorder(final java.awt.Graphics g, int totalWidth, int total GUITasks .drawDashed(g, startX + i, startY + topOffset, startX + i, (startY + totalHeight) - bottomOffset - 1, 10 + bleft, 6); } else { + if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) { + if (i == bleftBy2) { + g.setColor(borderLeftLightColor); + } + } else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) { + if (i == bleftBy2) { + g.setColor(borderLeftDarkColor); + } + } g.drawLine(startX + i, startY + topOffset, startX + i, (startY + totalHeight) - bottomOffset - 1); + if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) { + if (i == bleftBy3) { + i += bleftBy3; + } + } } } } @@ -1070,4 +1178,4 @@ public int getMarginTop() { return marginInsets == null ? 0 : marginInsets.top; } -} +} \ No newline at end of file