Commit 80f45ebd authored by hyatt's avatar hyatt

Fix for bug 7841, tables, table rows, and table row groups should

        all support overflow:hidden.

        Reviewed by eric

        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::adjustRenderStyle):
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::layout):
        (WebCore::RenderTable::paint):
        (WebCore::RenderTable::getOverflowClipRect):
        * rendering/RenderTable.h:
        * rendering/RenderTableCol.h:
        (WebCore::RenderTableCol::requiresLayer):
        * rendering/RenderTableRow.h:
        (WebCore::RenderTableRow::requiresLayer):
        * rendering/render_box.cpp:
        (WebCore::RenderBox::setStyle):
        * rendering/render_layer.cpp:
        (WebCore::RenderLayer::paintLayer):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13372 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent aa2a71be
2006-03-18 David Hyatt <hyatt@apple.com>
Fix for bug 7841, tables, table rows, and table row groups should
all support overflow:hidden.
Reviewed by eric
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::adjustRenderStyle):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
(WebCore::RenderTable::paint):
(WebCore::RenderTable::getOverflowClipRect):
* rendering/RenderTable.h:
* rendering/RenderTableCol.h:
(WebCore::RenderTableCol::requiresLayer):
* rendering/RenderTableRow.h:
(WebCore::RenderTableRow::requiresLayer):
* rendering/render_box.cpp:
(WebCore::RenderBox::setStyle):
* rendering/render_layer.cpp:
(WebCore::RenderLayer::paintLayer):
2006-03-17 Alice Liu <alice.liu@apple.com>
Reviewed by Hyatt.
......@@ -1001,6 +1001,13 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, ElementImpl *e)
else
style->addToTextDecorationsInEffect(style->textDecoration());
// Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto.
// FIXME: Eventually table sections will support auto and scroll.
if (style->overflow() != OVISIBLE && style->overflow() != OHIDDEN &&
(style->display() == TABLE || style->display() == INLINE_TABLE ||
style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW))
style->setOverflow(OVISIBLE);
// Cull out any useless layers and also repeat patterns into additional layers.
style->adjustBackgroundLayers();
......
......@@ -264,7 +264,7 @@ void RenderTable::layout()
int calculatedHeight = 0;
RenderObject *child = firstChild();
while(child) {
while (child) {
// FIXME: What about a form that has a display value that makes it a table section?
if (child->needsLayout() && !(child->element() && child->element()->hasTagName(formTag)))
child->layout();
......@@ -386,6 +386,7 @@ void RenderTable::paint(PaintInfo& i, int _tx, int _ty)
// We're done. We don't bother painting any children.
if (paintAction == PaintActionBlockBackground)
return;
// We don't paint our own background, but we do let the kids paint their backgrounds.
if (paintAction == PaintActionChildBlockBackgrounds)
paintAction = PaintActionChildBlockBackground;
......@@ -770,6 +771,24 @@ void RenderTable::updateFirstLetter()
{
}
IntRect RenderTable::getOverflowClipRect(int tx, int ty)
{
IntRect rect = RenderBlock::getOverflowClipRect(tx, ty);
// If we have a caption, expand the clip to include the caption.
// FIXME: Technically this is wrong, but it's virtually impossible to fix this
// for real until captions have been re-written.
// FIXME: This code assumes (like all our other caption code) that only top/bottom are
// supported. When we actually support left/right and stop mapping them to top/bottom,
// we might have to hack this code first (depending on what order we do these bug fixes in).
if (tCaption) {
rect.setHeight(height());
rect.setY(ty);
}
return rect;
}
#ifndef NDEBUG
void RenderTable::dump(QTextStream *stream, QString ind) const
{
......
......@@ -158,6 +158,8 @@ public:
bool hasSections() const { return head || foot || firstBody; }
virtual IntRect getOverflowClipRect(int tx, int ty);
private:
void recalcSections();
......
......@@ -41,6 +41,7 @@ public:
virtual short lineHeight(bool) const { return 0; }
virtual void updateFromElement();
virtual bool canHaveChildren() const;
virtual bool requiresLayer() { return false; }
#ifndef NDEBUG
virtual void dump(QTextStream*, QString) const;
......
......@@ -48,7 +48,7 @@ public:
virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, HitTestAction action);
// The only time rows get a layer is when they have transparency.
virtual bool requiresLayer() { return isTransparent(); }
virtual bool requiresLayer() { return isTransparent() || hasOverflowClip(); }
virtual void paint(PaintInfo& i, int tx, int ty);
......
......@@ -93,10 +93,9 @@ void RenderBox::setStyle(RenderStyle *_style)
setRelPositioned(true);
}
// 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() && !isRoot() && (!isBody() || !document()->isHTMLDocument()))
if (_style->overflow() != OVISIBLE && !isRoot() && (!isBody() || !document()->isHTMLDocument()) &&
(isRenderBlock() || isTableRow() || isTableSection()))
setHasOverflowClip();
if (requiresLayer()) {
......
......@@ -1104,7 +1104,8 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
// Paint the background.
RenderObject::PaintInfo info(p, damageRect, PaintActionBlockBackground, paintingRootForRenderer);
renderer()->paint(info, x - renderer()->xPos(), y - renderer()->yPos() + renderer()->borderTopExtra());
renderer()->paint(info, x - renderer()->xPos(), y - renderer()->yPos() + renderer()->borderTopExtra());
// 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
// sit above the background/border.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment