Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (119764 => 119765)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-06-07 22:44:46 UTC (rev 119764)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-06-07 23:07:48 UTC (rev 119765)
@@ -1494,7 +1494,6 @@
return true;
}
-#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING)
static bool borderWillArcInnerEdge(const LayoutSize& firstRadius, const FloatSize& secondRadius)
{
return !firstRadius.isZero() || !secondRadius.isZero();
@@ -2101,331 +2100,7 @@
graphicsContext->setFillColor(color, style->colorSpace());
graphicsContext->drawRect(pixelSnappedIntRect(borderRect));
}
-#else
-void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style,
- BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
-{
- GraphicsContext* graphicsContext = info.context;
- // FIXME: This old version of paintBorder should be removed when all ports implement
- // GraphicsContext::clipConvexPolygon()!! This should happen soon.
- if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage()))
- return;
- const Color& topColor = style->visitedDependentColor(CSSPropertyBorderTopColor);
- const Color& bottomColor = style->visitedDependentColor(CSSPropertyBorderBottomColor);
- const Color& leftColor = style->visitedDependentColor(CSSPropertyBorderLeftColor);
- const Color& rightColor = style->visitedDependentColor(CSSPropertyBorderRightColor);
-
- bool topTransparent = style->borderTopIsTransparent();
- bool bottomTransparent = style->borderBottomIsTransparent();
- bool rightTransparent = style->borderRightIsTransparent();
- bool leftTransparent = style->borderLeftIsTransparent();
-
- EBorderStyle topStyle = style->borderTopStyle();
- EBorderStyle bottomStyle = style->borderBottomStyle();
- EBorderStyle leftStyle = style->borderLeftStyle();
- EBorderStyle rightStyle = style->borderRightStyle();
-
- bool horizontal = style->isHorizontalWritingMode();
- bool renderTop = topStyle > BHIDDEN && !topTransparent && (horizontal || includeLogicalLeftEdge);
- bool renderLeft = leftStyle > BHIDDEN && !leftTransparent && (!horizontal || includeLogicalLeftEdge);
- bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge);
- bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge);
-
-
- RoundedRect border(rect);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, false);
- if (style->hasBorderRadius()) {
- border.includeLogicalEdges(style->getRoundedBorderFor(border.rect(), view()).radii(),
- horizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
- if (border.isRounded()) {
- stateSaver.save();
- graphicsContext->addRoundedRectClip(border);
- }
- }
-
- int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan;
- float thickness;
- bool renderRadii = border.isRounded();
- bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor);
- bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE);
- bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE);
- bool lowerRightBorderStylesMatch = renderRight && (bottomStyle == rightStyle) && (bottomColor == rightColor);
-
- if (renderTop) {
- bool ignoreLeft = (renderRadii && border.radii().topLeft().width() > 0)
- || (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET
- && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
-
- bool ignoreRight = (renderRadii && border.radii().topRight().width() > 0)
- || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET
- && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
-
- int x = rect.x();
- int x2 = rect.maxX();
- if (renderRadii) {
- x += border.radii().topLeft().width();
- x2 -= border.radii().topRight().width();
- }
-
- drawLineForBoxSide(graphicsContext, x, rect.y(), x2, rect.y() + style->borderTopWidth(), BSTop, topColor, topStyle,
- ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
-
- if (renderRadii) {
- int leftY = rect.y();
-
- // We make the arc double thick and let the clip rect take care of clipping the extra off.
- // We're doing this because it doesn't seem possible to match the curve of the clip exactly
- // with the arc-drawing function.
- thickness = style->borderTopWidth() * 2;
-
- if (border.radii().topLeft().width()) {
- int leftX = rect.x();
- // The inner clip clips inside the arc. This is especially important for 1px borders.
- bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
- && (style->borderTopWidth() < border.radii().topLeft().height())
- && (topStyle != DOUBLE || style->borderTopWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyLeftInnerClip);
- if (applyLeftInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2),
- style->borderTopWidth());
-
- firstAngleStart = 90;
- firstAngleSpan = upperLeftBorderStylesMatch ? 90 : 45;
-
- // Draw upper left arc
- drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,
- BSTop, topColor, topStyle, true);
- }
-
- if (border.radii().topRight().width()) {
- int rightX = rect.maxX() - border.radii().topRight().width() * 2;
- bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
- && (style->borderTopWidth() < border.radii().topRight().height())
- && (topStyle != DOUBLE || style->borderTopWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyRightInnerClip);
- if (applyRightInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2),
- style->borderTopWidth());
-
- if (upperRightBorderStylesMatch) {
- secondAngleStart = 0;
- secondAngleSpan = 90;
- } else {
- secondAngleStart = 45;
- secondAngleSpan = 45;
- }
-
- // Draw upper right arc
- drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, border.radii().topRight(), secondAngleStart, secondAngleSpan,
- BSTop, topColor, topStyle, false);
- }
- }
- }
-
- if (renderBottom) {
- bool ignoreLeft = (renderRadii && border.radii().bottomLeft().width() > 0)
- || (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET
- && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
-
- bool ignoreRight = (renderRadii && border.radii().bottomRight().width() > 0)
- || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET
- && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
-
- int x = rect.x();
- int x2 = rect.maxX();
- if (renderRadii) {
- x += border.radii().bottomLeft().width();
- x2 -= border.radii().bottomRight().width();
- }
-
- drawLineForBoxSide(graphicsContext, x, rect.maxY() - style->borderBottomWidth(), x2, rect.maxY(), BSBottom, bottomColor, bottomStyle,
- ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
-
- if (renderRadii) {
- thickness = style->borderBottomWidth() * 2;
-
- if (border.radii().bottomLeft().width()) {
- int leftX = rect.x();
- int leftY = rect.maxY() - border.radii().bottomLeft().height() * 2;
- bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
- && (style->borderBottomWidth() < border.radii().bottomLeft().height())
- && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyLeftInnerClip);
- if (applyLeftInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),
- style->borderBottomWidth());
-
- if (lowerLeftBorderStylesMatch) {
- firstAngleStart = 180;
- firstAngleSpan = 90;
- } else {
- firstAngleStart = 225;
- firstAngleSpan = 45;
- }
-
- // Draw lower left arc
- drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().bottomLeft(), firstAngleStart, firstAngleSpan,
- BSBottom, bottomColor, bottomStyle, true);
- }
-
- if (border.radii().bottomRight().width()) {
- int rightY = rect.maxY() - border.radii().bottomRight().height() * 2;
- int rightX = rect.maxX() - border.radii().bottomRight().width() * 2;
- bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
- && (style->borderBottomWidth() < border.radii().bottomRight().height())
- && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyRightInnerClip);
- if (applyRightInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),
- style->borderBottomWidth());
-
- secondAngleStart = 270;
- secondAngleSpan = lowerRightBorderStylesMatch ? 90 : 45;
-
- // Draw lower right arc
- drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan,
- BSBottom, bottomColor, bottomStyle, false);
- }
- }
- }
-
- if (renderLeft) {
- bool ignoreTop = (renderRadii && border.radii().topLeft().height() > 0)
- || (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET
- && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
-
- bool ignoreBottom = (renderRadii && border.radii().bottomLeft().height() > 0)
- || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET
- && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
-
- int y = rect.y();
- int y2 = rect.maxY();
- if (renderRadii) {
- y += border.radii().topLeft().height();
- y2 -= border.radii().bottomLeft().height();
- }
-
- drawLineForBoxSide(graphicsContext, rect.x(), y, rect.x() + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
- ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
-
- if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) {
- int topX = rect.x();
- thickness = style->borderLeftWidth() * 2;
-
- if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) {
- int topY = rect.y();
- bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
- && (style->borderTopWidth() < border.radii().topLeft().height())
- && (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyTopInnerClip);
- if (applyTopInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2),
- style->borderLeftWidth());
-
- firstAngleStart = 135;
- firstAngleSpan = 45;
-
- // Draw top left arc
- drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,
- BSLeft, leftColor, leftStyle, true);
- }
-
- if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) {
- int bottomY = rect.maxY() - border.radii().bottomLeft().height() * 2;
- bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
- && (style->borderBottomWidth() < border.radii().bottomLeft().height())
- && (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyBottomInnerClip);
- if (applyBottomInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),
- style->borderLeftWidth());
-
- secondAngleStart = 180;
- secondAngleSpan = 45;
-
- // Draw bottom left arc
- drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, border.radii().bottomLeft(), secondAngleStart, secondAngleSpan,
- BSLeft, leftColor, leftStyle, false);
- }
- }
- }
-
- if (renderRight) {
- bool ignoreTop = (renderRadii && border.radii().topRight().height() > 0)
- || ((topColor == rightColor) && (topTransparent == rightTransparent)
- && (rightStyle >= DOTTED || rightStyle == INSET)
- && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
-
- bool ignoreBottom = (renderRadii && border.radii().bottomRight().height() > 0)
- || ((bottomColor == rightColor) && (bottomTransparent == rightTransparent)
- && (rightStyle >= DOTTED || rightStyle == INSET)
- && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
-
- int y = rect.y();
- int y2 = rect.maxY();
- if (renderRadii) {
- y += border.radii().topRight().height();
- y2 -= border.radii().bottomRight().height();
- }
-
- drawLineForBoxSide(graphicsContext, rect.maxX() - style->borderRightWidth(), y, rect.maxX(), y2, BSRight, rightColor, rightStyle,
- ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
-
- if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) {
- thickness = style->borderRightWidth() * 2;
-
- if (!upperRightBorderStylesMatch && border.radii().topRight().width()) {
- int topX = rect.maxX() - border.radii().topRight().width() * 2;
- int topY = rect.y();
- bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
- && (style->borderTopWidth() < border.radii().topRight().height())
- && (rightStyle != DOUBLE || style->borderRightWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyTopInnerClip);
- if (applyTopInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2),
- style->borderRightWidth());
-
- firstAngleStart = 0;
- firstAngleSpan = 45;
-
- // Draw top right arc
- drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topRight(), firstAngleStart, firstAngleSpan,
- BSRight, rightColor, rightStyle, true);
- }
-
- if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) {
- int bottomX = rect.maxX() - border.radii().bottomRight().width() * 2;
- int bottomY = rect.maxY() - border.radii().bottomRight().height() * 2;
- bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
- && (style->borderBottomWidth() < border.radii().bottomRight().height())
- && (rightStyle != DOUBLE || style->borderRightWidth() > 6);
-
- GraphicsContextStateSaver stateSaver(*graphicsContext, applyBottomInnerClip);
- if (applyBottomInnerClip)
- graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),
- style->borderRightWidth());
-
- secondAngleStart = 315;
- secondAngleSpan = 45;
-
- // Draw bottom right arc
- drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan,
- BSRight, rightColor, rightStyle, false);
- }
- }
- }
-}
-#endif
-
static void findInnerVertex(const FloatPoint& outerCorner, const FloatPoint& innerCorner, const FloatPoint& centerPoint, FloatPoint& result)
{
// If the line between outer and inner corner is towards the horizontal, intersect with a vertical line through the center,
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (119764 => 119765)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-06-07 22:44:46 UTC (rev 119764)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-06-07 23:07:48 UTC (rev 119765)
@@ -1014,91 +1014,6 @@
}
}
-#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 color,
- EBorderStyle style, bool firstCorner)
-{
- // FIXME: This function should be removed when all ports implement GraphicsContext::clipConvexPolygon()!!
- // At that time, everyone can use RenderObject::drawBoxSideFromPath() instead. This should happen soon.
- if ((style == DOUBLE && thickness / 2 < 3) || ((style == RIDGE || style == GROOVE) && thickness / 2 < 2))
- style = SOLID;
-
- switch (style) {
- case BNONE:
- case BHIDDEN:
- return;
- case DOTTED:
- case DASHED:
- 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);
- break;
- case DOUBLE: {
- float third = thickness / 3.0f;
- float innerThird = (thickness + 1.0f) / 6.0f;
- int shiftForInner = static_cast<int>(innerThird * 2.5f);
-
- int outerY = y;
- int outerHeight = radius.height() * 2;
- int innerX = x + shiftForInner;
- int innerY = y + shiftForInner;
- int innerWidth = (radius.width() - shiftForInner) * 2;
- int innerHeight = (radius.height() - shiftForInner) * 2;
- if (innerThird > 1 && (s == BSTop || (firstCorner && (s == BSLeft || s == BSRight)))) {
- outerHeight += 2;
- innerHeight += 2;
- }
-
- graphicsContext->setStrokeStyle(SolidStroke);
- 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);
- graphicsContext->strokeArc(IntRect(innerX, innerY, innerWidth, innerHeight), angleStart, angleSpan);
- break;
- }
- case GROOVE:
- case RIDGE: {
- Color c2;
- if ((style == RIDGE && (s == BSTop || s == BSLeft)) ||
- (style == GROOVE && (s == BSBottom || s == BSRight)))
- c2 = color.dark();
- else {
- c2 = color;
- color = color.dark();
- }
-
- graphicsContext->setStrokeStyle(SolidStroke);
- graphicsContext->setStrokeColor(color, m_style->colorSpace());
- graphicsContext->setStrokeThickness(thickness);
- graphicsContext->strokeArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), angleStart, angleSpan);
-
- float halfThickness = (thickness + 1.0f) / 4.0f;
- int shiftForInner = static_cast<int>(halfThickness * 1.5f);
- graphicsContext->setStrokeColor(c2, m_style->colorSpace());
- graphicsContext->setStrokeThickness(halfThickness > 2 ? halfThickness - 1 : halfThickness);
- graphicsContext->strokeArc(IntRect(x + shiftForInner, y + shiftForInner, (radius.width() - shiftForInner) * 2,
- (radius.height() - shiftForInner) * 2), angleStart, angleSpan);
- break;
- }
- case INSET:
- if (s == BSTop || s == BSLeft)
- color = color.dark();
- case OUTSET:
- if (style == OUTSET && (s == BSBottom || s == BSRight))
- color = color.dark();
- case SOLID:
- graphicsContext->setStrokeStyle(SolidStroke);
- graphicsContext->setStrokeColor(color, m_style->colorSpace());
- graphicsContext->setStrokeThickness(thickness);
- graphicsContext->strokeArc(IntRect(x, y, radius.width() * 2, radius.height() * 2), angleStart, angleSpan);
- break;
- }
-}
-#endif
-
void RenderObject::paintFocusRing(GraphicsContext* context, const LayoutPoint& paintOffset, RenderStyle* style)
{
Vector<IntRect> focusRingRects;
@@ -1107,7 +1022,7 @@
context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
else
addPDFURLRect(context, unionRect(focusRingRects));
-}
+}
void RenderObject::addPDFURLRect(GraphicsContext* context, const LayoutRect& rect)
{