Exemplo n.º 1
0
void PlatformScrollbar::paintRectWithBorder(GraphicsContext* context, const IntRect& rect, const Color& innerColor, const Color& outerColor) const
{
    context->drawRect(rect);
    context->fillRect(rect, Color::gray);

    Color tmp = context->strokeColor();

    context->setStrokeColor(Color::lightGray);
    context->drawLine( rect.topLeft(), rect.topRight() );
    context->drawLine( rect.topLeft(), rect.bottomLeft() );
    context->drawLine( rect.topRight(), rect.bottomRight() );
    context->drawLine( rect.bottomLeft(), rect.bottomRight() );

    IntRect inner( rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2 );
    context->setStrokeColor(Color::darkGray);
    context->drawLine( inner.topLeft(), inner.topRight() );
    context->drawLine( inner.topLeft(), inner.bottomLeft() );
    context->drawLine( inner.topRight(), inner.bottomRight() );
    context->drawLine( inner.bottomLeft(), inner.bottomRight() );

    context->setStrokeColor(tmp);
}
Exemplo n.º 2
0
void RenderFrameSet::paintRowBorder(const PaintInfo& paintInfo, const IntRect& borderRect)
{
    if (!paintInfo.rect.intersects(borderRect))
        return;

    // FIXME: We should do something clever when borders from distinct framesets meet at a join.
    
    // Fill first.
    GraphicsContext* context = paintInfo.context;
    context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->borderLeftColor() : borderFillColor());

    // Now stroke the edges but only if we have enough room to paint both edges with a little
    // bit of the fill color showing through.
    if (borderRect.height() >= 3) {
        context->fillRect(IntRect(borderRect.topLeft(), IntSize(width(), 1)), borderStartEdgeColor());
        context->fillRect(IntRect(borderRect.bottomLeft(), IntSize(width(), 1)), borderEndEdgeColor());
    }
}