summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering/RenderObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderObject.cpp')
-rw-r--r--Source/WebCore/rendering/RenderObject.cpp349
1 files changed, 110 insertions, 239 deletions
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index 7cc6f1f..b050539 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -707,10 +707,10 @@ bool RenderObject::mustRepaintBackgroundOrBorder() const
}
void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
- BoxSide s, Color c, EBorderStyle style,
- int adjbw1, int adjbw2)
+ BoxSide side, Color color, EBorderStyle style,
+ int adjacentWidth1, int adjacentWidth2, bool antialias)
{
- int width = (s == BSTop || s == BSBottom ? y2 - y1 : x2 - x1);
+ int width = (side == BSTop || side == BSBottom ? y2 - y1 : x2 - x1);
if (style == DOUBLE && width < 3)
style = SOLID;
@@ -721,12 +721,15 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
return;
case DOTTED:
case DASHED:
- graphicsContext->setStrokeColor(c, m_style->colorSpace());
+ graphicsContext->setStrokeColor(color, m_style->colorSpace());
graphicsContext->setStrokeThickness(width);
graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStroke);
- if (width > 0)
- switch (s) {
+ if (width > 0) {
+ bool wasAntialiased = graphicsContext->shouldAntialias();
+ graphicsContext->setShouldAntialias(antialias);
+
+ switch (side) {
case BSBottom:
case BSTop:
graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1 + y2) / 2));
@@ -736,14 +739,20 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2) / 2, y2));
break;
}
+ graphicsContext->setShouldAntialias(wasAntialiased);
+ }
break;
case DOUBLE: {
int third = (width + 1) / 3;
- if (adjbw1 == 0 && adjbw2 == 0) {
+ if (adjacentWidth1 == 0 && adjacentWidth2 == 0) {
graphicsContext->setStrokeStyle(NoStroke);
- graphicsContext->setFillColor(c, m_style->colorSpace());
- switch (s) {
+ graphicsContext->setFillColor(color, m_style->colorSpace());
+
+ bool wasAntialiased = graphicsContext->shouldAntialias();
+ graphicsContext->setShouldAntialias(antialias);
+
+ switch (side) {
case BSTop:
case BSBottom:
graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, third));
@@ -758,42 +767,44 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
graphicsContext->drawRect(IntRect(x2 - third, y1 + 1, third, y2 - y1 - 1));
break;
}
+
+ graphicsContext->setShouldAntialias(wasAntialiased);
} else {
- int adjbw1bigthird = ((adjbw1 > 0) ? adjbw1 + 1 : adjbw1 - 1) / 3;
- int adjbw2bigthird = ((adjbw2 > 0) ? adjbw2 + 1 : adjbw2 - 1) / 3;
+ int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 3;
+ int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 3;
- switch (s) {
+ switch (side) {
case BSTop:
- drawLineForBoxSide(graphicsContext, x1 + max((-adjbw1 * 2 + 1) / 3, 0),
- y1, x2 - max((-adjbw2 * 2 + 1) / 3, 0), y1 + third,
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawLineForBoxSide(graphicsContext, x1 + max((adjbw1 * 2 + 1) / 3, 0),
- y2 - third, x2 - max((adjbw2 * 2 + 1) / 3, 0), y2,
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+ y1, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + third,
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+ drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+ y2 - third, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y2,
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
break;
case BSLeft:
- drawLineForBoxSide(graphicsContext, x1, y1 + max((-adjbw1 * 2 + 1) / 3, 0),
- x1 + third, y2 - max((-adjbw2 * 2 + 1) / 3, 0),
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((adjbw1 * 2 + 1) / 3, 0),
- x2, y2 - max((adjbw2 * 2 + 1) / 3, 0),
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawLineForBoxSide(graphicsContext, x1, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+ x1 + third, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0),
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+ drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+ x2, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0),
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
break;
case BSBottom:
- drawLineForBoxSide(graphicsContext, x1 + max((adjbw1 * 2 + 1) / 3, 0),
- y1, x2 - max((adjbw2 * 2 + 1) / 3, 0), y1 + third,
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawLineForBoxSide(graphicsContext, x1 + max((-adjbw1 * 2 + 1) / 3, 0),
- y2 - third, x2 - max((-adjbw2 * 2 + 1) / 3, 0), y2,
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+ y1, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + third,
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+ drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+ y2 - third, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y2,
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
break;
case BSRight:
- drawLineForBoxSide(graphicsContext, x1, y1 + max((adjbw1 * 2 + 1) / 3, 0),
- x1 + third, y2 - max((adjbw2 * 2 + 1) / 3, 0),
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
- drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((-adjbw1 * 2 + 1) / 3, 0),
- x2, y2 - max((-adjbw2 * 2 + 1) / 3, 0),
- s, c, SOLID, adjbw1bigthird, adjbw2bigthird);
+ drawLineForBoxSide(graphicsContext, x1, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+ x1 + third, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0),
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+ drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+ x2, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0),
+ side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
break;
default:
break;
@@ -802,8 +813,7 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
break;
}
case RIDGE:
- case GROOVE:
- {
+ case GROOVE: {
EBorderStyle s1;
EBorderStyle s2;
if (style == GROOVE) {
@@ -814,82 +824,90 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
s2 = INSET;
}
- int adjbw1bighalf = ((adjbw1 > 0) ? adjbw1 + 1 : adjbw1 - 1) / 2;
- int adjbw2bighalf = ((adjbw2 > 0) ? adjbw2 + 1 : adjbw2 - 1) / 2;
+ int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 2;
+ int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 2;
- switch (s) {
+ switch (side) {
case BSTop:
- drawLineForBoxSide(graphicsContext, x1 + max(-adjbw1, 0) / 2, y1, x2 - max(-adjbw2, 0) / 2, (y1 + y2 + 1) / 2,
- s, c, s1, adjbw1bighalf, adjbw2bighalf);
- drawLineForBoxSide(graphicsContext, x1 + max(adjbw1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(adjbw2 + 1, 0) / 2, y2,
- s, c, s2, adjbw1 / 2, adjbw2 / 2);
+ drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1, 0) / 2, y1, x2 - max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
+ side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
+ drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(adjacentWidth2 + 1, 0) / 2, y2,
+ side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
break;
case BSLeft:
- drawLineForBoxSide(graphicsContext, x1, y1 + max(-adjbw1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(-adjbw2, 0) / 2,
- s, c, s1, adjbw1bighalf, adjbw2bighalf);
- drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(adjbw1 + 1, 0) / 2, x2, y2 - max(adjbw2 + 1, 0) / 2,
- s, c, s2, adjbw1 / 2, adjbw2 / 2);
+ drawLineForBoxSide(graphicsContext, x1, y1 + max(-adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(-adjacentWidth2, 0) / 2,
+ side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
+ drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(adjacentWidth1 + 1, 0) / 2, x2, y2 - max(adjacentWidth2 + 1, 0) / 2,
+ side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
break;
case BSBottom:
- drawLineForBoxSide(graphicsContext, x1 + max(adjbw1, 0) / 2, y1, x2 - max(adjbw2, 0) / 2, (y1 + y2 + 1) / 2,
- s, c, s2, adjbw1bighalf, adjbw2bighalf);
- drawLineForBoxSide(graphicsContext, x1 + max(-adjbw1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(-adjbw2 + 1, 0) / 2, y2,
- s, c, s1, adjbw1 / 2, adjbw2 / 2);
+ drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1, 0) / 2, y1, x2 - max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
+ side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
+ drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(-adjacentWidth2 + 1, 0) / 2, y2,
+ side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
break;
case BSRight:
- drawLineForBoxSide(graphicsContext, x1, y1 + max(adjbw1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(adjbw2, 0) / 2,
- s, c, s2, adjbw1bighalf, adjbw2bighalf);
- drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(-adjbw1 + 1, 0) / 2, x2, y2 - max(-adjbw2 + 1, 0) / 2,
- s, c, s1, adjbw1 / 2, adjbw2 / 2);
+ drawLineForBoxSide(graphicsContext, x1, y1 + max(adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(adjacentWidth2, 0) / 2,
+ side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
+ drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(-adjacentWidth1 + 1, 0) / 2, x2, y2 - max(-adjacentWidth2 + 1, 0) / 2,
+ side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
break;
}
break;
}
case INSET:
- if (s == BSTop || s == BSLeft)
- c = c.dark();
+ // FIXME: Maybe we should lighten the colors on one side like Firefox.
+ // https://bugs.webkit.org/show_bug.cgi?id=58608
+ if (side == BSTop || side == BSLeft)
+ color = color.dark();
// fall through
case OUTSET:
- if (style == OUTSET && (s == BSBottom || s == BSRight))
- c = c.dark();
+ if (style == OUTSET && (side == BSBottom || side == BSRight))
+ color = color.dark();
// fall through
case SOLID: {
graphicsContext->setStrokeStyle(NoStroke);
- graphicsContext->setFillColor(c, m_style->colorSpace());
+ graphicsContext->setFillColor(color, m_style->colorSpace());
ASSERT(x2 >= x1);
ASSERT(y2 >= y1);
- if (!adjbw1 && !adjbw2) {
+ if (!adjacentWidth1 && !adjacentWidth2) {
+ // Turn off antialiasing to match the behavior of drawConvexPolygon();
+ // this matters for rects in transformed contexts.
+ bool wasAntialiased = graphicsContext->shouldAntialias();
+ graphicsContext->setShouldAntialias(antialias);
graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1));
+ graphicsContext->setShouldAntialias(wasAntialiased);
return;
}
FloatPoint quad[4];
- switch (s) {
+ switch (side) {
case BSTop:
- quad[0] = FloatPoint(x1 + max(-adjbw1, 0), y1);
- quad[1] = FloatPoint(x1 + max(adjbw1, 0), y2);
- quad[2] = FloatPoint(x2 - max(adjbw2, 0), y2);
- quad[3] = FloatPoint(x2 - max(-adjbw2, 0), y1);
+ quad[0] = FloatPoint(x1 + max(-adjacentWidth1, 0), y1);
+ quad[1] = FloatPoint(x1 + max(adjacentWidth1, 0), y2);
+ quad[2] = FloatPoint(x2 - max(adjacentWidth2, 0), y2);
+ quad[3] = FloatPoint(x2 - max(-adjacentWidth2, 0), y1);
break;
case BSBottom:
- quad[0] = FloatPoint(x1 + max(adjbw1, 0), y1);
- quad[1] = FloatPoint(x1 + max(-adjbw1, 0), y2);
- quad[2] = FloatPoint(x2 - max(-adjbw2, 0), y2);
- quad[3] = FloatPoint(x2 - max(adjbw2, 0), y1);
+ quad[0] = FloatPoint(x1 + max(adjacentWidth1, 0), y1);
+ quad[1] = FloatPoint(x1 + max(-adjacentWidth1, 0), y2);
+ quad[2] = FloatPoint(x2 - max(-adjacentWidth2, 0), y2);
+ quad[3] = FloatPoint(x2 - max(adjacentWidth2, 0), y1);
break;
case BSLeft:
- quad[0] = FloatPoint(x1, y1 + max(-adjbw1, 0));
- quad[1] = FloatPoint(x1, y2 - max(-adjbw2, 0));
- quad[2] = FloatPoint(x2, y2 - max(adjbw2, 0));
- quad[3] = FloatPoint(x2, y1 + max(adjbw1, 0));
+ quad[0] = FloatPoint(x1, y1 + max(-adjacentWidth1, 0));
+ quad[1] = FloatPoint(x1, y2 - max(-adjacentWidth2, 0));
+ quad[2] = FloatPoint(x2, y2 - max(adjacentWidth2, 0));
+ quad[3] = FloatPoint(x2, y1 + max(adjacentWidth1, 0));
break;
case BSRight:
- quad[0] = FloatPoint(x1, y1 + max(adjbw1, 0));
- quad[1] = FloatPoint(x1, y2 - max(adjbw2, 0));
- quad[2] = FloatPoint(x2, y2 - max(-adjbw2, 0));
- quad[3] = FloatPoint(x2, y1 + max(-adjbw1, 0));
+ quad[0] = FloatPoint(x1, y1 + max(adjacentWidth1, 0));
+ quad[1] = FloatPoint(x1, y2 - max(adjacentWidth2, 0));
+ quad[2] = FloatPoint(x2, y2 - max(-adjacentWidth2, 0));
+ quad[3] = FloatPoint(x2, y1 + max(-adjacentWidth1, 0));
break;
}
- graphicsContext->drawConvexPolygon(4, quad);
+
+ graphicsContext->drawConvexPolygon(4, quad, antialias);
break;
}
}
@@ -904,156 +922,9 @@ IntRect RenderObject::borderInnerRect(const IntRect& borderRect, unsigned short
borderRect.height() - topWidth - bottomWidth);
}
-#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING)
-void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const IntRect& borderRect, const Path& borderPath,
- float thickness, float drawThickness, BoxSide s, const RenderStyle* style,
- Color c, EBorderStyle borderStyle)
-{
- if (thickness <= 0)
- return;
-
- if (borderStyle == DOUBLE && thickness < 3)
- borderStyle = SOLID;
-
- switch (borderStyle) {
- case BNONE:
- case BHIDDEN:
- return;
- case DOTTED:
- case DASHED: {
- graphicsContext->setStrokeColor(c, style->colorSpace());
-
- // The stroke is doubled here because the provided path is the
- // outside edge of the border so half the stroke is clipped off.
- // The extra multiplier is so that the clipping mask can antialias
- // the edges to prevent jaggies.
- graphicsContext->setStrokeThickness(drawThickness * 2 * 1.1f);
- graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke);
-
- // If the number of dashes that fit in the path is odd and non-integral then we
- // will have an awkwardly-sized dash at the end of the path. To try to avoid that
- // here, we simply make the whitespace dashes ever so slightly bigger.
- // FIXME: This could be even better if we tried to manipulate the dash offset
- // and possibly the whiteSpaceWidth to get the corners dash-symmetrical.
- float patWidth = thickness * ((borderStyle == DASHED) ? 3.0f : 1.0f);
- float whiteSpaceWidth = patWidth;
- float numberOfDashes = borderPath.length() / patWidth;
- bool evenNumberOfFullDashes = !((int)numberOfDashes % 2);
- bool integralNumberOfDashes = !(numberOfDashes - (int)numberOfDashes);
- if (!evenNumberOfFullDashes && !integralNumberOfDashes) {
- float numberOfWhitespaceDashes = numberOfDashes / 2;
- whiteSpaceWidth += (patWidth / numberOfWhitespaceDashes);
- }
-
- DashArray lineDash;
- lineDash.append(patWidth);
- lineDash.append(whiteSpaceWidth);
- graphicsContext->setLineDash(lineDash, patWidth);
- graphicsContext->strokePath(borderPath);
- return;
- }
- case DOUBLE: {
- int outerBorderTopWidth = style->borderTopWidth() / 3;
- int outerBorderRightWidth = style->borderRightWidth() / 3;
- int outerBorderBottomWidth = style->borderBottomWidth() / 3;
- int outerBorderLeftWidth = style->borderLeftWidth() / 3;
-
- int innerBorderTopWidth = style->borderTopWidth() * 2 / 3;
- int innerBorderRightWidth = style->borderRightWidth() * 2 / 3;
- int innerBorderBottomWidth = style->borderBottomWidth() * 2 / 3;
- int innerBorderLeftWidth = style->borderLeftWidth() * 2 / 3;
-
- // We need certain integer rounding results
- if (style->borderTopWidth() % 3 == 2)
- outerBorderTopWidth += 1;
- if (style->borderRightWidth() % 3 == 2)
- outerBorderRightWidth += 1;
- if (style->borderBottomWidth() % 3 == 2)
- outerBorderBottomWidth += 1;
- if (style->borderLeftWidth() % 3 == 2)
- outerBorderLeftWidth += 1;
-
- if (style->borderTopWidth() % 3 == 1)
- innerBorderTopWidth += 1;
- if (style->borderRightWidth() % 3 == 1)
- innerBorderRightWidth += 1;
- if (style->borderBottomWidth() % 3 == 1)
- innerBorderBottomWidth += 1;
- if (style->borderLeftWidth() % 3 == 1)
- innerBorderLeftWidth += 1;
-
- // Get the inner border rects for both the outer border line and the inner border line
-
- // Draw inner border line
- graphicsContext->save();
- IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth,
- innerBorderLeftWidth, innerBorderRightWidth);
- RoundedIntRect innerClip = style->getRoundedInnerBorderWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth,
- innerBorderLeftWidth, innerBorderRightWidth);
- graphicsContext->addRoundedRectClip(innerClip);
- drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID);
- graphicsContext->restore();
-
- // Draw outer border line
- graphicsContext->save();
- IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth,
- outerBorderLeftWidth, outerBorderRightWidth);
- RoundedIntRect outerClip = style->getRoundedInnerBorderWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth,
- outerBorderLeftWidth, outerBorderRightWidth);
- graphicsContext->clipOutRoundedRect(outerClip);
- drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID);
- graphicsContext->restore();
-
- return;
- }
- case RIDGE:
- case GROOVE:
- {
- EBorderStyle s1;
- EBorderStyle s2;
- if (borderStyle == GROOVE) {
- s1 = INSET;
- s2 = OUTSET;
- } else {
- s1 = OUTSET;
- s2 = INSET;
- }
-
- IntRect halfBorderRect = borderInnerRect(borderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2,
- style->borderLeftWidth() / 2, style->borderRightWidth() / 2);
-
- // Paint full border
- drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s1);
-
- // Paint inner only
- graphicsContext->save();
- RoundedIntRect clipRect = style->getRoundedInnerBorderWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2,
- style->borderLeftWidth() / 2, style->borderRightWidth() / 2);
- graphicsContext->addRoundedRectClip(clipRect);
- drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2);
- graphicsContext->restore();
-
- return;
- }
- case INSET:
- if (s == BSTop || s == BSLeft)
- c = c.dark();
- break;
- case OUTSET:
- if (s == BSBottom || s == BSRight)
- c = c.dark();
- break;
- default:
- break;
- }
-
- graphicsContext->setStrokeStyle(NoStroke);
- graphicsContext->setFillColor(c, style->colorSpace());
- graphicsContext->drawRect(borderRect);
-}
-#else
+#if !HAVE(PATH_BASED_BORDER_RADIUS_DRAWING)
void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, int y, float thickness, const IntSize& radius,
- int angleStart, int angleSpan, BoxSide s, Color c,
+ int angleStart, int angleSpan, BoxSide s, Color color,
EBorderStyle style, bool firstCorner)
{
// FIXME: This function should be removed when all ports implement GraphicsContext::clipConvexPolygon()!!
@@ -1067,7 +938,7 @@ void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, in
return;
case DOTTED:
case DASHED:
- graphicsContext->setStrokeColor(c, m_style->colorSpace());
+ graphicsContext->setStrokeColor(color, m_style->colorSpace());
graphicsContext->setStrokeStyle(style == DOTTED ? DottedStroke : DashedStroke);
graphicsContext->setStrokeThickness(thickness);
graphicsContext->strokeArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), angleStart, angleSpan);
@@ -1089,7 +960,7 @@ void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, in
}
graphicsContext->setStrokeStyle(SolidStroke);
- graphicsContext->setStrokeColor(c, m_style->colorSpace());
+ graphicsContext->setStrokeColor(color, m_style->colorSpace());
graphicsContext->setStrokeThickness(third);
graphicsContext->strokeArc(IntRect(x, outerY, radius.width() * 2, outerHeight), angleStart, angleSpan);
graphicsContext->setStrokeThickness(innerThird > 2 ? innerThird - 1 : innerThird);
@@ -1101,14 +972,14 @@ void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, in
Color c2;
if ((style == RIDGE && (s == BSTop || s == BSLeft)) ||
(style == GROOVE && (s == BSBottom || s == BSRight)))
- c2 = c.dark();
+ c2 = color.dark();
else {
- c2 = c;
- c = c.dark();
+ c2 = color;
+ color = color.dark();
}
graphicsContext->setStrokeStyle(SolidStroke);
- graphicsContext->setStrokeColor(c, m_style->colorSpace());
+ graphicsContext->setStrokeColor(color, m_style->colorSpace());
graphicsContext->setStrokeThickness(thickness);
graphicsContext->strokeArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), angleStart, angleSpan);
@@ -1122,13 +993,13 @@ void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, in
}
case INSET:
if (s == BSTop || s == BSLeft)
- c = c.dark();
+ color = color.dark();
case OUTSET:
if (style == OUTSET && (s == BSBottom || s == BSRight))
- c = c.dark();
+ color = color.dark();
case SOLID:
graphicsContext->setStrokeStyle(SolidStroke);
- graphicsContext->setStrokeColor(c, m_style->colorSpace());
+ graphicsContext->setStrokeColor(color, m_style->colorSpace());
graphicsContext->setStrokeThickness(thickness);
graphicsContext->strokeArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), angleStart, angleSpan);
break;