| Index: Source/core/paint/ObjectPainter.cpp
|
| diff --git a/Source/core/paint/ObjectPainter.cpp b/Source/core/paint/ObjectPainter.cpp
|
| index 976976753229652d44e93f25d7aa2640f0b76bff..6d3521b5881086e219c32d58ef5bebed260a0af2 100644
|
| --- a/Source/core/paint/ObjectPainter.cpp
|
| +++ b/Source/core/paint/ObjectPainter.cpp
|
| @@ -134,14 +134,8 @@ void ObjectPainter::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1,
|
| style, adjacentWidth1, adjacentWidth2, antialias);
|
| break;
|
| case INSET:
|
| - // 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 && (side == BSBottom || side == BSRight))
|
| - color = color.dark();
|
| + modifyBorderColorForStyleIfNeeded(style, side, color);
|
| // fall through
|
| case SOLID:
|
| drawSolidBoxSide(graphicsContext, x1, y1, x2, y2, side, color, adjacentWidth1, adjacentWidth2, antialias);
|
| @@ -345,4 +339,25 @@ void ObjectPainter::drawSolidBoxSide(GraphicsContext* graphicsContext, int x1, i
|
| graphicsContext->fillPolygon(4, quad, color, antialias);
|
| }
|
|
|
| +void ObjectPainter::modifyBorderColorForStyleIfNeeded(const EBorderStyle& style, const BoxSide& side, Color& color)
|
| +{
|
| + const RGBA32 baseDarkColor = 0xFF202020;
|
| + const RGBA32 baseLightColor = 0xFFEBEBEB;
|
| + enum Operation { Darken, Lighten };
|
| + Operation operation = (side == BSTop || side == BSLeft) == (style == INSET) ?
|
| + Darken : Lighten;
|
| +
|
| + if (operation == Darken) {
|
| + if (differenceSquared(color, Color::black) >
|
| + differenceSquared(baseDarkColor, Color::black)) {
|
| + color = color.dark();
|
| + }
|
| + } else {
|
| + if (differenceSquared(color, Color::white) >
|
| + differenceSquared(baseLightColor, Color::white)) {
|
| + color = color.light();
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace blink
|
|
|