⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 render_object.cpp

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 CPP
📖 第 1 页 / 共 5 页
字号:
          switch(s)            {            case BSTop:              drawBorder(p, x1+kMax((-adjbw1*2+1)/3,0), y1        , x2-kMax((-adjbw2*2+1)/3,0), y1 + third, s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              drawBorder(p, x1+kMax(( adjbw1*2+1)/3,0), y2 - third, x2-kMax(( adjbw2*2+1)/3,0), y2        , s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              break;            case BSLeft:              drawBorder(p, x1        , y1+kMax((-adjbw1*2+1)/3,0), x1+third, y2-kMax((-adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              drawBorder(p, x2 - third, y1+kMax(( adjbw1*2+1)/3,0), x2      , y2-kMax(( adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              break;            case BSBottom:              drawBorder(p, x1+kMax(( adjbw1*2+1)/3,0), y1      , x2-kMax(( adjbw2*2+1)/3,0), y1+third, s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              drawBorder(p, x1+kMax((-adjbw1*2+1)/3,0), y2-third, x2-kMax((-adjbw2*2+1)/3,0), y2      , s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              break;            case BSRight:            drawBorder(p, x1      , y1+kMax(( adjbw1*2+1)/3,0), x1+third, y2-kMax(( adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);            drawBorder(p, x2-third, y1+kMax((-adjbw1*2+1)/3,0), x2      , y2-kMax((-adjbw2*2+1)/3,0), s, c, textcolor, SOLID, adjbw1bigthird, adjbw2bigthird);              break;            default:              break;            }        }        break;    }    case RIDGE:    case GROOVE:    {        EBorderStyle s1;        EBorderStyle s2;        if (style==GROOVE)        {            s1 = INSET;            s2 = OUTSET;        }        else        {            s1 = OUTSET;            s2 = INSET;        }        int adjbw1bighalf;        int adjbw2bighalf;        if (adjbw1>0) adjbw1bighalf=adjbw1+1;        else adjbw1bighalf=adjbw1-1;        adjbw1bighalf/=2;        if (adjbw2>0) adjbw2bighalf=adjbw2+1;        else adjbw2bighalf=adjbw2-1;        adjbw2bighalf/=2;        switch (s)        {        case BSTop:            drawBorder(p, x1+kMax(-adjbw1  ,0)/2,  y1        , x2-kMax(-adjbw2,0)/2, (y1+y2+1)/2, s, c, textcolor, s1, adjbw1bighalf, adjbw2bighalf);            drawBorder(p, x1+kMax( adjbw1+1,0)/2, (y1+y2+1)/2, x2-kMax( adjbw2+1,0)/2,  y2        , s, c, textcolor, s2, adjbw1/2, adjbw2/2);            break;        case BSLeft:            drawBorder(p,  x1        , y1+kMax(-adjbw1  ,0)/2, (x1+x2+1)/2, y2-kMax(-adjbw2,0)/2, s, c, textcolor, s1, adjbw1bighalf, adjbw2bighalf);            drawBorder(p, (x1+x2+1)/2, y1+kMax( adjbw1+1,0)/2,  x2        , y2-kMax( adjbw2+1,0)/2, s, c, textcolor, s2, adjbw1/2, adjbw2/2);            break;        case BSBottom:            drawBorder(p, x1+kMax( adjbw1  ,0)/2,  y1        , x2-kMax( adjbw2,0)/2, (y1+y2+1)/2, s, c, textcolor, s2,  adjbw1bighalf, adjbw2bighalf);            drawBorder(p, x1+kMax(-adjbw1+1,0)/2, (y1+y2+1)/2, x2-kMax(-adjbw2+1,0)/2,  y2        , s, c, textcolor, s1, adjbw1/2, adjbw2/2);            break;        case BSRight:            drawBorder(p,  x1        , y1+kMax( adjbw1  ,0)/2, (x1+x2+1)/2, y2-kMax( adjbw2,0)/2, s, c, textcolor, s2, adjbw1bighalf, adjbw2bighalf);            drawBorder(p, (x1+x2+1)/2, y1+kMax(-adjbw1+1,0)/2,  x2        , y2-kMax(-adjbw2+1,0)/2, s, c, textcolor, s1, adjbw1/2, adjbw2/2);            break;        }        break;    }    case INSET:    case OUTSET:        calc3DColor(c, (style == OUTSET && (s == BSBottom || s == BSRight)) ||             (style == INSET && ( s == BSTop || s == BSLeft ) ) );        /* nobreak; */    case SOLID:        p->setPen(Qt::NoPen);        p->setBrush(c);        Q_ASSERT(x2>=x1);        Q_ASSERT(y2>=y1);        if (adjbw1==0 && adjbw2 == 0) {            p->drawRect(x1,y1,x2-x1,y2-y1);            return;        }        QPointArray quad(4);        switch(s) {        case BSTop:            quad.setPoints(4,                           x1+kMax(-adjbw1,0), y1,                           x1+kMax( adjbw1,0), y2,                           x2-kMax( adjbw2,0), y2,                           x2-kMax(-adjbw2,0), y1);            break;        case BSBottom:            quad.setPoints(4,                           x1+kMax( adjbw1,0), y1,                           x1+kMax(-adjbw1,0), y2,                           x2-kMax(-adjbw2,0), y2,                           x2-kMax( adjbw2,0), y1);            break;        case BSLeft:          quad.setPoints(4,                         x1, y1+kMax(-adjbw1,0),                                x1, y2-kMax(-adjbw2,0),                         x2, y2-kMax( adjbw2,0),                         x2, y1+kMax( adjbw1,0));            break;        case BSRight:          quad.setPoints(4,                         x1, y1+kMax( adjbw1,0),                                x1, y2-kMax( adjbw2,0),                         x2, y2-kMax(-adjbw2,0),                         x2, y1+kMax(-adjbw1,0));            break;        }        p->drawConvexPolygon(quad);        break;    }    if(invalidisInvert && p->rasterOp() == Qt::XorROP)        p->setRasterOp(Qt::CopyROP);}void RenderObject::paintBorder(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin, bool end){    const QColor& tc = style->borderTopColor();    const QColor& bc = style->borderBottomColor();    const QColor& lc = style->borderLeftColor();    const QColor& rc = style->borderRightColor();    bool tt = style->borderTopIsTransparent();    bool bt = style->borderBottomIsTransparent();    bool rt = style->borderRightIsTransparent();    bool lt = style->borderLeftIsTransparent();    EBorderStyle ts = style->borderTopStyle();    EBorderStyle bs = style->borderBottomStyle();    EBorderStyle ls = style->borderLeftStyle();    EBorderStyle rs = style->borderRightStyle();    bool render_t = ts > BHIDDEN && !tt;    bool render_l = ls > BHIDDEN && begin && !lt;    bool render_r = rs > BHIDDEN && end && !rt;    bool render_b = bs > BHIDDEN && !bt;    if(render_t) {        bool ignore_left =            (tc == lc) && (tt == lt) &&            (ts >= OUTSET) &&            (ls == DOTTED || ls == DASHED || ls == SOLID || ls == OUTSET);        bool ignore_right =            (tc == rc) && (tt == rt) &&            (ts >= OUTSET) &&            (rs == DOTTED || rs == DASHED || rs == SOLID || rs == INSET);        drawBorder(p, _tx, _ty, _tx + w, _ty +  style->borderTopWidth(), BSTop, tc, style->color(), ts,                   ignore_left?0:style->borderLeftWidth(),                   ignore_right?0:style->borderRightWidth());    }    if(render_b) {        bool ignore_left =            (bc == lc) && (bt == lt) &&            (bs >= OUTSET) &&            (ls == DOTTED || ls == DASHED || ls == SOLID || ls == OUTSET);        bool ignore_right =            (bc == rc) && (bt == rt) &&            (bs >= OUTSET) &&            (rs == DOTTED || rs == DASHED || rs == SOLID || rs == INSET);        drawBorder(p, _tx, _ty + h - style->borderBottomWidth(), _tx + w, _ty + h, BSBottom, bc, style->color(), bs,                   ignore_left?0:style->borderLeftWidth(),                   ignore_right?0:style->borderRightWidth());    }    if(render_l)    {	bool ignore_top =	  (tc == lc) && (tt == lt) &&	  (ls >= OUTSET) &&	  (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET);	bool ignore_bottom =	  (bc == lc) && (bt == lt) &&	  (ls >= OUTSET) &&	  (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET);        drawBorder(p, _tx, _ty, _tx + style->borderLeftWidth(), _ty + h, BSLeft, lc, style->color(), ls,                   ignore_top?0:style->borderTopWidth(),                   ignore_bottom?0:style->borderBottomWidth());    }    if(render_r)    {	bool ignore_top =	  (tc == rc) && (tt == rt) &&	  (rs >= DOTTED || rs == INSET) &&	  (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET);	bool ignore_bottom =	  (bc == rc) && (bt == rt) &&	  (rs >= DOTTED || rs == INSET) &&	  (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET);        drawBorder(p, _tx + w - style->borderRightWidth(), _ty, _tx + w, _ty + h, BSRight, rc, style->color(), rs,                   ignore_top?0:style->borderTopWidth(),                   ignore_bottom?0:style->borderBottomWidth());    }}void RenderObject::paintOutline(QPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style){    int ow = style->outlineWidth();    if(!ow) return;    const QColor& oc = style->outlineColor();    EBorderStyle os = style->outlineStyle();    // ### outline-offset should be implemented in renderInline before reactivated here    int offset = 0; // style->outlineOffset();#ifdef APPLE_CHANGES    if (style->outlineStyleIsAuto()) {        p->initFocusRing(ow, offset, oc);        addFocusRingRects(p, _tx, _ty);        p->drawFocusRing();        p->clearFocusRing();        return;    }#endif    _tx -= offset;    _ty -= offset;    w += 2*offset;    h += 2*offset;    drawBorder(p, _tx-ow, _ty-ow, _tx, _ty+h+ow, BSLeft,               QColor(oc), style->color(),               os, ow, ow, true);    drawBorder(p, _tx-ow, _ty-ow, _tx+w+ow, _ty, BSTop,               QColor(oc), style->color(),               os, ow, ow, true);    drawBorder(p, _tx+w, _ty-ow, _tx+w+ow, _ty+h+ow, BSRight,               QColor(oc), style->color(),               os, ow, ow, true);    drawBorder(p, _tx-ow, _ty+h, _tx+w+ow, _ty+h+ow, BSBottom,               QColor(oc), style->color(),               os, ow, ow, true);}void RenderObject::paint( PaintInfo&, int /*tx*/, int /*ty*/){}void RenderObject::repaintRectangle(int x, int y, int w, int h, bool immediate, bool f){    if(parent()) parent()->repaintRectangle(x, y, w, h, immediate, f);}#ifdef ENABLE_DUMPQString RenderObject::information() const{    QString str;    QTextStream ts( &str, IO_WriteOnly );    ts << renderName()        << "(" << (style() ? style()->refCount() : 0) << ")"       << ": " << (void*)this << "  ";    if (isInline()) ts << "il ";    if (childrenInline()) ts << "ci ";    if (isFloating()) ts << "fl ";    if (isAnonymous()) ts << "an ";    if (isRelPositioned()) ts << "rp ";    if (isPositioned()) ts << "ps ";    if (isReplaced()) ts << "rp ";    if (overhangingContents()) ts << "oc ";    if (needsLayout()) ts << "nl ";    if (minMaxKnown()) ts << "mmk ";    if (m_recalcMinMax) ts << "rmm ";    if (mouseInside()) ts << "mi ";    if (style() && style()->zIndex()) ts << "zI: " << style()->zIndex();    if (style() && style()->hasAutoZIndex()) ts << "zI: auto ";    if (element()) {        if (element()->active()) ts << "act ";        if (element()->hasAnchor()) ts << "anchor ";        if (element()->focused()) ts << "focus ";        ts << " <" <<  getTagName(element()->id()) << ">";    } else if (isPseudoAnonymous() && style() && style()->styleType() != RenderStyle::NOPSEUDO) {        ts << " <" <<  getTagName(node()->id());        QString pseudo;        switch (style()->styleType()) {          case RenderStyle::FIRST_LETTER:            pseudo = ":first-letter"; break;          case RenderStyle::BEFORE:            pseudo = ":before"; break;          case RenderStyle::AFTER:            pseudo = ":after"; break;          default:            pseudo = ":pseudo-element";        }        ts << pseudo;        ts << ">";    }    ts << " (" << xPos() << "," << yPos() << "," << width() << "," << height() << ")"       << " [" << minWidth() << "-" << maxWidth() << "]"       << " { mT: " << marginTop() << " qT: " << isTopMarginQuirk()       << " mB: " << marginBottom() << " qB: " << isBottomMarginQuirk()       << "}"        << (isTableCell() ?            ( QString::fromLatin1(" [r=") +              QString::number( static_cast<const RenderTableCell *>(this)->row() ) +              QString::fromLatin1(" c=") +              QString::number( static_cast<const RenderTableCell *>(this)->col() ) +              QString::fromLatin1(" rs=") +              QString::number( static_cast<const RenderTableCell *>(this)->rowSpan() ) +              QString::fromLatin1(" cs=") +              QString::number( static_cast<const RenderTableCell *>(this)->colSpan() ) +              QString::fromLatin1("]") ) : QString::null );    if ( layer() )        ts << " layer=" << layer();    if ( continuation() )        ts << " continuation=" << continuation();    if (isText())        ts << " \"" << QConstString(static_cast<const RenderText *>(this)->text(), kMin(static_cast<const RenderText *>(this)->length(), 10u)).string() << "\"";    return str;}void RenderObject::printTree(int indent) const{    QString ind;    ind.fill(' ', indent);    kdDebug() << ind << information() << endl;    RenderObject *child = firstChild();    while( child != 0 )    {        child->printTree(indent+2);        child = child->nextSibling();    }}static QTextStream &operator<<(QTextStream &ts, const QRect &r){    return ts << "at (" << r.x() << "," << r.y() << ") size " << r.width() << "x" << r.height();}void RenderObject::dump(QTextStream &ts, const QString &ind) const{    if ( !layer() )        ts << endl;    ts << ind << renderName();    if (style() && style()->zIndex()) {        ts << " zI: " << style()->zIndex();    }    if (element()) {        QString tagName(getTagName(element()->id()));        if (!tagName.isEmpty()) {            ts << " {" << tagName << "}";        }    } else if (isPseudoAnonymous() && style() && style()->styleType() != RenderStyle::NOPSEUDO) {        QString pseudo;        QString tagName(getTagName(node()->id()));        switch (style()->styleType()) {          case RenderStyle::FIRST_LETTER:            pseudo = ":first-letter"; break;          case RenderStyle::BEFORE:            pseudo = ":before"; break;          case RenderStyle::AFTER:            pseudo = ":after"; break;          default:            pseudo = ":pseudo-element";        }        ts << " {" << tagName << pseudo << "}";    }    QRect r(xPos(), yPos(), width(), height());    ts << " " << r;    if ( parent() )        ts << style()->createDiff( *parent()->style() );    if (isAnonymous()) { ts << " anonymousBox"; }    if (isFloating()) { ts << " floating"; }    if (isPositioned()) { ts << " positioned"; }    if (isRelPositioned()) { ts << " relPositioned"; }    if (isText()) { ts << " text"; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -