[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:18:46 PST 2005


thatcher    05/11/12 16:18:45

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               khtml/css Tag: Safari-2-0-branch cssstyleselector.cpp
               khtml/rendering Tag: Safari-2-0-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-2-0-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.1.2.59  +40 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.1.2.58
  retrieving revision 1.1.2.59
  diff -u -r1.1.2.58 -r1.1.2.59
  --- ChangeLog	12 Nov 2005 23:37:09 -0000	1.1.2.58
  +++ ChangeLog	13 Nov 2005 00:18:33 -0000	1.1.2.59
  @@ -2,6 +2,46 @@
   
           Merged fix from TOT to Safari-2-0-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-2-0-branch
  +
       2005-11-11  Eric Seidel  <eseidel at apple.com>
   
           Reviewed by mjs.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.178.8.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.8.1
  diff -u -r1.178 -r1.178.8.1
  --- cssstyleselector.cpp	28 Feb 2005 22:51:25 -0000	1.178
  +++ cssstyleselector.cpp	13 Nov 2005 00:18:37 -0000	1.178.8.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.8.6 +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.8.5
  retrieving revision 1.179.8.6
  diff -u -r1.179.8.5 -r1.179.8.6
  --- render_block.cpp	28 Sep 2005 18:24:44 -0000	1.179.8.5
  +++ render_block.cpp	13 Nov 2005 00:18:38 -0000	1.179.8.6
  @@ -2424,9 +2424,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;
  @@ -2435,8 +2435,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();
  @@ -2471,7 +2471,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.6.3 +7 -7      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.6.2
  retrieving revision 1.149.6.3
  diff -u -r1.149.6.2 -r1.149.6.3
  --- render_box.cpp	12 Aug 2005 18:56:41 -0000	1.149.6.2
  +++ render_box.cpp	13 Nov 2005 00:18:39 -0000	1.149.6.3
  @@ -96,17 +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 handle <body> and <html>, whose overflow applies to the viewport.
  -    if (_style->overflow() != OVISIBLE && isBlockFlow() && !isTableCell() && !isRoot() && (!isBody() || !document()->isHTMLDocument()))
  +    if (_style->overflow() != OVISIBLE && isBlockFlow() && !isRoot() && (!isBody() || !document()->isHTMLDocument()))
           setHasOverflowClip();
   
       if (requiresLayer()) {
           if (!m_layer) {
               m_layer = new (renderArena()) RenderLayer(this);
               m_layer->insertOnlyThisLayer();
  -            if (containingBlock())
  +            if (parent() && containingBlock())
                   m_layer->updateLayerPositions();
           }
       }
  @@ -534,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.8.2  +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.8.1
  retrieving revision 1.53.8.2
  diff -u -r1.53.8.1 -r1.53.8.2
  --- render_box.h	9 Aug 2005 23:52:16 -0000	1.53.8.1
  +++ render_box.h	13 Nov 2005 00:18:39 -0000	1.53.8.2
  @@ -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();
       void calcAbsoluteHorizontalValues(WidthType widthType, RenderObject* cb, int cw, int pab, int static_distance,
  
  
  
  1.94.6.3  +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.6.2
  retrieving revision 1.94.6.3
  diff -u -r1.94.6.2 -r1.94.6.3
  --- render_layer.cpp	12 Nov 2005 01:57:15 -0000	1.94.6.2
  +++ render_layer.cpp	13 Nov 2005 00:18:39 -0000	1.94.6.3
  @@ -204,7 +204,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
  @@ -215,6 +215,7 @@
               y += curr->yPos();
               curr = curr->parent();
           }
  +        y += curr->borderTopExtra();
       }
   
       m_relX = m_relY = 0;
  @@ -268,7 +269,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())
  @@ -1025,7 +1026,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
  @@ -1057,7 +1058,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);
  @@ -1151,8 +1152,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
  @@ -1191,8 +1192,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.8.2 +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.8.1
  retrieving revision 1.191.8.2
  diff -u -r1.191.8.1 -r1.191.8.2
  --- render_object.cpp	5 Aug 2005 18:01:23 -0000	1.191.8.1
  +++ render_object.cpp	13 Nov 2005 00:18:40 -0000	1.191.8.2
  @@ -509,7 +509,7 @@
   bool RenderObject::requiresLayer()
   {
       return isRoot() || isPositioned() || isRelPositioned() || style()->opacity() < 1.0f ||
  -           m_hasOverflowClip;
  +           hasOverflowClip();
   }
   
   RenderBlock* RenderObject::firstLineBlock() const
  
  
  
  1.147.8.2 +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.8.1
  retrieving revision 1.147.8.2
  diff -u -r1.147.8.1 -r1.147.8.2
  --- render_object.h	5 Aug 2005 18:01:24 -0000	1.147.8.1
  +++ render_object.h	13 Nov 2005 00:18:41 -0000	1.147.8.2
  @@ -658,6 +658,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.8.2 +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.8.1
  retrieving revision 1.123.8.2
  diff -u -r1.123.8.1 -r1.123.8.2
  --- render_table.cpp	9 Aug 2005 23:52:16 -0000	1.123.8.1
  +++ render_table.cpp	13 Nov 2005 00:18:42 -0000	1.123.8.2
  @@ -1391,7 +1391,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
  @@ -1702,9 +1702,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
  @@ -2039,7 +2037,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();
  @@ -2253,8 +2251,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