[webkit-changes] cvs commit: WebCore/khtml/rendering render_block.cpp render_box.cpp render_box.h render_layer.cpp render_object.cpp render_object.h render_table.cpp

Timothy thatcher at opensource.apple.com
Sat Nov 12 16:20:06 PST 2005


thatcher    05/11/12 16:20:06

  Modified:    .        Tag: Safari-1-3-branch ChangeLog
               khtml/css Tag: Safari-1-3-branch cssstyleselector.cpp
               khtml/rendering Tag: Safari-1-3-branch render_block.cpp
                        render_box.cpp render_box.h render_layer.cpp
                        render_object.cpp render_object.h render_table.cpp
  Log:
          Merged fix from TOT to Safari-1-3-branch
  
      2005-09-19  Beth Dakin  <bdakin at apple.com>
  
          Reviewed by Hyatt
  
          Test cases added: fast/table/overflowHidden.html
  
          Fixed <rdar://problem/3885711> (4047) CSS: Content displays incorrectly in tables with TD style set overflow:hidden
          Table cells render correctly with overflow:hidden, :auto, and :scroll specified. Cells now have a layer when overflow is specified.
  
          * khtml/css/cssstyleselector.cpp: Make sure table cells do not honor position:relative
          (khtml::CSSStyleSelector::adjustRenderStyle):
          * khtml/rendering/render_block.cpp: Add borderTopExtra() and borderBottomExtra() to various calculations of table cell height so that scroll bars render properly.
          (khtml::RenderBlock::isPointInScrollbar):
          (khtml::RenderBlock::nodeAtPoint):
          * khtml/rendering/render_box.cpp: Allow table cells to have overflow, and add borderTopExtra() and borderBottomExtra() to calculation of the clip rect.
          (RenderBox::setStyle):
          (RenderBox::getOverflowClipRect):
          * khtml/rendering/render_box.h: Removed definitions of borderTopExtra() and borderBottomExtra() so that they occur at the RenderObject level now.
          * khtml/rendering/render_layer.cpp: Layers must also take borderTopExtra() and borderBottomExtra() into account.
          (khtml::RenderLayer::updateLayerPosition):
          (khtml::RenderLayer::paintLayer):
          (khtml::RenderLayer::hitTestLayer):
          * khtml/rendering/render_object.cpp: Use m_overflowClip instead of hasOverflowClip() for consistency.
          (RenderObject::requiresLayer):
          * khtml/rendering/render_object.h: Add definitions of borderTopExtra() and borderBottomExtra() to RenderObject level.
          (khtml::RenderObject::borderTopExtra):
          (khtml::RenderObject::borderBottomExtra):
          * khtml/rendering/render_table.cpp: Allow table cells to have a layer if overflow is specified.
          (RenderTableSection::paint):
          (RenderTableCell::requiresLayer):
          (RenderTableCell::paint):
          (RenderTableCell::paintBoxDecorations):
          * layout-tests/fast/table/029-expected.txt: This layout test now paints a layer because it specifies overflow:hidden
          * layout-tests/fast/table/overflowHidden-expected.txt: Added.
          * layout-tests/fast/table/overflowHidden.html: Added.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.335.2.18 +40 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.335.2.17
  retrieving revision 1.335.2.18
  diff -u -r1.335.2.17 -r1.335.2.18
  --- ChangeLog	12 Nov 2005 23:35:55 -0000	1.335.2.17
  +++ ChangeLog	13 Nov 2005 00:19:57 -0000	1.335.2.18
  @@ -2,6 +2,46 @@
   
           Merged fix from TOT to Safari-1-3-branch
   
  +    2005-09-19  Beth Dakin  <bdakin at apple.com>
  +
  +        Reviewed by Hyatt
  +
  +        Test cases added: fast/table/overflowHidden.html
  +
  +        Fixed <rdar://problem/3885711> (4047) CSS: Content displays incorrectly in tables with TD style set overflow:hidden
  +        Table cells render correctly with overflow:hidden, :auto, and :scroll specified. Cells now have a layer when overflow is specified.
  +
  +        * khtml/css/cssstyleselector.cpp: Make sure table cells do not honor position:relative
  +        (khtml::CSSStyleSelector::adjustRenderStyle):
  +        * khtml/rendering/render_block.cpp: Add borderTopExtra() and borderBottomExtra() to various calculations of table cell height so that scroll bars render properly.
  +        (khtml::RenderBlock::isPointInScrollbar):
  +        (khtml::RenderBlock::nodeAtPoint):
  +        * khtml/rendering/render_box.cpp: Allow table cells to have overflow, and add borderTopExtra() and borderBottomExtra() to calculation of the clip rect.
  +        (RenderBox::setStyle):
  +        (RenderBox::getOverflowClipRect):
  +        * khtml/rendering/render_box.h: Removed definitions of borderTopExtra() and borderBottomExtra() so that they occur at the RenderObject level now.
  +        * khtml/rendering/render_layer.cpp: Layers must also take borderTopExtra() and borderBottomExtra() into account.
  +        (khtml::RenderLayer::updateLayerPosition):
  +        (khtml::RenderLayer::paintLayer):
  +        (khtml::RenderLayer::hitTestLayer):
  +        * khtml/rendering/render_object.cpp: Use m_overflowClip instead of hasOverflowClip() for consistency.
  +        (RenderObject::requiresLayer):
  +        * khtml/rendering/render_object.h: Add definitions of borderTopExtra() and borderBottomExtra() to RenderObject level.
  +        (khtml::RenderObject::borderTopExtra):
  +        (khtml::RenderObject::borderBottomExtra):
  +        * khtml/rendering/render_table.cpp: Allow table cells to have a layer if overflow is specified.
  +        (RenderTableSection::paint):
  +        (RenderTableCell::requiresLayer):
  +        (RenderTableCell::paint):
  +        (RenderTableCell::paintBoxDecorations):
  +        * layout-tests/fast/table/029-expected.txt: This layout test now paints a layer because it specifies overflow:hidden
  +        * layout-tests/fast/table/overflowHidden-expected.txt: Added.
  +        * layout-tests/fast/table/overflowHidden.html: Added.
  +
  +2005-11-12  Timothy Hatcher  <timothy at apple.com>
  +
  +        Merged fix from TOT to Safari-1-3-branch
  +
       2005-11-11  Eric Seidel  <eseidel at apple.com>
   
           Reviewed by mjs.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.178.6.1 +3 -3      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.178
  retrieving revision 1.178.6.1
  diff -u -r1.178 -r1.178.6.1
  --- cssstyleselector.cpp	28 Feb 2005 22:51:25 -0000	1.178
  +++ cssstyleselector.cpp	13 Nov 2005 00:20:00 -0000	1.178.6.1
  @@ -940,9 +940,9 @@
           }
           
           // After performing the display mutation, check table rows.  We do not honor position:relative on
  -        // table rows.  This has been established in CSS2.1 (and caused a crash in containingBlock() on
  -        // some sites).
  -        if (style->display() == TABLE_ROW && style->position() == RELATIVE)
  +        // table rows or cells.  This has been established in CSS2.1 (and caused a crash in containingBlock()
  +        // on some sites).
  +        if ((style->display() == TABLE_ROW || style->display() == TABLE_CELL) && style->position() == RELATIVE)
               style->setPosition(STATIC);
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.179.6.3 +4 -5      WebCore/khtml/rendering/render_block.cpp
  
  Index: render_block.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
  retrieving revision 1.179.6.2
  retrieving revision 1.179.6.3
  diff -u -r1.179.6.2 -r1.179.6.3
  --- render_block.cpp	4 Nov 2005 06:05:01 -0000	1.179.6.2
  +++ render_block.cpp	13 Nov 2005 00:20:01 -0000	1.179.6.3
  @@ -2413,9 +2413,9 @@
   
       if (m_layer->verticalScrollbarWidth()) {
           QRect vertRect(_tx + width() - borderRight() - m_layer->verticalScrollbarWidth(),
  -                       _ty + borderTop(),
  +                       _ty + borderTop() - borderTopExtra(),
                          m_layer->verticalScrollbarWidth(),
  -                       height()-borderTop()-borderBottom());
  +                       height() + borderTopExtra() + borderBottomExtra() - borderTop() - borderBottom());
           if (vertRect.contains(_x, _y)) {
               RenderLayer::gScrollBar = m_layer->verticalScrollbar();
               return true;
  @@ -2424,8 +2424,8 @@
   
       if (m_layer->horizontalScrollbarHeight()) {
           QRect horizRect(_tx + borderLeft(),
  -                        _ty + height() - borderBottom() - m_layer->horizontalScrollbarHeight(),
  -                        width()-borderLeft()-borderRight(),
  +                        _ty + height() + borderTop() + borderBottomExtra() - m_layer->horizontalScrollbarHeight() - borderBottom(),
  +                        width() - borderLeft() - borderRight(),
                           m_layer->horizontalScrollbarHeight());
           if (horizRect.contains(_x, _y)) {
               RenderLayer::gScrollBar = m_layer->horizontalScrollbar();
  @@ -2460,7 +2460,6 @@
           }
       }
   
  -    // See if we're inside the scrollbar (if we're overflow:scroll/auto).
       if (isPointInScrollbar(_x, _y, tx, ty)) {
           if (hitTestAction == HitTestBlockBackground) {
               setInnerNode(info);
  
  
  
  1.149.4.1 +7 -8      WebCore/khtml/rendering/render_box.cpp
  
  Index: render_box.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_box.cpp,v
  retrieving revision 1.149
  retrieving revision 1.149.4.1
  diff -u -r1.149 -r1.149.4.1
  --- render_box.cpp	18 Mar 2005 20:41:58 -0000	1.149
  +++ render_box.cpp	13 Nov 2005 00:20:02 -0000	1.149.4.1
  @@ -96,18 +96,17 @@
               setRelPositioned(true);
       }
   
  -    // FIXME: Note that we restrict overflow to blocks for now.  One day table bodies and cells 
  +    // FIXME: Note that we restrict overflow to blocks for now.  One day table bodies
       // will need to support overflow.
       // We also deal with the body scroll quirk here, since it sets the scrollbars for the document.
  -    if (_style->overflow() != OVISIBLE && isBlockFlow() && !isTableCell() &&
  -        (!document()->isHTMLDocument() || !isBody()))
  +    if (_style->overflow() != OVISIBLE && isBlockFlow() && (!document()->isHTMLDocument() || !isBody()))
           setHasOverflowClip();
   
       if (requiresLayer()) {
           if (!m_layer) {
               m_layer = new (renderArena()) RenderLayer(this);
               m_layer->insertOnlyThisLayer();
  -            if (containingBlock())
  +            if (parent() && containingBlock())
                   m_layer->updateLayerPositions();
           }
       }
  @@ -535,10 +534,10 @@
       // XXX When overflow-clip (CSS3) is implemented, we'll obtain the property
       // here.
       int bl=borderLeft(),bt=borderTop(),bb=borderBottom(),br=borderRight();
  -    int clipx = tx+bl;
  -    int clipy = ty+bt;
  -    int clipw = m_width-bl-br;
  -    int cliph = m_height-bt-bb;
  +    int clipx = tx + bl;
  +    int clipy = ty + bt;
  +    int clipw = m_width - bl - br;
  +    int cliph = m_height - bt - bb + borderTopExtra() + borderBottomExtra();
   
       // Subtract out scrollbars if we have them.
       if (m_layer) {
  
  
  
  1.53.6.1  +0 -3      WebCore/khtml/rendering/render_box.h
  
  Index: render_box.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_box.h,v
  retrieving revision 1.53
  retrieving revision 1.53.6.1
  diff -u -r1.53 -r1.53.6.1
  --- render_box.h	7 Dec 2004 00:34:02 -0000	1.53
  +++ render_box.h	13 Nov 2005 00:20:02 -0000	1.53.6.1
  @@ -152,9 +152,6 @@
       void paintBackground(QPainter *p, const QColor& c, const BackgroundLayer* bgLayer, int clipy, int cliph, int _tx, int _ty, int w, int h);
       void outlineBox(QPainter *p, int _tx, int _ty, const char *color = "red");
   
  -    virtual int borderTopExtra() const { return 0; }
  -    virtual int borderBottomExtra() const { return 0; }
  -
       void calcAbsoluteHorizontal();
       void calcAbsoluteVertical();
   
  
  
  
  1.94.4.2  +9 -8      WebCore/khtml/rendering/render_layer.cpp
  
  Index: render_layer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.cpp,v
  retrieving revision 1.94.4.1
  retrieving revision 1.94.4.2
  diff -u -r1.94.4.1 -r1.94.4.2
  --- render_layer.cpp	12 Nov 2005 01:57:43 -0000	1.94.4.1
  +++ render_layer.cpp	13 Nov 2005 00:20:02 -0000	1.94.4.2
  @@ -200,7 +200,7 @@
           return;
       
       int x = m_object->xPos();
  -    int y = m_object->yPos();
  +    int y = m_object->yPos() - m_object->borderTopExtra();
   
       if (!m_object->isPositioned()) {
           // We must adjust our position by walking up the render tree looking for the
  @@ -211,6 +211,7 @@
               y += curr->yPos();
               curr = curr->parent();
           }
  +        y += curr->borderTopExtra();
       }
   
       m_relX = m_relY = 0;
  @@ -264,7 +265,7 @@
       setPos(x,y);
   
       setWidth(m_object->width());
  -    setHeight(m_object->height());
  +    setHeight(m_object->height() + m_object->borderTopExtra() + m_object->borderBottomExtra());
   
       if (!m_object->hasOverflowClip()) {
           if (m_object->overflowWidth() > m_object->width())
  @@ -1024,7 +1025,7 @@
   
           // Paint the background.
           RenderObject::PaintInfo info(p, damageRect, PaintActionBlockBackground, paintingRootForRenderer);
  -        renderer()->paint(info, x - renderer()->xPos(), y - renderer()->yPos());        
  +        renderer()->paint(info, x - renderer()->xPos(), y - renderer()->yPos() + renderer()->borderTopExtra());        
   #if APPLE_CHANGES
           // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with
           // z-index.  We paint after we painted the background/border, so that the scrollbars will
  @@ -1056,7 +1057,7 @@
           setClip(p, paintDirtyRect, clipRectToApply);
   
           int tx = x - renderer()->xPos();
  -        int ty = y - renderer()->yPos();
  +        int ty = y - renderer()->yPos() + renderer()->borderTopExtra();
           RenderObject::PaintInfo info(p, clipRectToApply, 
                                        selectionOnly ? PaintActionSelection : PaintActionChildBlockBackgrounds,
                                        paintingRootForRenderer);
  @@ -1150,8 +1151,8 @@
       // Next we want to see if the mouse pos is inside the child RenderObjects of the layer.
       if (containsPoint(xMousePos, yMousePos, fgRect) && 
           renderer()->hitTest(info, xMousePos, yMousePos,
  -                            layerBounds.x() - renderer()->xPos(),
  -                            layerBounds.y() - renderer()->yPos(), HitTestDescendants)) {
  +                            layerBounds.x() - renderer()->xPos() + m_object->borderLeft(),
  +                            layerBounds.y() - renderer()->yPos() + m_object->borderTopExtra() - m_object->borderBottom(), HitTestDescendants)) {
           // for positioned generated content, we might still not have a
           // node by the time we get to the layer level, since none of
           // the content in the layer has an element. So just walk up
  @@ -1190,8 +1191,8 @@
       // Next we want to see if the mouse pos is inside this layer but not any of its children.
       if (containsPoint(xMousePos, yMousePos, bgRect) &&
           renderer()->hitTest(info, xMousePos, yMousePos,
  -                            layerBounds.x() - renderer()->xPos(),
  -                            layerBounds.y() - renderer()->yPos(),
  +                            layerBounds.x() - renderer()->xPos() + m_object->borderLeft(),
  +                            layerBounds.y() - renderer()->yPos() + m_object->borderTopExtra() - m_object->borderBottom(),
                               HitTestSelf))
           return this;
   
  
  
  
  1.191.6.1 +1 -1      WebCore/khtml/rendering/render_object.cpp
  
  Index: render_object.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
  retrieving revision 1.191
  retrieving revision 1.191.6.1
  diff -u -r1.191 -r1.191.6.1
  --- render_object.cpp	2 Mar 2005 04:33:49 -0000	1.191
  +++ render_object.cpp	13 Nov 2005 00:20:03 -0000	1.191.6.1
  @@ -509,7 +509,7 @@
   bool RenderObject::requiresLayer()
   {
       return isRoot() || isPositioned() || isRelPositioned() || style()->opacity() < 1.0f ||
  -           m_hasOverflowClip;
  +           hasOverflowClip();
   }
   
   RenderBlock* RenderObject::firstLineBlock() const
  
  
  
  1.147.6.1 +2 -0      WebCore/khtml/rendering/render_object.h
  
  Index: render_object.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.h,v
  retrieving revision 1.147
  retrieving revision 1.147.6.1
  diff -u -r1.147 -r1.147.6.1
  --- render_object.h	14 Feb 2005 18:19:18 -0000	1.147
  +++ render_object.h	13 Nov 2005 00:20:03 -0000	1.147.6.1
  @@ -656,6 +656,8 @@
       
       virtual int borderTop() const { return style()->borderTopWidth(); }
       virtual int borderBottom() const { return style()->borderBottomWidth(); }
  +    virtual int borderTopExtra() const { return 0; }
  +    virtual int borderBottomExtra() const { return 0; }
       virtual int borderLeft() const { return style()->borderLeftWidth(); }
       virtual int borderRight() const { return style()->borderRightWidth(); }
   
  
  
  
  1.123.6.1 +16 -7     WebCore/khtml/rendering/render_table.cpp
  
  Index: render_table.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_table.cpp,v
  retrieving revision 1.123
  retrieving revision 1.123.6.1
  diff -u -r1.123 -r1.123.6.1
  --- render_table.cpp	16 Mar 2005 02:02:33 -0000	1.123
  +++ render_table.cpp	13 Nov 2005 00:20:03 -0000	1.123.6.1
  @@ -1385,7 +1385,7 @@
   		c--;
   	    for ( ; c < endcol; c++ ) {
   		RenderTableCell *cell = cellAt(r, c);
  -		if (!cell || cell == (RenderTableCell *)-1 )
  +		if (!cell || cell == (RenderTableCell *)-1 || (cell->layer() && i.phase != PaintActionCollapsedTableBorders))
   		    continue;
                   
                   // Cells must always paint in the order in which they appear taking into account
  @@ -1692,9 +1692,7 @@
   }
   
   bool RenderTableCell::requiresLayer() {
  -    // FIXME: This is only here until we figure out how to position
  -    // table cells properly when they have layers.
  -    return false;
  +    return isPositioned() || style()->opacity() < 1.0f || hasOverflowClip();
   }
   
   // The following rules apply for resolving conflicts and figuring out which border
  @@ -2029,7 +2027,7 @@
       int os = 2*maximalOutlineSize(i.phase);
       if ((_ty >= i.r.y() + i.r.height() + os) || (_ty + _topExtra + m_height + _bottomExtra <= i.r.y() - os))
           return;
  -    
  +
       if (i.phase == PaintActionCollapsedTableBorders && style()->visibility() == VISIBLE) {
           int w = width();
           int h = height() + borderTopExtra() + borderBottomExtra();
  @@ -2243,8 +2241,19 @@
       int end = kMin(i.r.y() + i.r.height(), _ty + h);
       int mh = end - my;
   
  -    if (bgLayer->hasImage() || c.isValid())
  -	paintBackground(i.p, c, bgLayer, my, mh, _tx, _ty, w, h);
  +    if (bgLayer->hasImage() || c.isValid()) {
  +       // We have to clip here because the backround would paint
  +        // on top of the borders otherwise.
  +        if (m_layer && tableElt->collapseBorders()) {
  +            QRect clipRect(_tx + borderLeft(), _ty + borderTop(), w - borderLeft() - borderRight(), h - borderTop() - borderBottom());
  +            clipRect = i.p->xForm(clipRect);
  +            i.p->save();
  +            i.p->addClip(clipRect);
  +        }
  +        paintBackground(i.p, c, bgLayer, my, mh, _tx, _ty, w, h);
  +        if (m_layer && tableElt->collapseBorders())
  +            i.p->restore();
  +    }
   
       if (style()->hasBorder() && !tableElt->collapseBorders())
           paintBorder(i.p, _tx, _ty, w, h, style());
  
  
  



More information about the webkit-changes mailing list