예제 #1
0
void FieldsetPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
    if (!paintInfo.shouldPaintWithinRoot(&m_renderFieldset))
        return;

    LayoutRect paintRect(paintOffset, m_renderFieldset.size());
    RenderBox* legend = m_renderFieldset.findLegend();
    if (!legend)
        return BoxPainter(m_renderFieldset).paintBoxDecorationBackground(paintInfo, paintOffset);

    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
    // cases the legend is embedded in the right and bottom borders respectively.
    // https://bugs.webkit.org/show_bug.cgi?id=47236
    if (m_renderFieldset.style()->isHorizontalWritingMode()) {
        LayoutUnit yOff = (legend->location().y() > 0) ? LayoutUnit() : (legend->size().height() - m_renderFieldset.borderTop()) / 2;
        paintRect.setHeight(paintRect.height() - yOff);
        paintRect.setY(paintRect.y() + yOff);
    } else {
        LayoutUnit xOff = (legend->location().x() > 0) ? LayoutUnit() : (legend->size().width() - m_renderFieldset.borderLeft()) / 2;
        paintRect.setWidth(paintRect.width() - xOff);
        paintRect.setX(paintRect.x() + xOff);
    }

    RenderDrawingRecorder recorder(paintInfo.context, m_renderFieldset, paintInfo.phase, pixelSnappedIntRect(paintOffset, paintRect.size()));
    if (recorder.canUseCachedDrawing())
        return;

    BoxDecorationData boxDecorationData(m_renderFieldset, paintInfo.context);

    if (boxDecorationData.bleedAvoidance() == BackgroundBleedNone)
        BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderFieldset.style(), Normal);
    BoxPainter(m_renderFieldset).paintFillLayers(paintInfo, boxDecorationData.backgroundColor, m_renderFieldset.style()->backgroundLayers(), paintRect);
    BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderFieldset.style(), Inset);

    if (!boxDecorationData.hasBorder)
        return;

    // Create a clipping region around the legend and paint the border as normal
    GraphicsContext* graphicsContext = paintInfo.context;
    GraphicsContextStateSaver stateSaver(*graphicsContext);

    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
    // cases the legend is embedded in the right and bottom borders respectively.
    // https://bugs.webkit.org/show_bug.cgi?id=47236
    if (m_renderFieldset.style()->isHorizontalWritingMode()) {
        LayoutUnit clipTop = paintRect.y();
        LayoutUnit clipHeight = max(static_cast<LayoutUnit>(m_renderFieldset.style()->borderTopWidth()), legend->size().height() - ((legend->size().height() - m_renderFieldset.borderTop()) / 2));
        graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->location().x(), clipTop, legend->size().width(), clipHeight));
    } else {
        LayoutUnit clipLeft = paintRect.x();
        LayoutUnit clipWidth = max(static_cast<LayoutUnit>(m_renderFieldset.style()->borderLeftWidth()), legend->size().width());
        graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + legend->location().y(), clipWidth, legend->size().height()));
    }

    BoxPainter::paintBorder(m_renderFieldset, paintInfo, paintRect, m_renderFieldset.style());
}
예제 #2
0
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
    if (!paintInfo.shouldPaintWithinRoot(this))
        return;

    int w = width();
    int h = height();
    RenderBox* legend = findLegend();
    if (!legend)
        return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);

    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
    // cases the legend is embedded in the right and bottom borders respectively.
    // https://bugs.webkit.org/show_bug.cgi?id=47236
    if (style()->isHorizontalWritingMode()) {
        int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
        h -= yOff;
        ty += yOff;
    } else {
        int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
        w -= xOff;
        tx += xOff;
    }

    paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);

    paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h);
    paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);

    if (!style()->hasBorder())
        return;
    
    // Create a clipping region around the legend and paint the border as normal
    GraphicsContext* graphicsContext = paintInfo.context;
    graphicsContext->save();

    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
    // cases the legend is embedded in the right and bottom borders respectively.
    // https://bugs.webkit.org/show_bug.cgi?id=47236
    if (style()->isHorizontalWritingMode()) {
        int clipTop = ty;
        int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
        graphicsContext->clipOut(IntRect(tx + legend->x(), clipTop, legend->width(), clipHeight));
    } else {
        int clipLeft = tx;
        int clipWidth = max(static_cast<int>(style()->borderLeftWidth()), legend->width());
        graphicsContext->clipOut(IntRect(clipLeft, ty + legend->y(), clipWidth, legend->height()));
    }

    paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);

    graphicsContext->restore();
}
예제 #3
0
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
    if (!paintInfo.shouldPaintWithinRoot(this))
        return;

    LayoutRect paintRect(paintOffset, size());
    RenderBox* legend = findLegend();
    if (!legend)
        return RenderBlock::paintBoxDecorations(paintInfo, paintOffset);

    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
    // cases the legend is embedded in the right and bottom borders respectively.
    // https://bugs.webkit.org/show_bug.cgi?id=47236
    if (style()->isHorizontalWritingMode()) {
        LayoutUnit yOff = (legend->y() > 0) ? zeroLayoutUnit : (legend->height() - borderTop()) / 2;
        paintRect.setHeight(paintRect.height() - yOff);
        paintRect.setY(paintRect.y() + yOff);
    } else {
        LayoutUnit xOff = (legend->x() > 0) ? zeroLayoutUnit : (legend->width() - borderLeft()) / 2;
        paintRect.setWidth(paintRect.width() - xOff);
        paintRect.setX(paintRect.x() + xOff);
    }

    if (!boxShadowShouldBeAppliedToBackground(determineBackgroundBleedAvoidance(paintInfo.context)))
        paintBoxShadow(paintInfo, paintRect, style(), Normal);
    paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), paintRect);
    paintBoxShadow(paintInfo, paintRect, style(), Inset);

    if (!style()->hasBorder())
        return;
    
    // Create a clipping region around the legend and paint the border as normal
    GraphicsContext* graphicsContext = paintInfo.context;
    GraphicsContextStateSaver stateSaver(*graphicsContext);

    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
    // cases the legend is embedded in the right and bottom borders respectively.
    // https://bugs.webkit.org/show_bug.cgi?id=47236
    if (style()->isHorizontalWritingMode()) {
        LayoutUnit clipTop = paintRect.y();
        LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWidth()), legend->height() - ((legend->height() - borderTop()) / 2));
        graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
    } else {
        LayoutUnit clipLeft = paintRect.x();
        LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWidth()), legend->width());
        graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
    }

    paintBorder(paintInfo, paintRect, style());
}
예제 #4
0
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
    int w = width();
    int h = height() + borderTopExtra() + borderBottomExtra();
    RenderObject* legend = findLegend();
    if (!legend)
        return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);

    int yOff = (legend->yPos() > 0) ? 0 : (legend->height() - borderTop()) / 2;
    int legendBottom = ty + legend->yPos() + legend->height();
    h -= yOff;
    ty += yOff - borderTopExtra();

    int my = max(ty, paintInfo.rect.y());
    int end = min(paintInfo.rect.bottom(), ty + h);
    int mh = end - my;

    paintBoxShadow(paintInfo.context, tx, ty, w, h, style());

    paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), my, mh, tx, ty, w, h);

    if (!style()->hasBorder())
        return;

    // Save time by not saving and restoring the GraphicsContext in the straight border case
    if (!style()->hasBorderRadius())
        return paintBorderMinusLegend(paintInfo.context, tx, ty, w, h, style(), legend->xPos(), legend->width(), legendBottom);

    // We have rounded borders, create a clipping region
    // around the legend and paint the border as normal
    GraphicsContext* graphicsContext = paintInfo.context;
    graphicsContext->save();

    int clipTop = ty;
    int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());

    graphicsContext->clipOut(IntRect(tx + legend->xPos(), clipTop,
                                     legend->width(), clipHeight));
    paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);

    graphicsContext->restore();
}
void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
{
#if PLATFORM(WKC)
    CRASH_IF_STACK_OVERFLOW(WKC_STACK_MARGIN_DEFAULT);
#endif
    int w = width();
    int h = height();
    RenderBox* legend = findLegend();
    if (!legend)
        return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);

    int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
    int legendBottom = ty + legend->y() + legend->height();
    h -= yOff;
    ty += yOff;

    paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);

    paintFillLayers(paintInfo, style()->backgroundColor(), style()->backgroundLayers(), tx, ty, w, h);
    paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset);

    if (!style()->hasBorder())
        return;

    // Save time by not saving and restoring the GraphicsContext in the straight border case
    if (!style()->hasBorderRadius())
        return paintBorderMinusLegend(paintInfo.context, tx, ty, w, h, style(), legend->x(), legend->width(), legendBottom);
    
    // We have rounded borders, create a clipping region 
    // around the legend and paint the border as normal
    GraphicsContext* graphicsContext = paintInfo.context;
    graphicsContext->save();

    int clipTop = ty;
    int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());

    graphicsContext->clipOut(IntRect(tx + legend->x(), clipTop,
                                       legend->width(), clipHeight));
    paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);

    graphicsContext->restore();
}
예제 #6
0
void ClipOutToPath::apply(GraphicsContext& context) const
{
    context.clipOut(m_path);
}
예제 #7
0
void ClipOut::apply(GraphicsContext& context) const
{
    context.clipOut(m_rect);
}