8

Changeset 3648 – WebKit

 6 months ago
source link: https://trac.webkit.org/changeset/3648/webkit
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Changeset 3648 in webkit

View differences
Show lines around each change
Show the changes in full context
Ignore:
Blank lines
Case changes
White space changes

Timestamp: Feb 14, 2003 11:43:07 AM (21 years ago) Author: hyatt Message:

Make the inline box model live. Borders/backgrounds and text
decorations have been rewritten.

Also fixed a bug with clip rects. They didn't include borders.

Reviewed by kocienda

  • khtml/css/cssstyleselector.cpp:
  • khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall):
  • khtml/rendering/bidi.cpp:
  • khtml/rendering/font.cpp:
  • khtml/rendering/font.h:
  • khtml/rendering/render_block.cpp:
  • khtml/rendering/render_block.h:
  • khtml/rendering/render_box.cpp: (RenderBox::paintBackground): (RenderBox::paintBackgroundExtended): (RenderBox::getClipRect): (RenderBox::position):
  • khtml/rendering/render_box.h:
  • khtml/rendering/render_flow.cpp: (RenderFlow::createInlineBox): (RenderFlow::paintLineBoxBackgroundBorder): (RenderFlow::paintLineBoxDecorations): (RenderFlow::repaint):
  • khtml/rendering/render_flow.h:
  • khtml/rendering/render_inline.cpp: (RenderInline::paintObject): (RenderInline::width): (RenderInline::height): (RenderInline::offsetLeft): (RenderInline::offsetTop): (RenderInline::nodeAtPoint):
  • khtml/rendering/render_inline.h:
  • khtml/rendering/render_line.cpp: (InlineFlowBox::verticallyAlignBoxes): (InlineFlowBox::computeLogicalBoxHeights): (InlineFlowBox::placeBoxesVertically): (InlineFlowBox::shrinkBoxesWithNoTextChildren): (InlineFlowBox::paintBackgroundAndBorder): (shouldDrawDecoration): (InlineFlowBox::paintDecorations):
  • khtml/rendering/render_line.h:
  • khtml/rendering/render_object.cpp: (RenderObject::setStyle): (RenderObject::lineHeight): (RenderObject::getTextDecorationColors):
  • khtml/rendering/render_object.h:
  • khtml/rendering/render_root.cpp: (enclosingPositionedRect):
  • khtml/rendering/render_style.cpp: (StyleVisualData::StyleVisualData): (StyleInheritedData::StyleInheritedData): (StyleInheritedData::operator==): (RenderStyle::diff):
  • khtml/rendering/render_style.h:
  • khtml/rendering/render_table.cpp: (RenderTableCell::repaintRectangle):
  • khtml/rendering/render_text.cpp: (TextRun::paintDecoration): (TextRun::checkSelectionPoint): (RenderText::nodeAtPoint): (RenderText::cursorPos): (RenderText::absolutePosition): (RenderText::paintObject): (RenderText::paint): (RenderText::position):
  • khtml/rendering/render_text.h:
  • kwq/KWQPainter.h:
  • kwq/KWQPainter.mm: (QPainter::drawLineForText):
  • kwq/WebCoreTextRenderer.h:

Location: trunk/WebCore Files:

28 edited

  • TabularUnified trunk/WebCore/ChangeLog-2003-10-25

    r3647 r3648  
    12003-02-14  David Hyatt  <[email protected]>
    2
    3        Make the inline box model live.  Borders/backgrounds and text
    4        decorations have been rewritten.
    5
    6        Also fixed a bug with clip rects.  They didn't include borders.
    7
    8        Reviewed by kocienda
    9
    10        * khtml/css/cssstyleselector.cpp:
    11        * khtml/ecma/kjs_window.cpp:
    12        (WindowFunc::tryCall):
    13        * khtml/rendering/bidi.cpp:
    14        * khtml/rendering/font.cpp:
    15        * khtml/rendering/font.h:
    16        * khtml/rendering/render_block.cpp:
    17        * khtml/rendering/render_block.h:
    18        * khtml/rendering/render_box.cpp:
    19        (RenderBox::paintBackground):
    20        (RenderBox::paintBackgroundExtended):
    21        (RenderBox::getClipRect):
    22        (RenderBox::position):
    23        * khtml/rendering/render_box.h:
    24        * khtml/rendering/render_flow.cpp:
    25        (RenderFlow::createInlineBox):
    26        (RenderFlow::paintLineBoxBackgroundBorder):
    27        (RenderFlow::paintLineBoxDecorations):
    28        (RenderFlow::repaint):
    29        * khtml/rendering/render_flow.h:
    30        * khtml/rendering/render_inline.cpp:
    31        (RenderInline::paintObject):
    32        (RenderInline::width):
    33        (RenderInline::height):
    34        (RenderInline::offsetLeft):
    35        (RenderInline::offsetTop):
    36        (RenderInline::nodeAtPoint):
    37        * khtml/rendering/render_inline.h:
    38        * khtml/rendering/render_line.cpp:
    39        (InlineFlowBox::verticallyAlignBoxes):
    40        (InlineFlowBox::computeLogicalBoxHeights):
    41        (InlineFlowBox::placeBoxesVertically):
    42        (InlineFlowBox::shrinkBoxesWithNoTextChildren):
    43        (InlineFlowBox::paintBackgroundAndBorder):
    44        (shouldDrawDecoration):
    45        (InlineFlowBox::paintDecorations):
    46        * khtml/rendering/render_line.h:
    47        * khtml/rendering/render_object.cpp:
    48        (RenderObject::setStyle):
    49        (RenderObject::lineHeight):
    50        (RenderObject::getTextDecorationColors):
    51        * khtml/rendering/render_object.h:
    52        * khtml/rendering/render_root.cpp:
    53        (enclosingPositionedRect):
    54        * khtml/rendering/render_style.cpp:
    55        (StyleVisualData::StyleVisualData):
    56        (StyleInheritedData::StyleInheritedData):
    57        (StyleInheritedData::operator==):
    58        (RenderStyle::diff):
    59        * khtml/rendering/render_style.h:
    60        * khtml/rendering/render_table.cpp:
    61        (RenderTableCell::repaintRectangle):
    62        * khtml/rendering/render_text.cpp:
    63        (TextRun::paintDecoration):
    64        (TextRun::checkSelectionPoint):
    65        (RenderText::nodeAtPoint):
    66        (RenderText::cursorPos):
    67        (RenderText::absolutePosition):
    68        (RenderText::paintObject):
    69        (RenderText::paint):
    70        (RenderText::position):
    71        * khtml/rendering/render_text.h:
    72        * kwq/KWQPainter.h:
    73        * kwq/KWQPainter.mm:
    74        (QPainter::drawLineForText):
    75        * kwq/WebCoreTextRenderer.h:
    76
    1772003-02-13  Trey Matteson  <[email protected]>
    278
  • TabularUnified trunk/WebCore/ChangeLog-2005-08-23

    r3647 r3648  
    12003-02-14  David Hyatt  <[email protected]>
    2
    3        Make the inline box model live.  Borders/backgrounds and text
    4        decorations have been rewritten.
    5
    6        Also fixed a bug with clip rects.  They didn't include borders.
    7
    8        Reviewed by kocienda
    9
    10        * khtml/css/cssstyleselector.cpp:
    11        * khtml/ecma/kjs_window.cpp:
    12        (WindowFunc::tryCall):
    13        * khtml/rendering/bidi.cpp:
    14        * khtml/rendering/font.cpp:
    15        * khtml/rendering/font.h:
    16        * khtml/rendering/render_block.cpp:
    17        * khtml/rendering/render_block.h:
    18        * khtml/rendering/render_box.cpp:
    19        (RenderBox::paintBackground):
    20        (RenderBox::paintBackgroundExtended):
    21        (RenderBox::getClipRect):
    22        (RenderBox::position):
    23        * khtml/rendering/render_box.h:
    24        * khtml/rendering/render_flow.cpp:
    25        (RenderFlow::createInlineBox):
    26        (RenderFlow::paintLineBoxBackgroundBorder):
    27        (RenderFlow::paintLineBoxDecorations):
    28        (RenderFlow::repaint):
    29        * khtml/rendering/render_flow.h:
    30        * khtml/rendering/render_inline.cpp:
    31        (RenderInline::paintObject):
    32        (RenderInline::width):
    33        (RenderInline::height):
    34        (RenderInline::offsetLeft):
    35        (RenderInline::offsetTop):
    36        (RenderInline::nodeAtPoint):
    37        * khtml/rendering/render_inline.h:
    38        * khtml/rendering/render_line.cpp:
    39        (InlineFlowBox::verticallyAlignBoxes):
    40        (InlineFlowBox::computeLogicalBoxHeights):
    41        (InlineFlowBox::placeBoxesVertically):
    42        (InlineFlowBox::shrinkBoxesWithNoTextChildren):
    43        (InlineFlowBox::paintBackgroundAndBorder):
    44        (shouldDrawDecoration):
    45        (InlineFlowBox::paintDecorations):
    46        * khtml/rendering/render_line.h:
    47        * khtml/rendering/render_object.cpp:
    48        (RenderObject::setStyle):
    49        (RenderObject::lineHeight):
    50        (RenderObject::getTextDecorationColors):
    51        * khtml/rendering/render_object.h:
    52        * khtml/rendering/render_root.cpp:
    53        (enclosingPositionedRect):
    54        * khtml/rendering/render_style.cpp:
    55        (StyleVisualData::StyleVisualData):
    56        (StyleInheritedData::StyleInheritedData):
    57        (StyleInheritedData::operator==):
    58        (RenderStyle::diff):
    59        * khtml/rendering/render_style.h:
    60        * khtml/rendering/render_table.cpp:
    61        (RenderTableCell::repaintRectangle):
    62        * khtml/rendering/render_text.cpp:
    63        (TextRun::paintDecoration):
    64        (TextRun::checkSelectionPoint):
    65        (RenderText::nodeAtPoint):
    66        (RenderText::cursorPos):
    67        (RenderText::absolutePosition):
    68        (RenderText::paintObject):
    69        (RenderText::paint):
    70        (RenderText::position):
    71        * khtml/rendering/render_text.h:
    72        * kwq/KWQPainter.h:
    73        * kwq/KWQPainter.mm:
    74        (QPainter::drawLineForText):
    75        * kwq/WebCoreTextRenderer.h:
    76
    1772003-02-13  Trey Matteson  <[email protected]>
    278
  • TabularUnified trunk/WebCore/khtml/css/cssstyleselector.cpp

    r3548 r3648  
    19051905        case CSS_PROP_COLOR:
    19061906            style->setColor(col); break;
    1907        case CSS_PROP_TEXT_DECORATION_COLOR:
    1908            style->setTextDecorationColor(col); break;
    19091907        case CSS_PROP_OUTLINE_COLOR:
    19101908            style->setOutlineColor(col); break;
     
    26602658        {
    26612659            if(!parentNode) return;
    2662            style->setTextDecoration(parentStyle->textDecoration());
    2663            style->setTextDecorationColor(parentStyle->textDecorationColor());
    2660            style->addToTextDecorationsInEffect(parentStyle->textDecorationsInEffect());
    2661            style->setTextDecoration(parentStyle->textDecorationsInEffect());
    26642662            return;
    26652663        }
     
    26932691            }
    26942692        }
    2695        style->setTextDecoration(t);
    2696        style->setTextDecorationColor(style->color());
    2697        break;
    2693
    2694        style->addToTextDecorationsInEffect(t);
    2695        style->setTextDecoration(t);
    2696        break;
    26982697    }
    26992698    case CSS_PROP__KONQ_FLOW_MODE:
  • TabularUnified trunk/WebCore/khtml/ecma/kjs_window.cpp

    r3646 r3648  
    14451445        if (listener) {
    14461446            DOM::Document doc = part->document();
    1447            if (doc.isHTMLDocument()) {
    1448                DOM::HTMLDocument htmlDoc = doc;
    1449                htmlDoc.body().addEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
    1450            }
    1451            else
    1452                doc.addEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
    1447            doc.addEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
    14531448        }
    14541449        return Undefined();
     
    14601455        if (listener) {
    14611456            DOM::Document doc = part->document();
    1462            if (doc.isHTMLDocument()) {
    1463                DOM::HTMLDocument htmlDoc = doc;
    1464                htmlDoc.body().removeEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));       
    1465            }
    1466            else
    1467                doc.removeEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
    1457            doc.removeEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
    14681458        }
    14691459        return Undefined();
  • TabularUnified trunk/WebCore/khtml/rendering/bidi.cpp

    r3627 r3648  
    667667    lineBox->verticallyAlignBoxes(m_height);
    668668
    669    // See if the line spilled out.  If so set overflow height accordingly.
    670    int bottomOfLine = lineBox->bottomOverflow();
    671    if (bottomOfLine > m_height && bottomOfLine > m_overflowHeight)
    672        m_overflowHeight = bottomOfLine;
    673
    669674    // Now make sure we place replaced render objects correctly.
    670675    BidiRun* r = runs.first();
    671676    while (r) {
    672        r->obj->position(r->box, r->box->yPos(), r->start, r->stop - r->start, r->level%2);
    677        r->obj->position(r->box, r->start, r->stop - r->start, r->level%2);
    673678        r = runs.next();
    674679    }   
     
    12501255                    adjustEmbeddding = false;
    12511256                }
    1252   
    1257
    1258                m_firstLine = false;
    12531259                newLine();
    12541260            }
    1255            m_firstLine = false;
    12561261            deleteMidpoints(renderArena(), smidpoints);
    12571262        }
     
    12691274
    12701275    // Always make sure this is at least our height.
    1271    m_overflowHeight = m_height;
    1276    if (m_overflowHeight < m_height)
    1277        m_overflowHeight = m_height;
    12721278   
    12731279#if BIDI_DEBUG > 1
  • TabularUnified trunk/WebCore/khtml/rendering/font.cpp

    r3455 r3648  
    3939
    4040using namespace khtml;
    41
    42#if APPLE_CHANGES
    43void Font::drawLineForText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len,
    44                     int toAdd, int yOffset, QPainter::TextDirection d, int from, int to) const
    45{
    46    p->drawLineForText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, yOffset, d, letterSpacing, wordSpacing);
    47}
    48#endif
    4941
    5042void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len,
  • TabularUnified trunk/WebCore/khtml/rendering/font.h

    r3465 r3648  
    102102
    103103#if APPLE_CHANGES
    104    void drawLineForText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int toAdd, int yOffset,
    105                          QPainter::TextDirection d, int from=-1, int to=-1) const;
    106104    float floatWidth( QChar *str, int slen, int pos, int len ) const;
    107105    void floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, float *buffer) const;
  • TabularUnified trunk/WebCore/khtml/rendering/render_block.cpp

    r3627 r3648  
    10311031    if (!overhangingContents() && !isRelPositioned() && !isPositioned() )
    10321032    {
    1033        int h = m_height;
    1034        if(m_specialObjects && floatBottom() > h) h = floatBottom();
    1035        if((_ty > _y + _h) || (_ty + h < _y))
    1036        {
    1037            //kdDebug( 6040 ) << "cut!" << endl;
    1033        int h = m_overflowHeight;
    1034        int yPos = _ty;
    1035        if (m_specialObjects && floatBottom() > h)
    1036            h = floatBottom();
    1037
    1038        // Sanity check the first line
    1039        // to see if it extended a little above our box. Overflow out the bottom is already handled via
    1040        // overflowHeight(), so we don't need to check that.
    1041        if (m_firstLineBox && m_firstLineBox->topOverflow() < 0)
    1042            yPos += m_firstLineBox->topOverflow();
    1043       
    1044        if( (yPos > _y + _h) || (_ty + h < _y))
    10381045            return;
    1039        }
    10401046    }
    10411047
     
    10601066
    10611067    // 2. paint contents
    1068    paintLineBoxBackgroundBorder(p, _x, _y, _w, _h, _tx, _ty, paintAction);
    10621069    RenderObject *child = firstChild();
    10631070    while(child != 0)
     
    10671074        child = child->nextSibling();
    10681075    }
    1069
    1076    paintLineBoxDecorations(p, _x, _y, _w, _h, _tx, _ty, paintAction);
    1077   
    10701078    // 3. paint floats.
    10711079    if (!inlineRunIn && (paintAction == PaintActionFloat || paintAction == PaintActionSelection))
  • TabularUnified trunk/WebCore/khtml/rendering/render_block.h

    r3627 r3648  
    9595    BidiIterator findNextLineBreak(BidiIterator &start, QPtrList<BidiIterator>& midpoints);
    9696    InlineFlowBox* constructLine(QPtrList<BidiRun>& runs, const BidiIterator& start,
    97                             const BidiIterator& end);
    97                             const BidiIterator& end);
    9898    InlineFlowBox* createLineBoxes(RenderObject* obj);
    9999    void computeHorizontalPositionsForLine(InlineFlowBox* lineBox, QPtrList<BidiRun>& runs,
  • TabularUnified trunk/WebCore/khtml/rendering/render_box.cpp

    r3627 r3648  
    199199void RenderBox::paintBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int height)
    200200{
    201    paintBackgroundExtended(p, c, bg, clipy, cliph, _tx, _ty, w, height,
    202                            borderLeft(), borderRight());
    203}
    204
    205void RenderBox::paintBackgroundExtended(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph,
    206                                        int _tx, int _ty, int w, int h,
    207                                        int bleft, int bright)
    208{
    201209    if(c.isValid())
    202210        p->fillRect(_tx, clipy, w, cliph, c);
     
    216224            int cw,ch;
    217225        int cx,cy;
    218        int vpab = borderRight() + borderLeft();
    226        int vpab = bleft + bright;
    219227        int hpab = borderTop() + borderBottom();
    220
    228       
    221229        // CSS2 chapter 14.2.1
    222230
     
    224232        {
    225233            //scroll
    226            int pw = m_width - vpab;
    227            int h = isHtml() ? height : m_height;
    228            if (isTableCell()) {
    229                // Table cells' m_height variable is wrong.  You have to take into
    230                // account this hack extra stuff to get the right height.
    231                // Otherwise using background-position: bottom won't work in
    232                // a table cell that has the extra height. -dwh
    233                RenderTableCell* tableCell = static_cast<RenderTableCell*>(this);
    234                h += tableCell->borderTopExtra() + tableCell->borderBottomExtra();
    235            }
    234            int pw = w - vpab;
    236235            int ph = h - hpab;
    237236           
     
    263262            }
    264263
    265            cx += borderLeft();
    264            cx += bleft;
    266265
    267266            if( (bgr == NO_REPEAT || bgr == REPEAT_X) && h > pixh ) {
     
    314313            }
    315314
    316            if( (bgr == NO_REPEAT || bgr == REPEAT_X) && height > pixh ) {
    315            if( (bgr == NO_REPEAT || bgr == REPEAT_X) && h > pixh ) {
    317316                ch = pixh;
    318317                cy = vr.y() + sptr->backgroundYPosition().minWidth(ph-pixh);
     
    328327
    329328            QRect fix(cx,cy,cw,ch);
    330            QRect ele(_tx+borderLeft(),_ty+borderTop(),w-vpab,height-hpab);
    329            QRect ele(_tx+bleft,_ty+borderTop(),w-vpab,h-hpab);
    331330            QRect b = fix.intersect(ele);
    332331            sx+=b.x()-cx;
     
    365364QRect RenderBox::getClipRect(int tx, int ty)
    366365{
    367    int bl=borderLeft(),bt=borderTop(),bb=borderBottom(),br=borderRight();
    368    int clipx = tx+bl;
    369    int clipy = ty+bt;
    370    int clipw = m_width-bl-br;
    371    int cliph = m_height-bt-bb;
    366    int clipx = tx;
    367    int clipy = ty;
    368    int clipw = m_width;
    369    int cliph = m_height;
    372370
    373371    if (!style()->clipLeft().isVariable())
    374372    {
    375        int c=style()->clipLeft().width(m_width-bl-br);
    373        int c=style()->clipLeft().width(m_width);
    376374        clipx+=c;
    377375        clipw-=c;
     
    380378    if (!style()->clipRight().isVariable())
    381379    {
    382        int w = style()->clipRight().width(m_width-bl-br);
    383        clipw -= m_width - bl - br - w;
    380        int w = style()->clipRight().width(m_width);
    381        clipw -= m_width - w;
    384382    }
    385383   
    386384    if (!style()->clipTop().isVariable())
    387385    {
    388        int c=style()->clipTop().width(m_height-bt-bb);
    386        int c=style()->clipTop().width(m_height);
    389387        clipy+=c;
    390388        cliph-=c;
     
    392390    if (!style()->clipBottom().isVariable())
    393391    {
    394        int h = style()->clipBottom().width(m_height-bt-bb);
    395        cliph -= m_height - bt - bb - h;
    392        int h = style()->clipBottom().width(m_height);
    393        cliph -= m_height - h;
    396394    }
    397395    //kdDebug( 6040 ) << "setting clip("<<clipx<<","<<clipy<<","<<clipw<<","<<cliph<<")"<<endl;
     
    438436}
    439437
    440void RenderBox::position(InlineBox* box, int y, int from, int len, bool reverse)
    438void RenderBox::position(InlineBox* box, int from, int len, bool reverse)
    441439{
    442440    m_x = box->xPos();
    443    m_y = y + marginTop();
    441    m_y = box->yPos();
    444442}
    445443
  • TabularUnified trunk/WebCore/khtml/rendering/render_box.h

    r3627 r3648  
    8484    void calcHorizontalMargins(const Length& ml, const Length& mr, int cw);
    8585
    86    virtual void position(InlineBox* box, int y, int from, int len, bool reverse);
    86    virtual void position(InlineBox* box, int from, int len, bool reverse);
    8787   
    8888    virtual int lowestPosition() const;
     
    112112
    113113    virtual RenderLayer* layer() const { return m_layer; }
    114
    115    virtual void paintBackgroundExtended(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph,
    116                                         int _tx, int _ty, int w, int height,
    117                                         int bleft, int bright);
    114118   
    115119protected:
  • TabularUnified trunk/WebCore/khtml/rendering/render_flow.cpp

    r3627 r3648  
    154154InlineBox* RenderFlow::createInlineBox()
    155155{
    156    InlineFlowBox* flowBox = new (renderArena()) InlineFlowBox(this);
    156    InlineFlowBox* flowBox = 0;
    157    if (isInlineFlow())
    158        flowBox = new (renderArena()) InlineFlowBox(this);
    159    else
    160        flowBox = new (renderArena()) RootInlineBox(this);
    161   
    157162    if (!m_firstLineBox)
    158163        m_firstLineBox = m_lastLineBox = flowBox;
     
    166171}
    167172
    173void RenderFlow::paintLineBoxBackgroundBorder(QPainter *p, int _x, int _y,
    174                                int _w, int _h, int _tx, int _ty, PaintAction paintAction)
    175{
    176    if (!firstLineBox())
    177        return;
    178
    179    if (style()->visibility() == VISIBLE && paintAction == PaintActionForeground) {
    180        // We can check the first box and last box and avoid painting if we don't
    181        // intersect.
    182        int yPos = _ty + firstLineBox()->yPos();
    183        int h = lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
    184        if( (yPos > _y + _h) || (yPos + h < _y))
    185            return;
    186
    187        // See if our boxes intersect with the dirty rect.  If so, then we paint
    188        // them.  Note that boxes can easily overlap, so we can't make any assumptions
    189        // based off positions of our first line box or our last line box.
    190        int xOffsetWithinLineBoxes = 0;
    191        for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
    192            yPos = _ty + curr->yPos();
    193            h = curr->height();
    194            if ((yPos <= _y + _h) && (yPos + h >= _y))
    195                curr->paintBackgroundAndBorder(p, _x, _y, _w, _h, _tx, _ty, xOffsetWithinLineBoxes);
    196            xOffsetWithinLineBoxes += curr->width();
    197        }
    198    }
    199}
    200
    201void RenderFlow::paintLineBoxDecorations(QPainter *p, int _x, int _y,
    202                                         int _w, int _h, int _tx, int _ty, PaintAction paintAction)
    203{
    204    if (!firstLineBox())
    205        return;
    206
    207    if (style()->visibility() == VISIBLE && paintAction == PaintActionForeground) {
    208        // We only paint line box decorations in strict or almost strict mode.
    209        // Otherwise we let the TextRuns paint their own decorations.
    210        RenderObject* curr = this;
    211        while (curr && !curr->element())
    212            curr = curr->container();
    213        bool quirksMode = (curr && curr->element()->getDocument()->inQuirksMode());
    214        if (quirksMode)
    215            return;
    216
    217        // We can check the first box and last box and avoid painting if we don't
    218        // intersect.
    219        int yPos = _ty + firstLineBox()->yPos();;
    220        int h = lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
    221        if( (yPos > _y + _h) || (yPos + h < _y))
    222            return;
    223
    224        // See if our boxes intersect with the dirty rect.  If so, then we paint
    225        // them.  Note that boxes can easily overlap, so we can't make any assumptions
    226        // based off positions of our first line box or our last line box.
    227        for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
    228            yPos = _ty + curr->yPos();
    229            h = curr->height();
    230            if ((yPos <= _y + _h) && (yPos + h >= _y))
    231                curr->paintDecorations(p, _x, _y, _w, _h, _tx, _ty);
    232        }
    233    }
    234}
    235
    236void RenderFlow::repaint(bool immediate)
    237{
    238    if (isInlineFlow()) {
    239        // Find our leftmost position.
    240        int left = 0;
    241        int top = firstLineBox() ? firstLineBox()->yPos() : 0;
    242        for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
    243            if (curr == firstLineBox() || curr->xPos() < left)
    244                left = curr->xPos();
    245
    246        // Now invalidate a rectangle.
    247        int ow = style() ? style()->outlineWidth() : 0;
    248        containingBlock()->repaintRectangle(-ow+left, -ow+top,
    249                                            width()+ow*2, height()+ow*2, immediate);
    250    }
    251    else {
    252        if (firstLineBox() && firstLineBox()->topOverflow() < 0) {
    253            int ow = style() ? style()->outlineWidth() : 0;
    254            repaintRectangle(-ow, -ow+firstLineBox()->topOverflow(),
    255                             overflowWidth()+ow*2, overflowHeight()+ow*2, immediate);
    256        }
    257        else
    258            return RenderBox::repaint();
    259    }
    260}
    261
  • TabularUnified trunk/WebCore/khtml/rendering/render_flow.h

    r3627 r3648  
    6060    virtual void detach(RenderArena* arena);
    6161
    62    InlineFlowBox* firstLineBox() { return m_firstLineBox; }
    63    InlineFlowBox* lastLineBox() { return m_lastLineBox; }
    62    InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
    63    InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
    6464
    6565    virtual InlineBox* createInlineBox();
    66
    67    void paintLineBoxBackgroundBorder(QPainter *p, int _x, int _y,
    68                        int _w, int _h, int _tx, int _ty, PaintAction paintAction);
    69    void paintLineBoxDecorations(QPainter *p, int _x, int _y,
    70                                 int _w, int _h, int _tx, int _ty, PaintAction paintAction);
    71
    72    virtual void repaint(bool immediate = false);
    6673   
    6774protected:
  • TabularUnified trunk/WebCore/khtml/rendering/render_inline.cpp

    r3627 r3648  
    2525#include "render_inline.h"
    2626#include "render_block.h"
    27#include "xml/dom_nodeimpl.h"
    2728
    2829using namespace khtml;
     
    244245                             int _w, int _h, int _tx, int _ty, PaintAction paintAction)
    245246{
    246
    247247#ifdef DEBUG_LAYOUT
    248248    //    kdDebug( 6040 ) << renderName() << "(RenderInline) " << this << " ::paintObject() w/h = (" << width() << "/" << height() << ")" << endl;
    249249#endif
    250250
    251    // FIXME: This function will eventually get much more complicated. :) - dwh
    252    // paint contents
    251    paintLineBoxBackgroundBorder(p, _x, _y, _w, _h, _tx, _ty, paintAction);
    252   
    253253    RenderObject *child = firstChild();
    254254    while(child != 0)
     
    258258        child = child->nextSibling();
    259259    }
    260
    261    paintLineBoxDecorations(p, _x, _y, _w, _h, _tx, _ty, paintAction);
    260262}
    261263
     
    275277}
    276278
    277short RenderInline::offsetWidth() const
    278{
    279    short w = 0;
    280    RenderObject* object = firstChild();
    281    while (object) {
    282        w += object->offsetWidth();
    283        object = object->nextSibling();
    284    }
    285    return w;
    286}
    287
    288int RenderInline::offsetHeight() const
    289{
    290    if (firstChild())
    291        return firstChild()->offsetHeight();
    292    return height();
    279short RenderInline::width() const
    280{
    281    // Return the width of the minimal left side and the maximal right side.
    282    short leftSide = 0;
    283    short rightSide = 0;
    284    for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
    285        if (curr == firstLineBox() || curr->xPos() < leftSide)
    286            leftSide = curr->xPos();
    287        if (curr == firstLineBox() || curr->xPos() + curr->width() > rightSide)
    288            rightSide = curr->xPos() + curr->width();
    289    }
    290   
    291    return rightSide - leftSide;
    292}
    293
    294int RenderInline::height() const
    295{
    296    int h = 0;
    297    if (firstLineBox())
    298        h = lastLineBox()->yPos() + lastLineBox()->height() - firstLineBox()->yPos();
    299    return h;
    293300}
    294301
     
    296303{
    297304    int x = RenderFlow::offsetLeft();
    298    RenderObject* textChild = (RenderObject*)this;
    299    while (textChild && textChild->isInline() && !textChild->isText())
    300        textChild = textChild->firstChild();
    301    if (textChild && textChild != this)
    302        x += textChild->xPos() - textChild->borderLeft() - textChild->paddingLeft();
    305    if (firstLineBox())
    306        x += firstLineBox()->xPos();
    303307    return x;
    304308}
     
    306310int RenderInline::offsetTop() const
    307311{
    308    RenderObject* textChild = (RenderObject*)this;
    309    while (textChild && textChild->isInline() && !textChild->isText())
    310        textChild = textChild->firstChild();
    311312    int y = RenderFlow::offsetTop();
    312    if (textChild && textChild != this)
    313        y += textChild->yPos() - textChild->borderTop() - textChild->paddingTop();
    313    if (firstLineBox())
    314        y += firstLineBox()->yPos();
    314315    return y;
    315316}
     
    323324    return "RenderInline";
    324325}
    326
    327bool RenderInline::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, bool inside)
    328{
    329    // Always check our kids.
    330    for (RenderObject* child = lastChild(); child; child = child->previousSibling())
    331        if (!child->layer() && child->nodeAtPoint(info, _x, _y, _tx, _ty))
    332            inside = true;
    333
    334    // Check our line boxes if we're still not inside.
    335    if (!inside && style()->visibility() != HIDDEN) {
    336        // See if we're inside one of our line boxes.
    337        for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
    338            if((_y >=_ty + curr->m_y) && (_y < _ty + curr->m_y + curr->m_height) &&
    339               (_x >= _tx + curr->m_x) && (_x <_tx + curr->m_x + curr->m_width) ) {
    340                inside = true;
    341                break;
    342            }
    343        }
    344    }
    345
    346    if (inside && element()) {
    347        if (info.innerNode() && info.innerNode()->renderer() &&
    348            !info.innerNode()->renderer()->isInline()) {
    349            // Within the same layer, inlines are ALWAYS fully above blocks.  Change inner node.
    350            info.setInnerNode(element());
    351
    352            // Clear everything else.
    353            info.setInnerNonSharedNode(0);
    354            info.setURLElement(0);
    355        }
    356
    357        if (!info.innerNode())
    358            info.setInnerNode(element());
    359
    360        if(!info.innerNonSharedNode())
    361            info.setInnerNonSharedNode(element());
    362
    363        if (!info.URLElement()) {
    364            RenderObject* p = this;
    365            while (p) {
    366                if (p->element() && p->element()->hasAnchor()) {
    367                    info.setURLElement(p->element());
    368                    break;
    369                }
    370                if (!isSpecial()) break;
    371                p = p->parent();
    372            }
    373        }
    374
    375    }
    376
    377    if (!info.readonly()) {
    378        // lets see if we need a new style
    379        bool oldinside = mouseInside();
    380        setMouseInside(inside);
    381
    382        setHoverAndActive(info, oldinside, inside);
    383        if (!isInline() && continuation())
    384            continuation()->setHoverAndActive(info, oldinside, inside);
    385    }
    386
    387    return inside;
    388}
    389
  • TabularUnified trunk/WebCore/khtml/rendering/render_inline.h

    r3627 r3648  
    5454                             int tx, int ty, PaintAction paintAction);
    5555
    56    virtual bool nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, bool inside);
    57
    5658    virtual void calcMinMaxWidth();
    5759
     
    5961    virtual bool requiresLayer() { return isRelPositioned(); }
    6062
    63    virtual short width() const;
    64    virtual int height() const;
    65
    6166    // used to calculate offsetWidth/Height.  Overridden by inlines (render_flow) to return
    6267    // the remaining width on a given line (and the height of a single line).
    63    virtual short offsetWidth() const;
    64    virtual int offsetHeight() const;
    6568    virtual int offsetLeft() const;
    6669    virtual int offsetTop() const;
  • TabularUnified trunk/WebCore/khtml/rendering/render_line.cpp

    r3627 r3648  
    273273
    274274    int maxHeight = maxAscent + maxDescent;
    275    placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode);
    275    int topPosition = heightOfBlock;
    276    int bottomPosition = heightOfBlock;
    277    placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, topPosition, bottomPosition);
    278
    279    setOverflowPositions(topPosition, bottomPosition);
    280
    281    // Shrink boxes with no text children in quirks and almost strict mode.
    282    if (!strictMode)
    283        shrinkBoxesWithNoTextChildren(topPosition, bottomPosition);
    284   
    276285    heightOfBlock += maxHeight;
    277286}
     
    305314                                             int& maxAscent, int& maxDescent, bool strictMode)
    306315{
    307    if (!parent()) {
    316    if (isRootInlineBox()) {
    308317        // Examine our root box.
    309318        setHeight(object()->lineHeight(m_firstLine));
     
    351360}
    352361
    353void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode)
    354{
    355    if (!parent()) {
    356        if (hasTextChildren() || strictMode)
    357            setYPos(y + maxAscent - baseline());// Place our root box.
    358        // FIXME: Use the tallest y/height out of our children.
    359    }
    362void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode,
    363                                         int& topPosition, int& bottomPosition)
    364{
    365    if (isRootInlineBox())
    366        setYPos(y + maxAscent - baseline());// Place our root box.
    360367   
    361368    for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
    369        // Adjust boxes to use their real box y/height and not the logical height (as dictated by
    370        // line-height).
    371        if (curr->isInlineFlowBox())
    372            static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode,
    373                                                                    topPosition, bottomPosition);
    374
    375        bool childAffectsTopBottomPos = true;
    362376        if (curr->yPos() == PositionTop)
    363377            curr->setYPos(y);
    364378        else if (curr->yPos() == PositionBottom)
    365379            curr->setYPos(y + maxHeight - curr->height());
    366        else if (curr->hasTextChildren() || strictMode)
    367            // FIXME: Use the tallest y/height out of our children.
    380        else {
    381            if (!curr->hasTextChildren() && !strictMode)
    382                childAffectsTopBottomPos = false;
    368383            curr->setYPos(curr->yPos() + y + maxAscent - curr->baseline());
    369
    370        // FIXME: Adjust the y position and heights of replaced elements for margins.
    371        // Adjust inline flows to use the font box height and not the logical height.
    384        }
    385       
    386        int newY = curr->yPos();
    387        int newHeight = curr->height();
    388        int newBaseline = curr->baseline();
    389        if (curr->isTextRun() || curr->isInlineFlowBox()) {
    390            const QFontMetrics &fm = curr->object()->fontMetrics( m_firstLine );
    391            newBaseline = fm.ascent();
    392            newY += curr->baseline() - newBaseline;
    393            newHeight = newBaseline+fm.descent();
    394            if (curr->isInlineFlowBox()) {
    395                newHeight += curr->object()->borderTop() + curr->object()->paddingTop() +
    396                            curr->object()->borderBottom() + curr->object()->paddingBottom();
    397                newY -= curr->object()->borderTop() + curr->object()->paddingTop();
    398                newBaseline += curr->object()->borderTop() + curr->object()->paddingTop();
    399            }   
    400        }
    401        else {
    402            newY += curr->object()->marginTop();
    403            newHeight = curr->height() - (curr->object()->marginTop() + curr->object()->marginBottom());
    404        }
    405
    406        curr->setYPos(newY);
    407        curr->setHeight(newHeight);
    408        curr->setBaseline(newBaseline);
    409
    410        if (childAffectsTopBottomPos) {
    411            if (newY < topPosition)
    412                topPosition = newY;
    413            if (newY + newHeight > bottomPosition)
    414                bottomPosition = newY + newHeight;
    415        }
    416    }
    417
    418    if (isRootInlineBox()) {
    419        const QFontMetrics &fm = object()->fontMetrics( m_firstLine );
    420        setHeight(fm.ascent()+fm.descent());
    421        setYPos(yPos() + baseline() - fm.ascent());
    422        setBaseline(fm.ascent());
    423        if (hasTextChildren() || strictMode) {
    424            if (yPos() < topPosition)
    425                topPosition = yPos();
    426            if (yPos() + height() > bottomPosition)
    427                bottomPosition = yPos() + height();
    428        }
    429    }
    430}
    431
    432void InlineFlowBox::shrinkBoxesWithNoTextChildren(int topPos, int bottomPos)
    433{
    434    // First shrink our kids.
    435    for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
    372436        if (curr->isInlineFlowBox())
    373            static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent,
    374                                                                    strictMode);
    375    }
    376}
    377
    378
    437            static_cast<InlineFlowBox*>(curr)->shrinkBoxesWithNoTextChildren(topPos, bottomPos);
    438    }
    439
    440    // See if we have text children. If not, then we need to shrink ourselves to fit on the line.
    441    if (!hasTextChildren()) {
    442        if (yPos() < topPos)
    443            setYPos(topPos);
    444        if (height() > bottomPos - topPos)
    445            setHeight(bottomPos - topPos);
    446        if (baseline() > height())
    447            setBaseline(height());
    448    }
    449}
    450
    451void InlineFlowBox::paintBackgroundAndBorder(QPainter *p, int _x, int _y,
    452                                             int _w, int _h, int _tx, int _ty, int xOffsetOnLine)
    453{
    454    // Move x/y to our coordinates.
    455    _tx += m_x;
    456    _ty += m_y;
    457   
    458    int w = width();
    459    int h = height();
    460
    461    int my = QMAX(_ty,_y);
    462    int mh;
    463    if (_ty<_y)
    464        mh= QMAX(0,h-(_y-_ty));
    465    else
    466        mh = QMIN(_h,h);
    467
    468    // You can use p::first-line to specify a background. If so, the root line boxes for
    469    // a line may actually have to paint a background.
    470    RenderStyle* styleToUse = object()->style(m_firstLine);
    471    if (object()->hasFirstLine() || (parent() && object()->shouldPaintBackgroundOrBorder())) {
    472        CachedImage* bg = styleToUse->backgroundImage();
    473        bool hasBackgroundImage = bg && (bg->pixmap_size() == bg->valid_rect().size()) &&
    474                                  !bg->isTransparent() && !bg->isErrorImage();
    475        if (!hasBackgroundImage || (!prevLineBox() && !nextLineBox()) || !parent())
    476            object()->paintBackgroundExtended(p, styleToUse->backgroundColor(),
    477                                              bg, my, mh, _tx, _ty, w, h,
    478                                              borderLeft(), borderRight());
    479        else {
    480            // We have a background image that spans multiple lines.
    481            // We need to adjust _tx and _ty by the width of all previous lines.
    482            // Think of background painting on inlines as though you had one long line, a single continuous
    483            // strip.  Even though that strip has been broken up across multiple lines, you still paint it
    484            // as though you had one single line.  This means each line has to pick up the background where
    485            // the previous line left off.
    486            int startX = _tx - xOffsetOnLine;
    487            int totalWidth = xOffsetOnLine;
    488            for (InlineRunBox* curr = this; curr; curr = curr->nextLineBox())
    489                totalWidth += curr->width();
    490            QRect clipRect(_tx, _ty, width(), height());
    491            clipRect = p->xForm(clipRect);
    492            p->save();
    493            p->addClip(clipRect);
    494            object()->paintBackgroundExtended(p, object()->style()->backgroundColor(),
    495                                              object()->style()->backgroundImage(), my, mh, startX, _ty,
    496                                              totalWidth, h,
    497                                              borderLeft(), borderRight());
    498            p->restore();
    499        }
    500
    501        // :first-line cannot be used to put borders on a line. Always paint borders with our
    502        // non-first-line style.
    503        if (parent() && object()->style()->hasBorder())
    504            object()->paintBorder(p, _tx, _ty, w, h, object()->style(), includeLeftEdge(), includeRightEdge());
    505    }
    506}
    507
    508static bool shouldDrawDecoration(RenderObject* obj)
    509{
    510    bool shouldDraw = false;
    511    for (RenderObject* curr = obj->firstChild();
    512         curr; curr = curr->nextSibling()) {
    513        if (curr->isInlineFlow() || curr->isText()) {
    514            shouldDraw = true;
    515            break;
    516        }
    517    }
    518    return shouldDraw;
    519}
    520
    521void InlineFlowBox::paintDecorations(QPainter *p, int _x, int _y,
    522                                     int _w, int _h, int _tx, int _ty)
    523{
    524    // Now paint our text decorations. We only do this if we aren't in quirks mode (i.e., in
    525    // almost-strict mode or strict mode).
    526    _tx += m_x;
    527    _ty += m_y;
    528    RenderStyle* styleToUse = object()->style(m_firstLine);
    529    int deco = parent() ? styleToUse->textDecoration() : styleToUse->textDecorationsInEffect();
    530    if (deco != TDNONE && shouldDrawDecoration(object())) {
    531        // We must have child boxes and have decorations defined.
    532        _tx += borderLeft() + paddingLeft();
    533        int w = m_width - (borderLeft() + paddingLeft() + borderRight() + paddingRight());
    534        QColor underline, overline, linethrough;
    535        underline = overline = linethrough = styleToUse->color();
    536        if (!parent())
    537            object()->getTextDecorationColors(deco, underline, overline, linethrough);
    538        if (deco & UNDERLINE) {
    539            p->setPen(underline);
    540            p->drawLineForText(_tx, _ty, m_baseline, w);
    541        }
    542        if (deco & OVERLINE) {
    543            p->setPen(overline);
    544            p->drawLineForText(_tx, _ty, 0, w);
    545        }
    546        if (deco & LINE_THROUGH) {
    547            p->setPen(linethrough);
    548            p->drawLineForText(_tx, _ty, 2*m_baseline/3, w);
    549        }
    550    }
    551}
  • TabularUnified trunk/WebCore/khtml/rendering/render_line.h

    r3627 r3648  
    6060    virtual bool isContainer() { return false; }
    6161    virtual bool isTextRun() { return false; }
    62    virtual bool isRootInlineBox() { return false; }
    6263   
    6364    bool isConstructed() { return m_constructed; }
     
    9394
    9495    virtual bool hasTextChildren() { return true; }
    96
    97    virtual int topOverflow() { return yPos(); }
    98    virtual int bottomOverflow() { return yPos()+height(); }
    9599   
    96100public: // FIXME: Would like to make this protected, but methods are accessing these
     
    127131    void setNextLineBox(InlineRunBox* n) { m_nextLine = n; }
    128132    void setPreviousLineBox(InlineRunBox* p) { m_prevLine = p; }
    133
    134    virtual void paintBackgroundAndBorder(QPainter *p, int _x, int _y,
    135                       int _w, int _h, int _tx, int _ty, int xOffsetOnLine) {};
    136    virtual void paintDecorations(QPainter *p, int _x, int _y,
    137                       int _w, int _h, int _tx, int _ty) {};
    129138   
    130139protected:
     
    169178    }
    170179
    180    virtual void paintBackgroundAndBorder(QPainter *p, int _x, int _y,
    181                       int _w, int _h, int _tx, int _ty, int xOffsetOnLine);
    182    virtual void paintDecorations(QPainter *p, int _x, int _y,
    183                       int _w, int _h, int _tx, int _ty);
    184
    171185    int marginBorderPaddingLeft();
    172186    int marginBorderPaddingRight();
     
    185199    }
    186200    virtual bool hasTextChildren() { return m_hasTextChildren; }
    187   
    201
    188202    // Helper functions used during line construction and placement.
    189203    void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject);
     
    198212    void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
    199213                                   int maxPositionTop, int maxPositionBottom);
    200    void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode);
    214    void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode,
    215                              int& topPosition, int& bottomPosition);
    216    void shrinkBoxesWithNoTextChildren(int topPosition, int bottomPosition);
    217   
    218    virtual void setOverflowPositions(int top, int bottom) {}
    201219   
    202220protected:
     
    208226};
    209227
    228class RootInlineBox : public InlineFlowBox
    229{
    230public:
    231    RootInlineBox(RenderObject* obj)
    232    :InlineFlowBox(obj)
    233    {
    234        m_topOverflow = m_bottomOverflow = 0;
    235    }
    236
    237    virtual bool isRootInlineBox() { return true; }
    238    virtual int topOverflow() { return m_topOverflow; }
    239    virtual int bottomOverflow() { return m_bottomOverflow; }
    240    virtual void setOverflowPositions(int top, int bottom) { m_topOverflow = top; m_bottomOverflow = bottom; }
    241
    242protected:
    243    int m_topOverflow;
    244    int m_bottomOverflow;
    245};
    246
    210247}; //namespace
    211248
  • TabularUnified trunk/WebCore/khtml/rendering/render_object.cpp

    r3627 r3648  
    879879        setMinMaxKnown(false);
    880880        setLayouted(false);
    881    } else if ( m_parent ) {
    881    } else if ( m_parent && !isText()) {
    882882        //qDebug("triggering repaint");
    883883        repaint();
     
    12951295short RenderObject::lineHeight( bool firstLine ) const
    12961296{
    1297    Length lh;
    1298    if( firstLine && hasFirstLine() ) {
    1299        RenderStyle *pseudoStyle  = style()->getPseudoStyle(RenderStyle::FIRST_LINE);
    1300        if ( pseudoStyle )
    1301            lh = pseudoStyle->lineHeight();
    1302    }
    1303    else
    1304        lh = style()->lineHeight();
    1297    Length lh = style(firstLine)->lineHeight();
    13051298
    13061299    // its "unset", choose nice default
    13071300    if ( lh.value < 0 )
    1308        return style()->fontMetrics().lineSpacing();
    1301        return style(firstLine)->fontMetrics().lineSpacing();
    13091302
    13101303    if ( lh.isPercent() )
    1311        return lh.minWidth( style()->font().pixelSize() );
    1304        return lh.minWidth( style(firstLine)->font().pixelSize() );
    13121305
    13131306    // its fixed
     
    13891382}
    13901383
    1384void RenderObject::getTextDecorationColors(int& decorations, QColor& underline, QColor& overline,
    1385                                           QColor& linethrough)
    1386{
    1387    int newDecorations = decorations;
    1388    RenderObject* curr = this;
    1389    do {
    1390        int currDecs = curr->style()->textDecoration();
    1391        if (currDecs) {
    1392            if (currDecs & UNDERLINE) {
    1393                newDecorations &= ~UNDERLINE;
    1394                underline = curr->style()->color();
    1395            }
    1396            if (currDecs & OVERLINE) {
    1397                newDecorations &= ~OVERLINE;
    1398                overline = curr->style()->color();
    1399            }
    1400            if (currDecs & LINE_THROUGH) {
    1401                newDecorations &= ~LINE_THROUGH;
    1402                linethrough = curr->style()->color();
    1403            }
    1404        }
    1405        curr = curr->parent();
    1406        if (curr && curr->isRenderBlock() && curr->continuation())
    1407            curr = curr->continuation();
    1408    } while (curr && newDecorations);
    1409
    1410    if (newDecorations)
    1411        // Null out everything that's left.
    1412        decorations &= ~newDecorations;
    1413}
  • TabularUnified trunk/WebCore/khtml/rendering/render_object.h

    r3627 r3648  
    277277                                     int _w, int _h, int _tx, int _ty) {};
    278278
    279    virtual void paintBackgroundExtended(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph,
    280                                         int _tx, int _ty, int w, int height,
    281                                         int bleft, int bright) {};
    282
    279283    /*
    280284     * This function calculates the minimum & maximum width that the object
     
    331335        friend class RenderImage;
    332336        friend class RenderText;
    337        friend class RenderInline;
    333338        friend class RenderObject;
    334339        friend class RenderFrameSet;
     
    483488    }
    484489
    490    void getTextDecorationColors(int& decorations, QColor& underline, QColor& overline,
    491                                 QColor& linethrough);
    492
    485493    enum BorderSide {
    486494        BSTop, BSBottom, BSLeft, BSRight
     
    506514
    507515    // positioning of inline childs (bidi)
    508    virtual void position(InlineBox*, int, int, int, bool) {}
    516    virtual void position(InlineBox*, int, int, bool) {}
    509517
    510518    enum SelectionState {
  • TabularUnified trunk/WebCore/khtml/rendering/render_root.cpp

    r3588 r3648  
    292292static QRect enclosingPositionedRect (RenderObject *n)
    293293{
    294    RenderObject *enclosingParent = (RenderObject*)n;
    295    QRect rect;
    296   
    297    while (enclosingParent && (enclosingParent->isText() || (enclosingParent->width() == 0 && enclosingParent->height() == 0))){
    298        enclosingParent = enclosingParent->parent();
    299    }
    300    if (enclosingParent){
    294    RenderObject *enclosingParent =  n->containingBlock();
    295    QRect rect(0,0,0,0);
    296    if (enclosingParent) {
    301297        int ox, oy;
    302
    303298        enclosingParent->absolutePosition(ox, oy);
    304299        rect.setX(ox);
  • TabularUnified trunk/WebCore/khtml/rendering/render_style.cpp

    r3548 r3648  
    8686
    8787StyleVisualData::StyleVisualData()
    88    : hasClip(false), colspan( 1 ), counter_increment( 0 ), counter_reset( 0 ),
    88    : hasClip(false), textDecoration(TDNONE), colspan( 1 ), counter_increment( 0 ), counter_reset( 0 ),
    8989      palette( QApplication::palette() )
    9090{
     
    9696StyleVisualData::StyleVisualData(const StyleVisualData& o )
    9797    : Shared<StyleVisualData>(),
    98      clip( o.clip ), hasClip( o.hasClip ), colspan( o.colspan ),
    98      clip( o.clip ), hasClip( o.hasClip ), textDecoration(o.textDecoration), colspan( o.colspan ),
    9999      counter_increment( o.counter_increment ), counter_reset( o.counter_reset ),
    100100      palette( o.palette )
     
    131131StyleInheritedData::StyleInheritedData()
    132132    : indent( Fixed ), line_height( -100, Percent ), style_image( 0 ),
    133      cursor_image( 0 ), font(), color( Qt::black ), decoration_color( Qt::black ), border_spacing( 0 )
    133      cursor_image( 0 ), font(), color( Qt::black ), border_spacing( 0 )
    134134{
    135135}
     
    143143      indent( o.indent ), line_height( o.line_height ), style_image( o.style_image ),
    144144      cursor_image( o.cursor_image ), font( o.font ),
    145      color( o.color ), decoration_color( o.decoration_color ),
    145      color( o.color ),
    146146      border_spacing( o.border_spacing )
    147147{
     
    157157        cursor_image == o.cursor_image &&
    158158        font == o.font &&
    159        color == o.color &&
    160        decoration_color == o.decoration_color;
    159        color == o.color;
    161160
    162161    // doesn't work because structs are not packed
     
    339338
    340339    if ( *box.get() != *other->box.get() ||
    341        *visual.get() != *other->visual.get() ||
    342340        *surround.get() != *other->surround.get() ||
    343341        !(inherited->indent == other->inherited->indent) ||
     
    350348        !(inherited_flags._htmlHacks == other->inherited_flags._htmlHacks) ||
    351349        !(noninherited_flags._position == other->noninherited_flags._position) ||
    352        !(noninherited_flags._floating == other->noninherited_flags._floating) )
    350        !(noninherited_flags._floating == other->noninherited_flags._floating) ||
    351         visual->colspan != other->visual->colspan ||
    352         visual->counter_increment != other->visual->counter_increment ||
    353         visual->counter_reset != other->visual->counter_reset)
    353354        return CbLayout;
    354355   
     
    413414//     DataRef<StyleBackgroundData> background;
    414415    if (inherited->color != other->inherited->color ||
    415        inherited->decoration_color != other->inherited->decoration_color ||
    416416        !(inherited_flags._visibility == other->inherited_flags._visibility) ||
    417417        !(noninherited_flags._overflow == other->noninherited_flags._overflow) ||
    418418        !(noninherited_flags._bg_repeat == other->noninherited_flags._bg_repeat) ||
    419419        !(noninherited_flags._bg_attachment == other->noninherited_flags._bg_attachment) ||
    420        !(inherited_flags._text_decoration == other->inherited_flags._text_decoration) ||
    421        *background.get() != *other->background.get()
    420        !(inherited_flags._text_decorations == other->inherited_flags._text_decorations) ||
    421        *background.get() != *other->background.get() ||
    422        !(visual->clip == other->visual->clip) ||
    423        visual->hasClip != other->visual->hasClip ||
    424        visual->textDecoration != other->visual->textDecoration ||
    425        !(visual->palette == other->visual->palette)
    422426        )
    423427        return Visible;
  • TabularUnified trunk/WebCore/khtml/rendering/render_style.h

    r3376 r3648  
    324324    bool operator==( const StyleVisualData &o ) const {
    325325        return ( clip == o.clip &&
    326         hasClip == o.hasClip &&
    326         hasClip == o.hasClip &&
    327327                 colspan == o.colspan &&
    328328                 counter_increment == o.counter_increment &&
    329329                 counter_reset == o.counter_reset &&
    330                 palette == o.palette );
    330                 palette == o.palette && textDecoration == o.textDecoration);
    331331    }
    332332    bool operator!=( const StyleVisualData &o ) const {
     
    336336    LengthBox clip;
    337337    bool hasClip : 1;
    338    int textDecoration : 4; // Text decorations defined *only* by this element.
    338339   
    339340    short colspan; // for html, not a css2 attribute
     
    425426    khtml::Font font;
    426427    QColor color;
    427    QColor decoration_color;
    428
    428   
    429429    short border_spacing;
    430430};
     
    520520        ETextAlign _text_align : 3;
    521521        ETextTransform _text_transform : 2;
    522        int _text_decoration : 4;
    522        int _text_decorations : 4;
    523523        ECursor _cursor_style : 4;
    524524        EDirection _direction : 1;
     
    589589        inherited_flags._text_align = TAAUTO;
    590590        inherited_flags._text_transform = TTNONE;
    591        inherited_flags._text_decoration = TDNONE;
    591        inherited_flags._text_decorations = TDNONE;
    592592        inherited_flags._cursor_style = CURSOR_AUTO;
    593593        inherited_flags._direction = LTR;
     
    718718    ETextAlign textAlign() const { return inherited_flags._text_align; }
    719719    ETextTransform textTransform() const { return inherited_flags._text_transform; }
    720    int textDecoration() const { return inherited_flags._text_decoration; }
    721    const QColor &textDecorationColor() const { return inherited->decoration_color; }
    720    int textDecorationsInEffect() const { return inherited_flags._text_decorations; }
    721    int textDecoration() const { return visual->textDecoration; }
    722722    int wordSpacing() const { return inherited->font.wordSpacing; }
    723723    int letterSpacing() const { return inherited->font.letterSpacing; }
     
    831831    void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
    832832    void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
    833    void setTextDecoration(int v) { inherited_flags._text_decoration = v; }
    834    void setTextDecorationColor(const QColor &v) { SET_VAR(inherited,decoration_color,v) }
    833    void addToTextDecorationsInEffect(int v) { inherited_flags._text_decorations |= v; }
    834    void setTextDecoration(int v) { SET_VAR(visual, textDecoration, v); }
    835835    void setDirection(EDirection v) { inherited_flags._direction = v; }
    836836    void setLineHeight(Length v) { SET_VAR(inherited,line_height,v) }
  • TabularUnified trunk/WebCore/khtml/rendering/render_table.cpp

    r3627 r3648  
    14301430void RenderTableCell::repaintRectangle(int x, int y, int w, int h, bool immediate, bool f)
    14311431{
    1432    RenderBlock::repaintRectangle(x, y, w, h+_topExtra+_bottomExtra, immediate, f);
    1432    y += _topExtra;
    1433    RenderBlock::repaintRectangle(x, y, w, h, immediate, f);
    14331434}
    14341435
  • TabularUnified trunk/WebCore/khtml/rendering/render_text.cpp

    r3627 r3648  
    9999
    100100#ifdef APPLE_CHANGES
    101void TextRun::paintDecoration( QPainter *pt, const Font *f, RenderText* p,
    102                                 int _tx, int _ty, int deco, bool begin, bool end, int from, int to)
    101void TextRun::paintDecoration( QPainter *pt, int _tx, int _ty, int deco)
    103102{
    104103    _tx += m_x;
    105104    _ty += m_y;
    105
    106    // Get the text decoration colors.
    107    QColor underline, overline, linethrough;
    108    object()->getTextDecorationColors(deco, underline, overline, linethrough);
    106109   
    107110    // Use a special function for underlines to get the positioning exactly right.
    108111    if (deco & UNDERLINE) {
    109        f->drawLineForText(pt, _tx, _ty, p->str->s, p->str->l, m_start, m_len,
    110                           m_toAdd, m_baseline, m_reversed ? QPainter::RTL : QPainter::LTR, from, to);
    112        pt->setPen(underline);
    113        pt->drawLineForText(_tx, _ty, m_baseline, m_width);
    111114    }
    112115    if (deco & OVERLINE) {
    113        f->drawLineForText(pt, _tx, _ty, p->str->s, p->str->l, m_start, m_len,
    114                           m_toAdd, 0, m_reversed ? QPainter::RTL : QPainter::LTR, from, to);
    116        pt->setPen(overline);
    117        pt->drawLineForText(_tx, _ty, 0, m_width);
    115118    }
    116119    if (deco & LINE_THROUGH) {
    117        f->drawLineForText(pt, _tx, _ty, p->str->s, p->str->l, m_start, m_len,
    118                           m_toAdd, 2*m_baseline/3, m_reversed ? QPainter::RTL : QPainter::LTR, from, to);
    120        pt->setPen(linethrough);
    121        pt->drawLineForText(_tx, _ty, 2*m_baseline/3, m_width);
    119122    }
    120123}
    121124#else
    122void TextRun::paintDecoration( QPainter *pt, RenderText* p, int _tx, int _ty, int decoration, bool begin, bool end)
    125void TextRun::paintDecoration( QPainter *pt, int _tx, int _ty, int decoration)
    123126{
    124127    _tx += m_x;
     
    127130    int width = m_width - 1;
    128131
    129    if( begin )
    130        width -= p->paddingLeft() + p->borderLeft();
    131
    132    if ( end )
    133        width -= p->paddingRight() + p->borderRight();
    134
    132    QColor underline, overline, linethrough;
    133    object()->getTextDecorationColors(decoration, underline, overline, linethrough);
    134   
    135135    int underlineOffset = ( pt->fontMetrics().height() + m_baseline ) / 2;
    136136    if(underlineOffset <= m_baseline) underlineOffset = m_baseline+1;
    137137
    138138    if(deco & UNDERLINE){
    139        pt->setPen(underline);
    139140        pt->drawLine(_tx, _ty + underlineOffset, _tx + width, _ty + underlineOffset );
    140141    }
    141    if(deco & OVERLINE)
    142    if (deco & OVERLINE) {
    143        pt->setPen(overline);
    142144        pt->drawLine(_tx, _ty, _tx + width, _ty );
    143    if(deco & LINE_THROUGH)
    145    }
    146    if(deco & LINE_THROUGH) {
    147        pt->setPen(linethrough);
    144148        pt->drawLine(_tx, _ty + 2*m_baseline/3, _tx + width, _ty + 2*m_baseline/3 );
    149    }
    145150    // NO! Do NOT add BLINK! It is the most annouing feature of Netscape, and IE has a reason not to
    146151    // support it. Lars
    147152}
    148153#endif
    149
    150
    151void TextRun::paintBoxDecorations(QPainter *pt, RenderStyle* style, RenderText *p, int _tx, int _ty, bool begin, bool end)
    152{
    153    int topExtra = p->borderTop() + p->paddingTop();
    154    int bottomExtra = p->borderBottom() + p->paddingBottom();
    155    // ### firstline
    156    int halfleading = (p->m_lineHeight - style->font().pixelSize() ) / 2;
    157
    158    _tx += m_x;
    159    _ty += m_y + halfleading - topExtra;
    160
    161    int width = m_width + p->borderLeft() + p->borderRight() + p->paddingLeft() + p->paddingRight();
    162
    163    // the height of the decorations is:  topBorder + topPadding + CSS font-size + bottomPadding + bottomBorder
    164    int height = style->font().pixelSize() + topExtra + bottomExtra;
    165
    166    if( begin )
    167        _tx -= p->paddingLeft() + p->borderLeft();
    168
    169    QColor c = style->backgroundColor();
    170    CachedImage *i = style->backgroundImage();
    171    if(c.isValid() && (!i || i->tiled_pixmap(c).mask()))
    172         pt->fillRect(_tx, _ty, width, height, c);
    173
    174    if(i) {
    175        // ### might need to add some correct offsets
    176        // ### use paddingX/Y
    177        pt->drawTiledPixmap(_tx, _ty, width, height, i->tiled_pixmap(c));
    178    }
    179
    180#ifdef DEBUG_VALIGN
    181    pt->fillRect(_tx, _ty, width, height, Qt::cyan );
    182#endif
    183
    184    if(style->hasBorder())
    185        p->paintBorder(pt, _tx, _ty, width, height, style, begin, end);
    186}
    187154
    188155#define LOCAL_WIDTH_BUF_SIZE    1024
     
    197164        return SelectionPointBefore; // above -> before
    198165
    199    if ( _y > _ty + m_y + lineHeight ) {
    166    if ( _y > _ty + m_y + m_height ) {
    200167        // below -> after
    201168        // Set the offset to the max
     
    451418    assert(parent());
    452419
    453    int height = m_lineHeight;
    454
    455420    TextRun *s = m_lines.count() ? m_lines[0] : 0;
    456421    int si = 0;
    457422    while(s) {
    458        if((_y >=_ty + s->m_y) && (_y < _ty + s->m_y + height) &&
    423        if((_y >=_ty + s->m_y) && (_y < _ty + s->m_y + s->height()) &&
    459424           (_x >= _tx + s->m_x) && (_x <_tx + s->m_x + s->m_width) ) {
    460425            inside = true;
     
    544509  TextRun * s = findTextRun( offset, pos );
    545510  _y = s->m_y;
    546  height = m_lineHeight; // ### firstLine!!! s->m_height;
    547
    548  const QFontMetrics &fm = metrics( false ); // #### wrong for first-line!
    511  height = s->m_height;
    512
    513  const QFontMetrics &fm = metrics( s->m_firstLine );
    549514  QString tekst(str->s + s->m_start, s->m_len);
    550515  _x = s->m_x + (fm.boundingRect(tekst, pos)).right();
     
    570535{
    571536    return RenderObject::absolutePosition(xPos, yPos, false);
    572
    573    if(parent() && parent()->absolutePosition(xPos, yPos, false)) {
    574        xPos -= paddingLeft() + borderLeft();
    575        yPos -= borderTop() + paddingTop();
    576        return true;
    577    }
    578    xPos = yPos = 0;
    579    return false;
    580537}
    581538
     
    617574    int ow = style()->outlineWidth();
    618575    RenderStyle* pseudoStyle = style()->getPseudoStyle(RenderStyle::FIRST_LINE);
    619    int d = style()->textDecoration();
    576    int d = style()->textDecorationsInEffect();
    620577    TextRun f(0, y-ty);
    621578    int si = m_lines.findFirstMatching(&f);
     
    625582    {
    626583        // Move up until out of area to be printed
    627        while(si > 0 && m_lines[si-1]->checkVerticalPoint(y, ty, h, m_lineHeight))
    584        while(si > 0 && m_lines[si-1]->checkVerticalPoint(y, ty, h))
    628585            si--;
    629586
     
    669626            si = startLine;
    670627           
    671            bool drawDecorations = !haveSelection || pass == 0;
    672628            bool drawSelectionBackground = haveSelection && pass == 0 && paintAction != PaintActionSelection;
    673629            bool drawText = !haveSelection || pass == 1;
     
    681637            if (isPrinting)
    682638            {
    639                // FIXME: Need to understand what this section is doing.
    683640                int lh = lineHeight( false ) + paddingBottom() + borderBottom();
    684641                if (ty+s->m_y < y)
     
    704661                font = &_style->htmlFont();
    705662            }
    706
    707#if APPLE_CHANGES
    708            if (drawDecorations)
    709#endif
    710            if((shouldPaintBackgroundOrBorder()  &&
    711                (parent()->isInline() || pseudoStyle)) &&
    712               (!pseudoStyle || s->m_firstLine))
    713                s->paintBoxDecorations(p, _style, this, tx, ty, si == 0, si == (int)m_lines.count()-1);
    714663
    715664#if APPLE_CHANGES
     
    735684            }
    736685
    737            if(d != TDNONE)
    686            if (d != TDNONE && paintAction == PaintActionForeground)
    738687            {
    739                p->setPen(_style->textDecorationColor());
    740                if (paintAction == PaintActionSelection) {
    741                    int offset = s->m_start;
    742                    int sPos = QMAX( startPos - offset, 0 );
    743                    int ePos = QMIN( endPos - offset, s->m_len );
    744                    if ( sPos < ePos ){
    745                        s->paintDecoration(p, font, this, tx, ty, d, si == 0, si == ( int ) m_lines.count()-1, sPos, ePos);
    746                    }
    747                } else {
    748                    s->paintDecoration(p, font, this, tx, ty, d,si == 0, si == ( int ) m_lines.count()-1);
    688                RenderObject* curr = this;
    689                while (curr && !curr->element())
    690                    curr = curr->container();
    691                bool quirksMode = (curr && curr->element()->getDocument()->inQuirksMode());
    692                if (quirksMode) {
    693                    p->setPen(_style->color());
    694                    s->paintDecoration(p, tx, ty, d);
    749695                }
    750696            }
     
    801747#endif
    802748
    803        } while (++si < (int)m_lines.count() && m_lines[si]->checkVerticalPoint(y-ow, ty, h, m_lineHeight));
    749        } while (++si < (int)m_lines.count() && m_lines[si]->checkVerticalPoint(y-ow, ty, h));
    804750
    805751#if APPLE_CHANGES
     
    820766                       int tx, int ty, PaintAction paintAction)
    821767{
    822    if (paintAction != PaintActionForeground && paintAction != PaintActionSelection) {
    768    if (paintAction != PaintActionForeground && paintAction != PaintActionSelection)
    823769        return;
    824    }
    825    if (style()->visibility() != VISIBLE) {
    770   
    771    if (style()->visibility() != VISIBLE)
    826772        return;
    827    }
    828773
    829774    int s = m_lines.count() - 1;
    830    if ( s < 0 ) return;
    831
    832    // ### incorporate padding/border here!
    833    if ( ty + m_lines[0]->m_y > y + h + 64 ) return;
    834    if ( ty + m_lines[s]->m_y + m_lines[s]->m_baseline + m_lineHeight + 64 < y ) return;
    775    if ( s < 0 )
    776        return;
    777
    778    if (ty + m_lines[0]->yPos() > y + h) return;
    779    if (ty + m_lines[s]->yPos() + m_lines[s]->height() < y ) return;
    835780
    836781    paintObject(p, x, y, w, h, tx, ty, paintAction);
     
    11941139}
    11951140
    1196void RenderText::position(InlineBox* box, int y, int from, int len, bool reverse)
    1141void RenderText::position(InlineBox* box, int from, int len, bool reverse)
    11971142{
    11981143    // ### should not be needed!!!
     
    12101155    TextRun *s = static_cast<TextRun*>(box);
    12111156    s->m_reversed = reverse;
    1212    s->m_y = y;
    12131157    s->m_start = from;
    12141158    s->m_len = len;
    1215    s->m_baseline = baselinePosition(s->m_firstLine);
    12161159   
    12171160    if(m_lines.count() == m_lines.size())
  • TabularUnified trunk/WebCore/khtml/rendering/render_text.h

    r3627 r3648  
    5050        m_start = 0;
    5151        m_len = 0;
    52        m_baseline = 0;
    5352        m_reversed = false;
    5453        m_toAdd = 0;
     
    7473    virtual bool isTextRun() { return true; }
    7574   
    76#ifdef APPLE_CHANGES
    77    void paintDecoration( QPainter *pt, const Font *, RenderText* p,
    78                          int _tx, int _ty, int decoration, bool begin, bool end, int from=-1, int to=-1);
    79#else
    80    void paintDecoration( QPainter *pt, RenderText* p, int _tx, int _ty, int decoration, bool begin, bool end);
    81#endif
    82    void paintBoxDecorations(QPainter *p, RenderStyle* style, RenderText *parent, int _tx, int _ty, bool begin, bool end);
    75    void paintDecoration( QPainter *pt, int _tx, int _ty, int decoration);
    8376    void paintSelection(const Font *f, RenderText *text, QPainter *p, RenderStyle* style, int tx, int ty, int startPos, int endPos);
    8477
     
    9184     * of this object's representation?
    9285     */
    93    bool checkVerticalPoint(int _y, int _ty, int _h, int height)
    94    { if((_ty + m_y > _y + _h) || (_ty + m_y + m_baseline + height < _y)) return false; return true; }
    86    bool checkVerticalPoint(int _y, int _ty, int _h)
    87    { if((_ty + m_y > _y + _h) || (_ty + m_y + m_baseline + height() < _y)) return false; return true; }
    9588
    9689    int m_start;
    9790    unsigned short m_len;
    98    unsigned short m_baseline;
    9991   
    10092    bool m_reversed : 1;
     
    159151    QChar *text() const { return str->s; }
    160152    unsigned int stringLength() const { return str->l; } // non virtual implementation of length()
    161    virtual void position(InlineBox* box, int y, int from, int len, bool reverse);
    153    virtual void position(InlineBox* box, int from, int len, bool reverse);
    162154
    163155    virtual unsigned int width(unsigned int from, unsigned int len, const Font *f) const;
  • TabularUnified trunk/WebCore/kwq/KWQPainter.h

    r3455 r3648  
    9494    void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd,
    9595                  const QColor& backgroundColor, QPainter::TextDirection d, int letterSpacing, int wordSpacing);
    96    void drawLineForText(int x, int y, const QChar *, int length, int from, int to, int toAdd,
    97                         int yOffset, QPainter::TextDirection d, int letterSpacing, int wordSpacing);
    96    void drawLineForText(int x, int y, int yOffset, int width);
    9897    static QColor selectedTextBackgroundColor();
    9998   
  • TabularUnified trunk/WebCore/kwq/KWQPainter.mm

    r3455 r3648  
    418418}
    419419
    420void QPainter::drawLineForText(int x, int y, const QChar *str, int length, int from, int to, int toAdd, int yOffset, QPainter::TextDirection d, int letterSpacing, int wordSpacing)
    421{
    422    if (data->state.paintingDisabled)
    423        return;
    424
    425    CREATE_FAMILY_ARRAY(data->state.font, families);
    426       
    427    _updateRenderer(families);
    420void QPainter::drawLineForText(int x, int y, int yOffset, int width)
    421{
    422    if (data->state.paintingDisabled)
    423        return;
    428424
    429425    [data->lastTextRenderer
    430        drawLineForCharacters:(const UniChar *)str stringLength:length
    431 fromCharacterPosition:from
    432   toCharacterPosition:to
    433               atPoint:NSMakePoint(x, y)
    426        drawLineForCharacters: NSMakePoint(x, y)
    434427               yOffset:(float)yOffset
    435           withPadding: toAdd
    436         withColor:data->state.pen.color().getNSColor()
    437           rightToLeft: d == RTL ? true : false
    438         letterSpacing: letterSpacing
    439           wordSpacing: wordSpacing
    440          fontFamilies: families];
    428             withWidth: width
    429             withColor:data->state.pen.color().getNSColor()];
    441430}
    442431
  • TabularUnified trunk/WebCore/kwq/WebCoreTextRenderer.h

    r3376 r3648  
    4343// drawing
    4444- (void)drawCharacters:(const UniChar *)characters stringLength:(unsigned)length fromCharacterPosition:(int)from toCharacterPosition:(int)to atPoint:(NSPoint)point withPadding: (int)padding withTextColor:(NSColor *)textColor backgroundColor:(NSColor *)backgroundColor rightToLeft: (BOOL)rtl letterSpacing: (int)letterSpacing wordSpacing: (int)wordSpacing fontFamilies: (NSString **)families;
    45- (void)drawLineForCharacters:(const UniChar *)characters stringLength:(unsigned)length fromCharacterPosition:(int)from toCharacterPosition:(int)to atPoint:(NSPoint)point yOffset:(float)yOffset withPadding: (int)padding withColor:(NSColor *)color rightToLeft: (BOOL)rtl letterSpacing: (int)letterSpacing wordSpacing: (int)wordSpacing fontFamilies: (NSString **)families;
    45- (void)drawLineForCharacters:(NSPoint)point yOffset:(float)yOffset withWidth: (int)width withColor:(NSColor *)color;
    4646
    4747@end
Note: See TracChangeset for help on using the changeset viewer.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK