Overflow cleanup
David Hyatt
hyatt at apple.com
Wed Apr 14 00:58:10 CEST 2004
This fixes a regression from 1.1 to 1.2 caused by the body scroll quirk
(that overflow applied to the body should apply to the document
scrollbars instead).
dave
-------------- next part --------------
Index: khtml/ecma/kjs_dom.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/ecma/kjs_dom.cpp,v
retrieving revision 1.48
diff -u -p -r1.48 khtml/ecma/kjs_dom.cpp
--- khtml/ecma/kjs_dom.cpp 2004/04/06 15:14:29 1.48
+++ khtml/ecma/kjs_dom.cpp 2004/04/13 00:04:57
@@ -396,13 +396,13 @@ void DOMNode::putValue(ExecState *exec,
break;
case ScrollTop: {
khtml::RenderObject *rend = node.handle() ? node.handle()->renderer() : 0L;
- if (rend && rend->layer() && rend->style()->hidesOverflow())
+ if (rend && rend->hasOverflowClip())
rend->layer()->scrollToYOffset(value.toInt32(exec));
break;
}
case ScrollLeft: {
khtml::RenderObject *rend = node.handle() ? node.handle()->renderer() : 0L;
- if (rend && rend->layer() && rend->style()->hidesOverflow())
+ if (rend && rend->hasOverflowClip())
rend->layer()->scrollToXOffset(value.toInt32(exec));
break;
}
Index: khtml/rendering/bidi.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/bidi.cpp,v
retrieving revision 1.91
diff -u -p -r1.91 khtml/rendering/bidi.cpp
--- khtml/rendering/bidi.cpp 2004/04/01 00:34:06 1.91
+++ khtml/rendering/bidi.cpp 2004/04/13 00:04:57
@@ -1322,7 +1322,7 @@ QRect RenderBlock::layoutInlineChildren(
m_height = borderTop() + paddingTop();
int toAdd = borderBottom() + paddingBottom();
- if (style()->hidesOverflow() && m_layer)
+ if (includeScrollbarSize())
toAdd += m_layer->horizontalScrollbarHeight();
// Figure out if we should clear out our line boxes.
Index: khtml/rendering/render_block.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_block.cpp,v
retrieving revision 1.107
diff -u -p -r1.107 khtml/rendering/render_block.cpp
--- khtml/rendering/render_block.cpp 2004/04/09 14:13:42 1.107
+++ khtml/rendering/render_block.cpp 2004/04/13 00:04:57
@@ -69,9 +69,10 @@ RenderBlock::~RenderBlock()
void RenderBlock::setStyle(RenderStyle* _style)
{
+ setReplaced(_style->isDisplayReplacedType());
+
RenderFlow::setStyle(_style);
- setReplaced(style()->display()==INLINE_BLOCK);
-
+
m_pre = false;
if (_style->whiteSpace() == PRE)
m_pre = true;
@@ -319,13 +320,6 @@ void RenderBlock::removeChild(RenderObje
}
}
-bool RenderBlock::requiresLayer() {
- // FIXME: The bogus table cell check is only here until we figure out how to position
- // table cells properly when they have layers.
- // Note that we also restrict overflow to blocks for now.
- return !isTableCell() && (RenderObject::requiresLayer() || (style()->hidesOverflow() && !isBody()));
-}
-
bool RenderBlock::isSelfCollapsingBlock() const
{
// We are not self-collapsing if we
@@ -436,7 +430,7 @@ void RenderBlock::layoutBlock(bool relay
m_maxBottomPosMargin = m_maxBottomNegMargin = 0;
}
- if (style()->scrollsOverflow() && m_layer) {
+ if (scrollsOverflow()) {
// For overflow:scroll blocks, ensure we have both scrollbars in place always.
if (style()->overflow() == OSCROLL) {
m_layer->setHasHorizontalScrollbar(true);
@@ -457,9 +451,9 @@ void RenderBlock::layoutBlock(bool relay
// Expand our intrinsic height to encompass floats.
int toAdd = borderBottom() + paddingBottom();
- if (style()->includeScrollbarSize() && m_layer)
+ if (includeScrollbarSize())
toAdd += m_layer->horizontalScrollbarHeight();
- if ( hasOverhangingFloats() && (isInlineBlockOrInlineTable() || isFloatingOrPositioned() || style()->hidesOverflow() ||
+ if ( hasOverhangingFloats() && (isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() ||
(parent() && parent()->isFlexibleBox())) )
m_height = floatBottom() + toAdd;
@@ -486,7 +480,7 @@ void RenderBlock::layoutBlock(bool relay
m_height += borderBottom() + paddingBottom();
}
- if (m_overflowHeight > m_height && !style()->hidesOverflow())
+ if (m_overflowHeight > m_height && !hasOverflowClip())
m_height = m_overflowHeight + borderBottom() + paddingBottom();
}
@@ -507,7 +501,7 @@ void RenderBlock::layoutBlock(bool relay
// Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
// we overflow or not.
- if (style()->hidesOverflow() && m_layer)
+ if (hasOverflowClip())
m_layer->updateScrollInfoAfterLayout();
// Repaint with our new bounds if they are different from our old bounds.
@@ -533,7 +527,7 @@ void RenderBlock::layoutBlockChildren( b
xPos = m_width - paddingRight() - borderRight();
int toAdd = borderBottom() + paddingBottom();
- if (style()->includeScrollbarSize() && m_layer)
+ if (includeScrollbarSize())
toAdd += m_layer->horizontalScrollbarHeight();
m_height = borderTop() + paddingTop();
@@ -564,7 +558,7 @@ void RenderBlock::layoutBlockChildren( b
// For now we only worry about the top border/padding. We will update the variable's
// value when it comes time to check against the bottom border/padding.
bool canCollapseWithChildren = !isCanvas() && !isRoot() && !isPositioned() &&
- !isFloating() && !isTableCell() && !style()->hidesOverflow() && !isInlineBlockOrInlineTable();
+ !isFloating() && !isTableCell() && !hasOverflowClip() && !isInlineBlockOrInlineTable();
bool canCollapseTopWithChildren = canCollapseWithChildren && (m_height == 0);
// If any height other than auto is specified in CSS, then we don't collapse our bottom
@@ -1035,7 +1029,7 @@ void RenderBlock::layoutBlockChildren( b
if (child->isRenderBlock() && !child->avoidsFloats())
prevFlow = static_cast<RenderBlock*>(child);
- if (child->hasOverhangingFloats() && !child->style()->hidesOverflow()) {
+ if (child->hasOverhangingFloats() && !child->hasOverflowClip()) {
// need to add the child's floats to our floating objects list, but not in the case where
// overflow is auto/scroll
addOverHangingFloats( static_cast<RenderBlock *>(child), -child->xPos(), -child->yPos(), true );
@@ -1248,7 +1242,7 @@ void RenderBlock::paintObject(PaintInfo&
// 2. paint contents
int scrolledX = _tx;
int scrolledY = _ty;
- if (style()->hidesOverflow() && m_layer)
+ if (hasOverflowClip())
m_layer->subtractScrollOffset(scrolledX, scrolledY);
for (RenderObject *child = firstChild(); child; child = child->nextSibling()) {
// Check for page-break-before: always, and if it's set, break and bail.
@@ -1590,7 +1584,7 @@ int
RenderBlock::rightOffset() const
{
int right = m_width - borderRight() - paddingRight();
- if (style()->includeScrollbarSize() && m_layer)
+ if (includeScrollbarSize())
right -= m_layer->verticalScrollbarWidth();
return right;
}
@@ -1666,7 +1660,7 @@ int
RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
{
int bottom = RenderFlow::lowestPosition(includeOverflowInterior, includeSelf);
- if (!includeOverflowInterior && style()->hidesOverflow())
+ if (!includeOverflowInterior && hasOverflowClip())
return bottom;
if (includeSelf && m_overflowHeight > bottom)
bottom = m_overflowHeight;
@@ -1704,7 +1698,7 @@ RenderBlock::lowestPosition(bool include
int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
int right = RenderFlow::rightmostPosition(includeOverflowInterior, includeSelf);
- if (!includeOverflowInterior && style()->hidesOverflow())
+ if (!includeOverflowInterior && hasOverflowClip())
return right;
if (includeSelf && m_overflowWidth > right)
right = m_overflowWidth;
@@ -1742,9 +1736,9 @@ int RenderBlock::rightmostPosition(bool
int RenderBlock::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
int left = RenderFlow::leftmostPosition(includeOverflowInterior, includeSelf);
- if (!includeOverflowInterior && style()->hidesOverflow())
+ if (!includeOverflowInterior && hasOverflowClip())
return left;
-
+
// FIXME: Check left overflow when we eventually support it.
if (m_floatingObjects) {
@@ -1965,7 +1959,7 @@ int RenderBlock::getClearDelta(RenderObj
bool RenderBlock::isPointInScrollbar(int _x, int _y, int _tx, int _ty)
{
- if (!style()->scrollsOverflow() || !m_layer)
+ if (!scrollsOverflow())
return false;
if (m_layer->verticalScrollbarWidth()) {
@@ -2003,7 +1997,7 @@ bool RenderBlock::nodeAtPoint(NodeInfo&
if (hitTestAction != HitTestSelfOnly && m_floatingObjects && !inScrollbar) {
int stx = _tx + xPos();
int sty = _ty + yPos();
- if (style()->hidesOverflow() && m_layer)
+ if (hasOverflowClip())
m_layer->subtractScrollOffset(stx, sty);
if (isCanvas()) {
stx += static_cast<RenderCanvas*>(this)->view()->contentsX();
@@ -2661,7 +2655,7 @@ void RenderBlock::updateFirstLetter()
bool RenderBlock::inRootBlockContext() const
{
- if (isTableCell() || isFloatingOrPositioned() || style()->hidesOverflow())
+ if (isTableCell() || isFloatingOrPositioned() || hasOverflowClip())
return false;
if (isRoot() || isCanvas())
Index: khtml/rendering/render_block.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_block.h,v
retrieving revision 1.35
diff -u -p -r1.35 khtml/rendering/render_block.h
--- khtml/rendering/render_block.h 2004/04/09 14:13:42 1.35
+++ khtml/rendering/render_block.h 2004/04/13 00:04:57
@@ -56,9 +56,9 @@ public:
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
// it would have an overflow height of borderTop() + paddingTop() + 100px.
virtual int overflowHeight(bool includeInterior=true) const
- { return (!includeInterior && style()->hidesOverflow()) ? m_height : m_overflowHeight; }
+ { return (!includeInterior && hasOverflowClip()) ? m_height : m_overflowHeight; }
virtual int overflowWidth(bool includeInterior=true) const
- { return (!includeInterior && style()->hidesOverflow()) ? m_width : m_overflowWidth; }
+ { return (!includeInterior && hasOverflowClip()) ? m_width : m_overflowWidth; }
virtual void setOverflowHeight(int h) { m_overflowHeight = h; }
virtual void setOverflowWidth(int w) { m_overflowWidth = w; }
@@ -181,9 +181,6 @@ public:
RootInlineBox* firstRootBox() { return static_cast<RootInlineBox*>(m_firstLineBox); }
RootInlineBox* lastRootBox() { return static_cast<RootInlineBox*>(m_lastLineBox); }
- // overrides RenderObject
- virtual bool requiresLayer();
-
// Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
// children.
virtual RenderBlock* firstLineBlock() const;
Index: khtml/rendering/render_box.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_box.cpp,v
retrieving revision 1.116
diff -u -p -r1.116 khtml/rendering/render_box.cpp
--- khtml/rendering/render_box.cpp 2004/04/06 15:25:15 1.116
+++ khtml/rendering/render_box.cpp 2004/04/13 00:04:57
@@ -75,7 +75,7 @@ void RenderBox::setStyle(RenderStyle *_s
setShouldPaintBackgroundOrBorder(true);
setInline(_style->isDisplayInlineType());
-
+
switch(_style->position())
{
case ABSOLUTE:
@@ -92,6 +92,13 @@ void RenderBox::setStyle(RenderStyle *_s
setRelPositioned(true);
}
+ // FIXME: Note that we restrict overflow to blocks for now. One day table bodies and cells
+ // 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()))
+ setHasOverflowClip();
+
if (requiresLayer()) {
if (!m_layer) {
m_layer = new (renderArena()) RenderLayer(this);
@@ -141,7 +148,7 @@ int RenderBox::contentWidth() const
int w = m_width - borderLeft() - borderRight();
w -= paddingLeft() + paddingRight();
- if (style()->includeScrollbarSize() && m_layer)
+ if (includeScrollbarSize())
w -= m_layer->verticalScrollbarWidth();
//kdDebug( 6040 ) << "RenderBox::contentWidth(2) = " << w << endl;
@@ -153,7 +160,7 @@ int RenderBox::contentHeight() const
int h = m_height - borderTop() - borderBottom();
h -= paddingTop() + paddingBottom();
- if (style()->includeScrollbarSize() && m_layer)
+ if (includeScrollbarSize())
h -= m_layer->horizontalScrollbarHeight();
return h;
@@ -520,24 +527,22 @@ int RenderBox::containingBlockWidth() co
bool RenderBox::absolutePosition(int &xPos, int &yPos, bool f)
{
- if ( style()->position() == FIXED )
+ if (style()->position() == FIXED)
f = true;
RenderObject *o = container();
- if( o && o->absolutePosition(xPos, yPos, f))
- {
- if (o->style()->hidesOverflow() && o->layer())
+ if (o && o->absolutePosition(xPos, yPos, f)) {
+ if (o->hasOverflowClip())
o->layer()->subtractScrollOffset(xPos, yPos);
- if(!isInline() || isReplaced())
+ if (!isInline() || isReplaced())
xPos += m_x, yPos += m_y;
- if(isRelPositioned())
+ if (isRelPositioned())
relativePositionOffset(xPos, yPos);
return true;
}
- else
- {
+ else {
xPos = yPos = 0;
return false;
}
@@ -629,9 +634,9 @@ void RenderBox::computeAbsoluteRepaintRe
RenderObject* o = container();
if (o) {
- // <body> may not have a layer, since it might be applying its overflow value to the
+ // <body> may not have overflow, since it might be applying its overflow value to the
// scrollbars.
- if (o->style()->hidesOverflow() && o->layer()) {
+ if (o->hasOverflowClip()) {
// o->height() is inaccurate if we're in the middle of a layout of |o|, so use the
// layer's size instead. Even if the layer's size is wrong, the layer itself will repaint
// anyway if its size does change.
@@ -1380,7 +1385,7 @@ void RenderBox::calcAbsoluteVertical()
if (m_height<h+pab) //content must still fit
m_height = h+pab;
- if (style()->hidesOverflow() && m_height > h+pab)
+ if (hasOverflowClip() && m_height > h+pab)
m_height = h+pab;
// Do not allow the height to be negative. This can happen when someone specifies both top and bottom
Index: khtml/rendering/render_flexbox.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_flexbox.cpp,v
retrieving revision 1.13
diff -u -p -r1.13 khtml/rendering/render_flexbox.cpp
--- khtml/rendering/render_flexbox.cpp 2004/02/26 23:10:44 1.13
+++ khtml/rendering/render_flexbox.cpp 2004/04/13 00:04:57
@@ -271,7 +271,7 @@ void RenderFlexibleBox::layoutBlock(bool
initMaxMarginValues();
- if (style()->scrollsOverflow() && m_layer) {
+ if (scrollsOverflow()) {
// For overflow:scroll blocks, ensure we have both scrollbars in place always.
if (style()->overflow() == OSCROLL) {
m_layer->setHasHorizontalScrollbar(true);
@@ -325,7 +325,7 @@ void RenderFlexibleBox::layoutBlock(bool
// Update our scrollbars if we're overflow:auto/scroll/hidden now that we know if
// we overflow or not.
- if (style()->hidesOverflow() && m_layer)
+ if (hasOverflowClip())
m_layer->updateScrollInfoAfterLayout();
// Repaint with our new bounds if they are different from our old bounds.
Index: khtml/rendering/render_flow.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_flow.cpp,v
retrieving revision 1.125
diff -u -p -r1.125 khtml/rendering/render_flow.cpp
--- khtml/rendering/render_flow.cpp 2004/04/01 00:34:06 1.125
+++ khtml/rendering/render_flow.cpp 2004/04/13 00:04:57
@@ -417,7 +417,7 @@ int
RenderFlow::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
{
int bottom = RenderBox::lowestPosition(includeOverflowInterior, includeSelf);
- if (!includeOverflowInterior && style()->hidesOverflow())
+ if (!includeOverflowInterior && hasOverflowClip())
return bottom;
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
@@ -437,7 +437,7 @@ RenderFlow::lowestPosition(bool includeO
int RenderFlow::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
int right = RenderBox::rightmostPosition(includeOverflowInterior, includeSelf);
- if (!includeOverflowInterior && style()->hidesOverflow())
+ if (!includeOverflowInterior && hasOverflowClip())
return right;
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
@@ -457,7 +457,7 @@ int RenderFlow::rightmostPosition(bool i
int RenderFlow::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
int left = RenderBox::leftmostPosition(includeOverflowInterior, includeSelf);
- if (!includeOverflowInterior && style()->hidesOverflow())
+ if (!includeOverflowInterior && hasOverflowClip())
return left;
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
Index: khtml/rendering/render_layer.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_layer.cpp,v
retrieving revision 1.73
diff -u -p -r1.73 khtml/rendering/render_layer.cpp
--- khtml/rendering/render_layer.cpp 2004/04/12 21:13:31 1.73
+++ khtml/rendering/render_layer.cpp 2004/04/13 00:04:57
@@ -190,7 +190,7 @@ void RenderLayer::updateLayerPosition()
setWidth(m_object->width());
setHeight(m_object->height());
- if (!m_object->style()->hidesOverflow()) {
+ if (!m_object->hasOverflowClip()) {
if (m_object->overflowWidth() > m_object->width())
setWidth(m_object->overflowWidth());
if (m_object->overflowHeight() > m_object->height())
@@ -640,7 +640,7 @@ RenderLayer::updateScrollInfoAfterLayout
}
// overflow:auto may need to lay out again if scrollbars got added/removed.
- bool scrollbarsChanged = (m_object->style()->hasAutoScrollbars()) &&
+ bool scrollbarsChanged = (m_object->hasAutoScrollbars()) &&
(haveHorizontalBar != needHorizontalBar || haveVerticalBar != needVerticalBar);
if (scrollbarsChanged) {
setHasHorizontalScrollbar(needHorizontalBar);
@@ -1015,7 +1015,7 @@ void RenderLayer::calculateRects(const R
bool RenderLayer::intersectsDamageRect(const QRect& layerBounds, const QRect& damageRect) const
{
return (renderer()->isCanvas() || renderer()->isRoot() || renderer()->isBody() ||
- (renderer()->hasOverhangingFloats() && !renderer()->style()->hidesOverflow()) ||
+ (renderer()->hasOverhangingFloats() && !renderer()->hasOverflowClip()) ||
(renderer()->isInline() && !renderer()->isReplaced()) ||
layerBounds.intersects(damageRect));
}
@@ -1023,7 +1023,7 @@ bool RenderLayer::intersectsDamageRect(c
bool RenderLayer::containsPoint(int x, int y, const QRect& damageRect) const
{
return (renderer()->isCanvas() || renderer()->isRoot() || renderer()->isBody() ||
- (renderer()->hasOverhangingFloats() && !renderer()->style()->hidesOverflow()) ||
+ (renderer()->hasOverhangingFloats() && !renderer()->hasOverflowClip()) ||
(renderer()->isInline() && !renderer()->isReplaced()) ||
damageRect.contains(x, y));
}
Index: khtml/rendering/render_object.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_object.cpp,v
retrieving revision 1.138
diff -u -p -r1.138 khtml/rendering/render_object.cpp
--- khtml/rendering/render_object.cpp 2004/04/12 21:13:32 1.138
+++ khtml/rendering/render_object.cpp 2004/04/13 00:04:57
@@ -147,7 +147,8 @@ m_inline( true ),
m_replaced( false ),
m_mouseInside( false ),
-m_isSelectionBorder( false )
+m_isSelectionBorder( false ),
+m_hasOverflowClip(false)
{
}
@@ -470,7 +471,8 @@ RenderLayer* RenderObject::enclosingLaye
bool RenderObject::requiresLayer()
{
- return isRoot() || isPositioned() || isRelPositioned() || style()->opacity() < 1.0f;
+ return isRoot() || isPositioned() || isRelPositioned() || style()->opacity() < 1.0f ||
+ m_hasOverflowClip;
}
RenderBlock* RenderObject::firstLineBlock() const
@@ -537,14 +539,14 @@ int
RenderObject::clientWidth() const
{
return width() - borderLeft() - borderRight() -
- (style()->includeScrollbarSize() && layer() ? layer()->verticalScrollbarWidth() : 0);
+ (includeScrollbarSize() ? layer()->verticalScrollbarWidth() : 0);
}
int
RenderObject::clientHeight() const
{
return height() - borderTop() - borderBottom() -
- (style()->includeScrollbarSize() && layer() ? layer()->horizontalScrollbarHeight() : 0);
+ (includeScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0);
}
// scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
@@ -552,13 +554,13 @@ RenderObject::clientHeight() const
int
RenderObject::scrollWidth() const
{
- return (style()->hidesOverflow() && layer()) ? layer()->scrollWidth() : overflowWidth();
+ return hasOverflowClip() ? layer()->scrollWidth() : overflowWidth();
}
int
RenderObject::scrollHeight() const
{
- return (style()->hidesOverflow() && layer()) ? layer()->scrollHeight() : overflowHeight();
+ return hasOverflowClip() ? layer()->scrollHeight() : overflowHeight();
}
bool
@@ -1400,6 +1402,7 @@ void RenderObject::setStyle(RenderStyle
m_positioned = false;
m_relPositioned = false;
m_paintBackground = false;
+ m_hasOverflowClip = false;
// no support for changing the display type dynamically... object must be
// detached and re-attached as a different type
//m_inline = true;
@@ -1485,7 +1488,7 @@ bool RenderObject::absolutePosition(int
RenderObject* o = parent();
if (o) {
o->absolutePosition(xPos, yPos, f);
- if (o->style()->hidesOverflow() && o->layer())
+ if (o->hasOverflowClip())
o->layer()->subtractScrollOffset(xPos, yPos);
return true;
}
@@ -1780,7 +1783,7 @@ bool RenderObject::nodeAtPoint(NodeInfo&
inside = false;
int stx = _tx + xPos();
int sty = _ty + yPos();
- if (style()->hidesOverflow() && layer())
+ if (hasOverflowClip())
layer()->subtractScrollOffset(stx, sty);
for (RenderObject* child = lastChild(); child; child = child->previousSibling())
if (!child->layer() && !child->isFloating() &&
@@ -2102,7 +2105,7 @@ void RenderObject::collectBorders(QValue
bool RenderObject::avoidsFloats() const
{
- return isReplaced() || isTable() || style()->hidesOverflow() || isHR() || isFlexibleBox();
+ return isReplaced() || isTable() || hasOverflowClip() || isHR() || isFlexibleBox();
}
bool RenderObject::usesLineWidth() const
Index: khtml/rendering/render_object.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_object.h,v
retrieving revision 1.108
diff -u -p -r1.108 khtml/rendering/render_object.h
--- khtml/rendering/render_object.h 2004/04/01 00:34:06 1.108
+++ khtml/rendering/render_object.h 2004/04/13 00:04:57
@@ -139,8 +139,7 @@ public:
virtual QRect getOverflowClipRect(int tx, int ty) { return QRect(0,0,0,0); }
virtual QRect getClipRect(int tx, int ty) { return QRect(0,0,0,0); }
bool hasClip() { return isPositioned() && style()->hasClip(); }
- bool hasOverflowClip() { return style()->hidesOverflow(); }
-
+
virtual int getBaselineOfFirstLineBox() { return -1; } // Tables and blocks implement this.
virtual InlineFlowBox* getFirstLineBox() { return 0; } // Tables and blocks implement this.
@@ -270,6 +269,14 @@ public:
bool isSelectionBorder() const { return m_isSelectionBorder; }
bool recalcMinMax() const { return m_recalcMinMax; }
+ bool hasOverflowClip() const { return m_hasOverflowClip; }
+ bool hasAutoScrollbars() const { return hasOverflowClip() &&
+ (style()->overflow() == OAUTO || style()->overflow() == OOVERLAY); }
+ bool scrollsOverflow() const { return hasOverflowClip() &&
+ (style()->overflow() == OSCROLL || hasAutoScrollbars()); }
+ bool includeScrollbarSize() const { return hasOverflowClip() &&
+ (style()->overflow() == OSCROLL || style()->overflow() == OAUTO); }
+
RenderStyle* getPseudoStyle(RenderStyle::PseudoId pseudo, RenderStyle* parentStyle = 0) const;
RenderCanvas* canvas() const;
@@ -319,6 +326,7 @@ public:
void setRenderText() { m_isText = true; }
void setReplaced(bool b=true) { m_replaced = b; }
void setIsSelectionBorder(bool b=true) { m_isSelectionBorder = b; }
+ void setHasOverflowClip(bool b = true) { m_hasOverflowClip = b; }
void scheduleRelayout();
@@ -770,6 +778,8 @@ private:
bool m_replaced : 1;
bool m_mouseInside : 1;
bool m_isSelectionBorder : 1;
+
+ bool m_hasOverflowClip : 1;
void arenaDelete(RenderArena *arena, void *objectBase);
Index: khtml/rendering/render_style.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_style.h,v
retrieving revision 1.54
diff -u -p -r1.54 khtml/rendering/render_style.h
--- khtml/rendering/render_style.h 2004/04/05 21:35:05 1.54
+++ khtml/rendering/render_style.h 2004/04/13 00:04:57
@@ -975,11 +975,6 @@ public:
const QColor & outlineColor() const { return background->outline.color; }
EOverflow overflow() const { return noninherited_flags._overflow; }
- bool hidesOverflow() const { return overflow() != OVISIBLE; }
- bool hasAutoScrollbars() const { return overflow() == OAUTO || overflow() == OOVERLAY; }
- bool scrollsOverflow() const { return overflow() == OSCROLL || hasAutoScrollbars(); }
- bool includeScrollbarSize() const { return overflow() == OSCROLL || overflow() == OAUTO; }
-
EVisibility visibility() const { return inherited_flags._visibility; }
EVerticalAlign verticalAlign() const { return noninherited_flags._vertical_align; }
Length verticalAlignLength() const { return box->vertical_align; }
@@ -1273,9 +1268,11 @@ public:
enum Diff { Equal, NonVisible = Equal, Visible, Position, Layout, CbLayout };
Diff diff( const RenderStyle *other ) const;
+ bool isDisplayReplacedType() {
+ return display() == INLINE_BLOCK || display() == INLINE_BOX || display() == INLINE_TABLE;
+ }
bool isDisplayInlineType() {
- return display() == INLINE || display() == INLINE_BLOCK || display() == INLINE_BOX ||
- display() == INLINE_TABLE;
+ return display() == INLINE || isDisplayReplacedType();
}
bool isOriginalDisplayInlineType() {
return originalDisplay() == INLINE || originalDisplay() == INLINE_BLOCK ||
Index: khtml/rendering/render_table.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_table.cpp,v
retrieving revision 1.98
diff -u -p -r1.98 khtml/rendering/render_table.cpp
--- khtml/rendering/render_table.cpp 2004/02/27 01:37:26 1.98
+++ khtml/rendering/render_table.cpp 2004/04/13 00:04:57
@@ -82,14 +82,8 @@ RenderTable::~RenderTable()
void RenderTable::setStyle(RenderStyle *_style)
{
ETableLayout oldTableLayout = style() ? style()->tableLayout() : TAUTO;
- if ( _style->display() == INLINE ) _style->setDisplay(INLINE_TABLE);
- if ( _style->display() != INLINE_TABLE ) _style->setDisplay(TABLE);
RenderBlock::setStyle(_style);
- // init RenderObject attributes
- setInline(style()->display()==INLINE_TABLE && !isPositioned());
- setReplaced(style()->display()==INLINE_TABLE);
-
// In the collapsed border model, there is no cell spacing.
hspacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing();
vspacing = collapseBorders() ? 0 : style()->verticalBorderSpacing();
@@ -1739,6 +1733,12 @@ void RenderTableCell::setStyle( RenderSt
RenderBlock::setStyle( style );
setShouldPaintBackgroundOrBorder(true);
+}
+
+bool RenderTableCell::requiresLayer() {
+ // FIXME: This is only here until we figure out how to position
+ // table cells properly when they have layers.
+ return false;
}
// The following rules apply for resolving conflicts and figuring out which border
Index: khtml/rendering/render_table.h
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_table.h,v
retrieving revision 1.36
diff -u -p -r1.36 khtml/rendering/render_table.h
--- khtml/rendering/render_table.h 2004/02/26 23:10:44 1.36
+++ khtml/rendering/render_table.h 2004/04/13 00:04:57
@@ -319,6 +319,9 @@ public:
virtual const char *renderName() const { return "RenderTableCell"; }
virtual bool isTableCell() const { return true; }
+ // overrides RenderObject
+ virtual bool requiresLayer();
+
// ### FIX these two...
long cellIndex() const { return 0; }
void setCellIndex( long ) { }
More information about the Khtml-devel
mailing list