[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/khtml/rendering
From: Allan Sandfeld Jensen <kde () carewolf ! com>
Date: 2006-10-14 14:32:01
Message-ID: 1160836321.868096.2628.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 595493 by carewolf:
Don't subtract margin from available-width + fix various width bugs that
revealed themselves up after fixing that.
BUG: 102536
M +15 -9 render_table.cpp
M +4 -0 render_table.h
M +6 -2 table_layout.cpp
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_table.cpp #595492:595493
@@ -233,27 +233,33 @@
RenderBlock *cb = containingBlock();
int availableWidth = cb->contentWidth();
- // Subtract minimum margins
- availableWidth -= style()->marginLeft().minWidth(cb->contentWidth());
- availableWidth -= style()->marginRight().minWidth(cb->contentWidth());
-
LengthType widthType = style()->width().type();
if(widthType > Relative && style()->width().value() > 0) {
// Percent or fixed table
- m_width = style()->width().minWidth( availableWidth );
+ m_width = calcBoxWidth(style()->width().minWidth( availableWidth ));
if(m_minWidth > m_width) m_width = m_minWidth;
} else {
- m_width = KMIN(short( availableWidth ), short(m_maxWidth));
+ // Subtract out any fixed margins from our available width for auto width tables.
+ int marginTotal = 0;
+ if (!style()->marginLeft().isVariable())
+ marginTotal += style()->marginLeft().width(availableWidth);
+ if (!style()->marginRight().isVariable())
+ marginTotal += style()->marginRight().width(availableWidth);
+
+ // Subtract out our margins to get the available content width.
+ int availContentWidth = kMax(0, availableWidth - marginTotal);
+
+ // Ensure we aren't bigger than our max width or smaller than our min width.
+ m_width = kMin(availContentWidth, m_maxWidth);
}
// restrict width to what we really have
// EXCEPT percent tables, which are still calculated as above
-
availableWidth = cb->lineWidth( m_y );
if ( widthType != Percent )
- m_width = KMIN( short( availableWidth ), m_width );
+ m_width = kMin( short( availableWidth ), m_width );
- m_width = KMAX (m_width, m_minWidth);
+ m_width = kMax (m_width, m_minWidth);
// Finally, with our true width determined, compute our margins for real.
m_marginRight=0;
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_table.h #595492:595493
@@ -73,6 +73,10 @@
int borderRight() const;
int borderTop() const;
int borderBottom() const;
+ int paddingLeft() const { return collapseBorders() ? 0 : RenderBlock::paddingLeft(); }
+ int paddingRight() const { return collapseBorders() ? 0 : RenderBlock::paddingRight(); }
+ int paddingTop() const { return collapseBorders() ? 0 : RenderBlock::paddingTop(); }
+ int paddingBottom() const { return collapseBorders() ? 0 : RenderBlock::paddingBottom(); }
const QColor &bgColor() const { return style()->backgroundColor(); }
--- branches/KDE/3.5/kdelibs/khtml/rendering/table_layout.cpp #595492:595493
@@ -233,7 +233,10 @@
// unlimited.
int bs = table->bordersPaddingAndSpacing();
- int tableWidth = table->style()->width().isFixed() ? table->style()->width().value() - bs : 0;
+ int tableWidth = 0;
+ if (table->style()->width().isFixed()) {
+ tableWidth = table->calcBoxWidth(table->style()->width().value());
+ }
int mw = calcWidthArray() + bs;
table->m_minWidth = kMin( kMax( mw, tableWidth ), 0x7fff );
@@ -599,7 +602,8 @@
Length tw = table->style()->width();
if ( tw.isFixed() && tw.value() > 0 ) {
- minWidth = kMax( minWidth, int( tw.value() ) );
+ int width = table->calcBoxWidth(tw.value());
+ minWidth = kMax( minWidth, width );
maxWidth = minWidth;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic