Changeset 14847

Show
Ignore:
Timestamp:
06/13/06 16:19:33 (3 years ago)
Author:
antti
Message:

LayoutTests:

Reviewed by Hyatt

http://bugzilla.opendarwin.org/show_bug.cgi?id=9314

  • fast/block/positioning/relative-overflow-block-expected.checksum: Added.
  • fast/block/positioning/relative-overflow-block-expected.png: Added.
  • fast/block/positioning/relative-overflow-block-expected.txt: Added.
  • fast/block/positioning/relative-overflow-block.html: Added.
  • fast/block/positioning/relative-overflow-replaced-expected.checksum: Added.
  • fast/block/positioning/relative-overflow-replaced-expected.png: Added.
  • fast/block/positioning/relative-overflow-replaced-expected.txt: Added.
  • fast/block/positioning/relative-overflow-replaced-float-expected.checksum: Added.
  • fast/block/positioning/relative-overflow-replaced-float-expected.png: Added.
  • fast/block/positioning/relative-overflow-replaced-float-expected.txt: Added.
  • fast/block/positioning/relative-overflow-replaced-float.html: Added.
  • fast/block/positioning/relative-overflow-replaced.html: Added.

WebCore:

Reviewed by Hyatt.

http://bugzilla.opendarwin.org/show_bug.cgi?id=9314
Relative positioned block size doesnt update root layer size

  • take relative positioning into account in leftmost/rightmost/lowestPosition()
  • ignore zero width/height boxes in leftmost/rightmost/lowestPosition()
  • split relativePositionOffset() to x and y functions


  • rendering/RenderBox.cpp: (WebCore::RenderBox::absolutePosition): (WebCore::RenderBox::relativePositionOffsetX): (WebCore::RenderBox::relativePositionOffsetY): (WebCore::RenderBox::lowestPosition): (WebCore::RenderBox::rightmostPosition): (WebCore::RenderBox::leftmostPosition):
  • rendering/RenderBox.h:
  • rendering/RenderFlow.cpp: (WebCore::RenderFlow::lowestPosition): (WebCore::RenderFlow::rightmostPosition): (WebCore::RenderFlow::leftmostPosition):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPosition):
  • rendering/RenderObject.cpp: (WebCore::RenderObject::offsetLeft): (WebCore::RenderObject::offsetTop):
Location:
trunk
Files:
12 added
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r14846 r14847  
     12006-06-13  Antti Koivisto  <koivisto@iki.fi> 
     2 
     3        Reviewed by Hyatt 
     4 
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=9314 
     6 
     7        * fast/block/positioning/relative-overflow-block-expected.checksum: Added. 
     8        * fast/block/positioning/relative-overflow-block-expected.png: Added. 
     9        * fast/block/positioning/relative-overflow-block-expected.txt: Added. 
     10        * fast/block/positioning/relative-overflow-block.html: Added. 
     11        * fast/block/positioning/relative-overflow-replaced-expected.checksum: Added. 
     12        * fast/block/positioning/relative-overflow-replaced-expected.png: Added. 
     13        * fast/block/positioning/relative-overflow-replaced-expected.txt: Added. 
     14        * fast/block/positioning/relative-overflow-replaced-float-expected.checksum: Added. 
     15        * fast/block/positioning/relative-overflow-replaced-float-expected.png: Added. 
     16        * fast/block/positioning/relative-overflow-replaced-float-expected.txt: Added. 
     17        * fast/block/positioning/relative-overflow-replaced-float.html: Added. 
     18        * fast/block/positioning/relative-overflow-replaced.html: Added. 
     19 
    1202006-06-13  Anders Carlsson  <acarlsson@apple.com> 
    221 
  • trunk/WebCore/ChangeLog

    r14846 r14847  
     12006-06-13  Antti Koivisto  <koivisto@iki.fi> 
     2 
     3        Reviewed by Hyatt. 
     4 
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=9314 
     6        Relative positioned block size doesnt update root layer size 
     7 
     8        - take relative positioning into account in leftmost/rightmost/lowestPosition() 
     9        - ignore zero width/height boxes in leftmost/rightmost/lowestPosition() 
     10        - split relativePositionOffset() to x and y functions 
     11         
     12        * rendering/RenderBox.cpp: 
     13        (WebCore::RenderBox::absolutePosition): 
     14        (WebCore::RenderBox::relativePositionOffsetX): 
     15        (WebCore::RenderBox::relativePositionOffsetY): 
     16        (WebCore::RenderBox::lowestPosition): 
     17        (WebCore::RenderBox::rightmostPosition): 
     18        (WebCore::RenderBox::leftmostPosition): 
     19        * rendering/RenderBox.h: 
     20        * rendering/RenderFlow.cpp: 
     21        (WebCore::RenderFlow::lowestPosition): 
     22        (WebCore::RenderFlow::rightmostPosition): 
     23        (WebCore::RenderFlow::leftmostPosition): 
     24        * rendering/RenderLayer.cpp: 
     25        (WebCore::RenderLayer::updateLayerPosition): 
     26        * rendering/RenderObject.cpp: 
     27        (WebCore::RenderObject::offsetLeft): 
     28        (WebCore::RenderObject::offsetTop): 
     29 
    1302006-06-13  Anders Carlsson  <acarlsson@apple.com> 
    231 
  • trunk/WebCore/rendering/RenderBox.cpp

    r14759 r14847  
    763763        } 
    764764 
    765         if (isRelPositioned()) 
    766             relativePositionOffset(xPos, yPos); 
     765        if (isRelPositioned()) { 
     766            xPos += relativePositionOffsetX(); 
     767            yPos += relativePositionOffsetY();             
     768        } 
    767769 
    768770        return true; 
     
    934936} 
    935937 
    936 void RenderBox::relativePositionOffset(int &tx, int &ty) 
    937 { 
     938int RenderBox::relativePositionOffsetX() const 
     939{ 
     940    int tx = 0; 
    938941    if(!style()->left().isAuto()) 
    939         tx += style()->left().calcValue(containingBlockWidth()); 
     942        tx = style()->left().calcValue(containingBlockWidth()); 
    940943    else if(!style()->right().isAuto()) 
    941         tx -= style()->right().calcValue(containingBlockWidth()); 
     944        tx = -style()->right().calcValue(containingBlockWidth()); 
     945    return tx; 
     946} 
     947 
     948int RenderBox::relativePositionOffsetY() const 
     949{ 
     950    int ty = 0; 
    942951    if(!style()->top().isAuto()) 
    943952    { 
    944953        if (!style()->top().isPercent() 
    945954                || containingBlock()->style()->height().isFixed()) 
    946             ty += style()->top().calcValue(containingBlockHeight()); 
     955            ty = style()->top().calcValue(containingBlockHeight()); 
    947956    } 
    948957    else if(!style()->bottom().isAuto()) 
     
    950959        if (!style()->bottom().isPercent() 
    951960                || containingBlock()->style()->height().isFixed()) 
    952             ty -= style()->bottom().calcValue(containingBlockHeight()); 
    953     } 
     961            ty = -style()->bottom().calcValue(containingBlockHeight()); 
     962    } 
     963    return ty; 
    954964} 
    955965 
     
    23662376int RenderBox::lowestPosition(bool includeOverflowInterior, bool includeSelf) const 
    23672377{ 
    2368     return includeSelf ? m_height : 0; 
     2378    if (!includeSelf || !m_width) 
     2379        return 0; 
     2380    int bottom = m_height; 
     2381    if (isRelPositioned()) 
     2382        bottom += relativePositionOffsetY(); 
     2383    return bottom; 
    23692384} 
    23702385 
    23712386int RenderBox::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const 
    23722387{ 
    2373     return includeSelf ? m_width : 0; 
     2388    if (!includeSelf || !m_height) 
     2389        return 0; 
     2390    int right = m_width; 
     2391    if (isRelPositioned()) 
     2392        right += relativePositionOffsetX(); 
     2393    return right; 
    23742394} 
    23752395 
    23762396int RenderBox::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const 
    23772397{ 
    2378     return includeSelf ? 0 : m_width; 
    2379 } 
    2380  
    2381 } 
     2398    if (!includeSelf || !m_height) 
     2399        return m_width; 
     2400    int left = 0; 
     2401    if (isRelPositioned()) 
     2402        left += relativePositionOffsetX(); 
     2403    return left; 
     2404} 
     2405 
     2406} 
  • trunk/WebCore/rendering/RenderBox.h

    r14727 r14847  
    133133    void calcVerticalMargins(); 
    134134 
    135     void relativePositionOffset(int &tx, int &ty); 
     135    int relativePositionOffsetX() const; 
     136    int relativePositionOffsetY() const; 
    136137 
    137138    virtual RenderLayer* layer() const { return m_layer; } 
  • trunk/WebCore/rendering/RenderFlow.cpp

    r14638 r14847  
    517517{ 
    518518    assert(!isInlineFlow()); 
    519     int bottom = RenderContainer::lowestPosition(includeOverflowInterior, includeSelf); 
     519    int bottom = includeSelf && m_width > 0 ? m_height : 0; 
    520520    if (!includeOverflowInterior && hasOverflowClip()) 
    521521        return bottom; 
     
    531531        } 
    532532    } 
     533  
     534    if (isRelPositioned()) 
     535        bottom += relativePositionOffsetY();          
    533536     
    534537    return bottom; 
     
    538541{ 
    539542    assert(!isInlineFlow()); 
    540     int right = RenderContainer::rightmostPosition(includeOverflowInterior, includeSelf); 
     543    int right = includeSelf && m_height > 0 ? m_width : 0; 
    541544    if (!includeOverflowInterior && hasOverflowClip()) 
    542545        return right; 
     
    553556    } 
    554557     
     558    if (isRelPositioned()) 
     559        right += relativePositionOffsetX(); 
     560     
    555561    return right; 
    556562} 
     
    559565{ 
    560566    assert(!isInlineFlow()); 
    561     int left = RenderContainer::leftmostPosition(includeOverflowInterior, includeSelf); 
     567    int left = includeSelf && m_height > 0 ? 0 : m_width; 
    562568    if (!includeOverflowInterior && hasOverflowClip()) 
    563569        return left; 
     
    574580    } 
    575581     
     582    if (isRelPositioned()) 
     583        left += relativePositionOffsetX();  
     584         
    576585    return left; 
    577586} 
  • trunk/WebCore/rendering/RenderLayer.cpp

    r14809 r14847  
    264264    m_relX = m_relY = 0; 
    265265    if (m_object->isRelPositioned()) { 
    266         static_cast<RenderBox*>(m_object)->relativePositionOffset(m_relX, m_relY); 
     266        m_relX = static_cast<RenderBox*>(m_object)->relativePositionOffsetX(); 
     267        m_relY = static_cast<RenderBox*>(m_object)->relativePositionOffsetY(); 
    267268        x += m_relX; y += m_relY; 
    268269    } 
  • trunk/WebCore/rendering/RenderObject.cpp

    r14827 r14847  
    550550    int x = xPos(); 
    551551    if (!isPositioned()) { 
    552         if (isRelPositioned()) { 
    553             int y = 0; 
    554             ((RenderBox*)this)->relativePositionOffset(x, y); 
    555         } 
     552        if (isRelPositioned()) 
     553            x += ((RenderBox*)this)->relativePositionOffsetX(); 
    556554         
    557555        RenderObject* offsetPar = offsetParent(); 
     
    569567    int y = yPos(); 
    570568    if (!isPositioned()) { 
    571         if (isRelPositioned()) { 
    572             int x = 0; 
    573             ((RenderBox*)this)->relativePositionOffset(x, y); 
    574         } 
     569        if (isRelPositioned()) 
     570            y += ((RenderBox*)this)->relativePositionOffsetY(); 
    575571        RenderObject* offsetPar = offsetParent(); 
    576572        RenderObject* curr = parent();