diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderTable.cpp')
| -rw-r--r-- | Source/WebCore/rendering/RenderTable.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index be0046611..ee7c8b807 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -58,6 +58,7 @@ RenderTable::RenderTable(Node* node) , m_collapsedBordersValid(false) , m_hasColElements(false) , m_needsSectionRecalc(false) + , m_columnLogicalWidthChanged(false) , m_hSpacing(0) , m_vSpacing(0) , m_borderStart(0) @@ -255,10 +256,20 @@ void RenderTable::updateLogicalWidth() // Ensure we aren't smaller than our min preferred width. setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth())); + + // Ensure we aren't bigger than our max-width style. + Length styleMaxLogicalWidth = style()->logicalMaxWidth(); + if (styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative()) { + LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth, availableLogicalWidth); + setLogicalWidth(min<int>(logicalWidth(), computedMaxLogicalWidth)); + } + // Ensure we aren't smaller than our min-width style. Length styleMinLogicalWidth = style()->logicalMinWidth(); - if (styleMinLogicalWidth.isSpecified() && styleMinLogicalWidth.isPositive()) - setLogicalWidth(max<int>(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth))); + if (styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative()) { + LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth); + setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth)); + } // Finally, with our true width determined, compute our margins for real. setMarginStart(0); @@ -359,8 +370,6 @@ void RenderTable::layout() // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() ) m_tableLayout->layout(); - setCellLogicalWidths(); - LayoutUnit totalSectionLogicalHeight = 0; LayoutUnit oldTableLogicalTop = 0; for (unsigned i = 0; i < m_captions.size(); i++) @@ -370,8 +379,10 @@ void RenderTable::layout() for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isTableSection()) { - child->layoutIfNeeded(); RenderTableSection* section = toRenderTableSection(child); + if (m_columnLogicalWidthChanged) + section->setChildNeedsLayout(true, MarkOnlyThis); + section->layoutIfNeeded(); totalSectionLogicalHeight += section->calcRowLogicalHeight(); if (collapsing) section->recalcOuterBorder(); @@ -486,6 +497,7 @@ void RenderTable::layout() repaintRectangle(LayoutRect(movedSectionLogicalTop, visualOverflowRect().y(), visualOverflowRect().maxX() - movedSectionLogicalTop, visualOverflowRect().height())); } + m_columnLogicalWidthChanged = false; setNeedsLayout(false); } @@ -540,12 +552,6 @@ void RenderTable::addOverflowFromChildren() addOverflowFromChild(section); } -void RenderTable::setCellLogicalWidths() -{ - for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) - section->setCellLogicalWidths(); -} - void RenderTable::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { LayoutPoint adjustedPaintOffset = paintOffset + location(); @@ -590,11 +596,9 @@ void RenderTable::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs info.phase = paintPhase; info.updatePaintingRootForChildren(this); - IntPoint alignedOffset = roundedIntPoint(paintOffset); - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { - LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), alignedOffset); + LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), paintOffset); child->paint(info, childPoint); } } @@ -754,10 +758,9 @@ RenderTableCol* RenderTable::firstColumn() const return 0; } -RenderTableCol* RenderTable::colElement(unsigned col, bool* startEdge, bool* endEdge) const +RenderTableCol* RenderTable::slowColElement(unsigned col, bool* startEdge, bool* endEdge) const { - if (!m_hasColElements) - return 0; + ASSERT(m_hasColElements); unsigned columnCount = 0; for (RenderTableCol* columnRenderer = firstColumn(); columnRenderer; columnRenderer = columnRenderer->nextColumn()) { |
