Changeset 13595 in webkit


Ignore:
Timestamp:
Mar 30, 2006 9:23:14 PM (18 years ago)
Author:
adele
Message:

LayoutTests:

Reviewed by Darin.

  • fast/repaint: Added.
  • fast/repaint/inline-block-overflow-expected.checksum: Added.
  • fast/repaint/inline-block-overflow-expected.png: Added.
  • fast/repaint/inline-block-overflow-expected.txt: Added.
  • fast/repaint/inline-block-overflow.html: Added.
  • fast/repaint/text-shadow-expected.checksum: Added.
  • fast/repaint/text-shadow-expected.png: Added.
  • fast/repaint/text-shadow-expected.txt: Added.
  • fast/repaint/text-shadow-horizontal-expected.checksum: Added.
  • fast/repaint/text-shadow-horizontal-expected.png: Added.
  • fast/repaint/text-shadow-horizontal-expected.txt: Added.
  • fast/repaint/text-shadow-horizontal.html: Added.
  • fast/repaint/text-shadow.html: Added.

WebCore:

Tests: fast/repaint/text-shadow.html fast/repaint/text-shadow-horizontal.html

Reviewed by Darin.

  • rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paint): Paint the text box if it is within the maximum possible horizontal shadow overflow of the damage rect.
  • rendering/InlineTextBox.h: Removed unused function checkVerticalPoint().
  • rendering/RenderFlow.cpp: (WebCore::RenderFlow::paintLines): Use the vertical overflows instead of the selection vertical bounds. (WebCore::RenderFlow::hitTestLines):
  • rendering/render_line.cpp: (WebCore::InlineFlowBox::placeBoxesHorizontally): Include overflow due to text shadow in leftPosition and rightPosition and keep track of the maximum horizontal shadow on the inline. (WebCore::InlineFlowBox::verticallyAlignBoxes): (WebCore::InlineFlowBox::placeBoxesVertically): Include overflow due to shadow and inline-blocks' overflow in topPosition and bottomPosition but not in the selection vertical bounds. (WebCore::RootInlineBox::selectionTop):
  • rendering/render_line.h: (WebCore::InlineFlowBox:::InlineRunBox): (WebCore::InlineFlowBox::setVerticalSelectionPositions): (WebCore::InlineFlowBox::maxHorizontalShadow): (WebCore::RootInlineBox::setVerticalSelectionPositions): (WebCore::RootInlineBox::selectionBottom): (WebCore::RootInlineBox::selectionHeight):
Location:
trunk
Files:
13 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r13588 r13595  
     12006-03-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
     2
     3        Reviewed by Darin.
     4
     5        - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=7301
     6          Text shadow does not repaint correctly
     7
     8        * fast/repaint: Added.
     9        * fast/repaint/inline-block-overflow-expected.checksum: Added.
     10        * fast/repaint/inline-block-overflow-expected.png: Added.
     11        * fast/repaint/inline-block-overflow-expected.txt: Added.
     12        * fast/repaint/inline-block-overflow.html: Added.
     13        * fast/repaint/text-shadow-expected.checksum: Added.
     14        * fast/repaint/text-shadow-expected.png: Added.
     15        * fast/repaint/text-shadow-expected.txt: Added.
     16        * fast/repaint/text-shadow-horizontal-expected.checksum: Added.
     17        * fast/repaint/text-shadow-horizontal-expected.png: Added.
     18        * fast/repaint/text-shadow-horizontal-expected.txt: Added.
     19        * fast/repaint/text-shadow-horizontal.html: Added.
     20        * fast/repaint/text-shadow.html: Added.
     21
    1222006-03-30  Tim Omernick  <timo@apple.com>
    223
  • trunk/WebCore/ChangeLog

    r13592 r13595  
     12006-03-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
     2
     3        Tests: fast/repaint/text-shadow.html fast/repaint/text-shadow-horizontal.html
     4
     5        Reviewed by Darin.
     6
     7        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7301
     8          Text shadow does not repaint correctly
     9
     10        * rendering/InlineTextBox.cpp:
     11        (WebCore::InlineTextBox::paint): Paint the text box if it is within the maximum
     12        possible horizontal shadow overflow of the damage rect.
     13        * rendering/InlineTextBox.h: Removed unused function checkVerticalPoint().
     14        * rendering/RenderFlow.cpp:
     15        (WebCore::RenderFlow::paintLines): Use the vertical overflows instead of the
     16        selection vertical bounds.
     17        (WebCore::RenderFlow::hitTestLines):
     18        * rendering/render_line.cpp:
     19        (WebCore::InlineFlowBox::placeBoxesHorizontally): Include overflow due to text shadow
     20        in leftPosition and rightPosition and keep track of the maximum horizontal shadow
     21        on the inline.
     22        (WebCore::InlineFlowBox::verticallyAlignBoxes):
     23        (WebCore::InlineFlowBox::placeBoxesVertically): Include overflow due to shadow and
     24        inline-blocks' overflow in topPosition and bottomPosition but not in the selection
     25        vertical bounds.
     26        (WebCore::RootInlineBox::selectionTop):
     27        * rendering/render_line.h:
     28        (WebCore::InlineFlowBox:::InlineRunBox):
     29        (WebCore::InlineFlowBox::setVerticalSelectionPositions):
     30        (WebCore::InlineFlowBox::maxHorizontalShadow):
     31        (WebCore::RootInlineBox::setVerticalSelectionPositions):
     32        (WebCore::RootInlineBox::selectionBottom):
     33        (WebCore::RootInlineBox::selectionHeight):
     34
    1352006-03-30  Beth Dakin  <bdakin@apple.com>
    236
  • trunk/WebCore/rendering/InlineTextBox.cpp

    r13592 r13595  
    6868}
    6969
    70 bool InlineTextBox::checkVerticalPoint(int _y, int _ty, int _h)
    71 {
    72     int topY = m_y;
    73     int bottomY = m_y + m_height;
    74     if (root()->hasSelectedChildren()) {
    75         topY = kMin(root()->selectionTop(), topY);
    76         bottomY = kMax(bottomY, root()->bottomOverflow());
    77     }
    78     if ((_ty + topY >= _y + _h) || (_ty + bottomY <= _y))
    79         return false;
    80     return true;
    81 }
    82 
    8370bool InlineTextBox::isSelected(int startPos, int endPos) const
    8471{
     
    251238    assert(i.phase != PaintPhaseSelfOutline && i.phase != PaintPhaseChildOutlines);
    252239
    253     int xPos = tx + m_x;
    254     int w = width();
     240    int xPos = tx + m_x - parent()->maxHorizontalShadow();
     241    int w = width() + 2 * parent()->maxHorizontalShadow();
    255242    if (xPos >= i.r.right() || xPos + w <= i.r.x())
    256243        return;
  • trunk/WebCore/rendering/InlineTextBox.h

    r13393 r13595  
    120120    int positionForOffset(int offset) const;
    121121   
    122     /**
    123      * if this text run was rendered @ref _ty pixels below the upper edge
    124      * of a view, would the @ref _y -coordinate be inside the vertical range
    125      * of this object's representation?
    126      */
    127     bool checkVerticalPoint(int _y, int _ty, int _h);
    128 
    129122    int m_start;
    130123    unsigned short m_len;
  • trunk/WebCore/rendering/RenderFlow.cpp

    r13592 r13595  
    365365    // We can check the first box and last box and avoid painting if we don't
    366366    // intersect.  This is a quick short-circuit that we can take to avoid walking any lines.
    367     // FIXME: This check is flawed in two extremely obscure ways.
    368     // (1) If some line in the middle has a huge overflow, it might actually extend below the last line.
    369     // (2) The overflow from an inline block on a line is not reported to the line.
    370     int yPos = firstLineBox()->root()->selectionTop() - maximalOutlineSize(i.phase);
    371     int h = maximalOutlineSize(i.phase) + lastLineBox()->root()->selectionTop() + lastLineBox()->root()->selectionHeight() - yPos;
     367    // FIXME: This check is flawed in the following extremely obscure way:
     368    // if some line in the middle has a huge overflow, it might actually extend below the last line.
     369    int yPos = firstLineBox()->root()->topOverflow() - maximalOutlineSize(i.phase);
     370    int h = maximalOutlineSize(i.phase) + lastLineBox()->root()->bottomOverflow() - yPos;
    372371    yPos += _ty;
    373372    if (yPos >= i.r.bottom() || yPos + h <= i.r.y())
     
    437436    // We can check the first box and last box and avoid hit testing if we don't
    438437    // contain the point.  This is a quick short-circuit that we can take to avoid walking any lines.
    439     // FIXME: This check is flawed in two extremely obscure ways.
    440     // (1) If some line in the middle has a huge overflow, it might actually extend below the last line.
    441     // (2) The overflow from an inline block on a line is not reported to the line.
     438    // FIXME: This check is flawed in the following extremely obscure way:
     439    // if some line in the middle has a huge overflow, it might actually extend below the last line.
    442440    if ((y >= ty + lastLineBox()->root()->bottomOverflow()) || (y < ty + firstLineBox()->root()->topOverflow()))
    443441        return false;
  • trunk/WebCore/rendering/render_line.cpp

    r13592 r13595  
    478478            }
    479479            text->setXPos(x);
    480             leftPosition = kMin(x, leftPosition);
    481             rightPosition = kMax(x + text->width(), rightPosition);
     480            int shadowLeft = 0;
     481            int shadowRight = 0;
     482            for (ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next) {
     483                shadowLeft = kMin(shadowLeft, shadow->x - shadow->blur);
     484                shadowRight = kMax(shadowRight, shadow->x + shadow->blur);
     485            }
     486            leftPosition = kMin(x + shadowLeft, leftPosition);
     487            rightPosition = kMax(x + text->width() + shadowRight, rightPosition);
     488            m_maxHorizontalShadow = kMax(kMax(shadowRight, -shadowLeft), m_maxHorizontalShadow);
    482489            x += text->width();
    483490        }
     
    544551    int topPosition = heightOfBlock;
    545552    int bottomPosition = heightOfBlock;
    546     placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, topPosition, bottomPosition);
     553    int selectionTop = heightOfBlock;
     554    int selectionBottom = heightOfBlock;
     555    placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom);
    547556
    548557    setVerticalOverflowPositions(topPosition, bottomPosition);
     558    setVerticalSelectionPositions(selectionTop, selectionBottom);
    549559
    550560    // Shrink boxes with no text children in quirks and almost strict mode.
     
    635645
    636646void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode,
    637                                          int& topPosition, int& bottomPosition)
     647                                         int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom)
    638648{
    639649    if (isRootInlineBox())
     
    647657        // line-height).
    648658        if (curr->isInlineFlowBox())
    649             static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode,
    650                                                                     topPosition, bottomPosition);
     659            static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom);
    651660
    652661        bool childAffectsTopBottomPos = true;
     
    664673        int newHeight = curr->height();
    665674        int newBaseline = curr->baseline();
     675        int overflowTop = 0;
     676        int overflowBottom = 0;
    666677        if (curr->isText() || curr->isInlineFlowBox()) {
    667678            const Font& font = curr->object()->font(m_firstLine);
     
    669680            newY += curr->baseline() - newBaseline;
    670681            newHeight = newBaseline + font.descent();
     682            for (ShadowData* shadow = curr->object()->style()->textShadow(); shadow; shadow = shadow->next) {
     683                overflowTop = kMin(overflowTop, shadow->y - shadow->blur);
     684                overflowBottom = kMax(overflowBottom, shadow->y + shadow->blur);
     685            }
    671686            if (curr->isInlineFlowBox()) {
    672687                newHeight += curr->object()->borderTop() + curr->object()->paddingTop() +
     
    679694            newY += curr->object()->marginTop();
    680695            newHeight = curr->height() - (curr->object()->marginTop() + curr->object()->marginBottom());
     696            overflowTop = curr->object()->overflowTop();
     697            overflowBottom = curr->object()->overflowHeight() - newHeight;
    681698        }
    682699
     
    686703
    687704        if (childAffectsTopBottomPos) {
    688             if (newY < topPosition)
    689                 topPosition = newY;
    690             if (newY + newHeight > bottomPosition)
    691                 bottomPosition = newY + newHeight;
    692         }
     705            selectionTop = kMin(selectionTop, newY);
     706            selectionBottom = kMax(selectionBottom, newY + newHeight);
     707        }
     708        topPosition = kMin(topPosition, newY + overflowTop);
     709        bottomPosition = kMax(bottomPosition, newY + newHeight + overflowBottom);
    693710    }
    694711
     
    699716        setBaseline(font.ascent());
    700717        if (hasTextChildren() || strictMode) {
    701             if (yPos() < topPosition)
    702                 topPosition = yPos();
    703             if (yPos() + height() > bottomPosition)
    704                 bottomPosition = yPos() + height();
     718            selectionTop = kMin(selectionTop, yPos());
     719            selectionBottom = kMax(selectionBottom, yPos() + height());
    705720        }
    706721    }
     
    12991314{
    13001315    if (!prevRootBox())
    1301         return topOverflow();
    1302    
    1303     int prevBottom = prevRootBox()->bottomOverflow();
    1304     if (prevBottom < m_topOverflow && block()->containsFloats()) {
     1316        return m_selectionTop;
     1317   
     1318    int prevBottom = prevRootBox()->selectionBottom();
     1319    if (prevBottom < m_selectionTop && block()->containsFloats()) {
    13051320        // This line has actually been moved further down, probably from a large line-height, but possibly because the
    13061321        // line was forced to clear floats.  If so, let's check the offsets, and only be willing to use the previous
     
    13081323        int prevLeft = block()->leftOffset(prevBottom);
    13091324        int prevRight = block()->rightOffset(prevBottom);
    1310         int newLeft = block()->leftOffset(m_topOverflow);
    1311         int newRight = block()->rightOffset(m_topOverflow);
     1325        int newLeft = block()->leftOffset(m_selectionTop);
     1326        int newRight = block()->rightOffset(m_selectionTop);
    13121327        if (prevLeft > newLeft || prevRight < newRight)
    1313             return m_topOverflow;
     1328            return m_selectionTop;
    13141329    }
    13151330   
  • trunk/WebCore/rendering/render_line.h

    r13393 r13595  
    211211        m_includeLeftEdge = m_includeRightEdge = false;
    212212        m_hasTextChildren = false;
     213        m_maxHorizontalShadow = 0;
    213214    }
    214215
     
    279280                                   int maxPositionTop, int maxPositionBottom);
    280281    void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode,
    281                               int& topPosition, int& bottomPosition);
     282                              int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom);
    282283    void shrinkBoxesWithNoTextChildren(int topPosition, int bottomPosition);
    283284   
    284285    virtual void setVerticalOverflowPositions(int top, int bottom) {}
     286    virtual void setVerticalSelectionPositions(int top, int bottom) {}
     287    int maxHorizontalShadow() const { return m_maxHorizontalShadow; }
    285288
    286289    void removeChild(InlineBox* child);
     
    294297    InlineBox* m_firstChild;
    295298    InlineBox* m_lastChild;
     299    int m_maxHorizontalShadow;
    296300    bool m_includeLeftEdge : 1;
    297301    bool m_includeRightEdge : 1;
     
    322326    virtual int rightOverflow() { return m_rightOverflow; }
    323327    virtual void setVerticalOverflowPositions(int top, int bottom) { m_topOverflow = top; m_bottomOverflow = bottom; }
     328    virtual void setVerticalSelectionPositions(int top, int bottom) { m_selectionTop = top; m_selectionBottom = bottom; }
    324329    void setHorizontalOverflowPositions(int left, int right) { m_leftOverflow = left; m_rightOverflow = right; }
    325330    void setLineBreakInfo(RenderObject* obj, unsigned breakPos, BidiStatus* status, BidiContext* context);
     
    365370
    366371    int selectionTop();
    367     int selectionHeight() { return kMax(0, m_bottomOverflow - selectionTop()); }
     372    int selectionBottom() { return m_selectionBottom; }
     373    int selectionHeight() { return kMax(0, selectionBottom() - selectionTop()); }
    368374 
    369375    InlineBox* closestLeafChildForXPos(int _x, int _tx);
     
    378384    int m_rightOverflow;
    379385
     386    int m_selectionTop;
     387    int m_selectionBottom;
     388
    380389    // Where this line ended.  The exact object and the position within that object are stored so that
    381390    // we can create a BidiIterator beginning just after the end of this line.
Note: See TracChangeset for help on using the changeset viewer.