Title: [105810] branches/chromium/963
- Revision
- 105810
- Author
- [email protected]
- Date
- 2012-01-24 14:25:32 -0800 (Tue, 24 Jan 2012)
Log Message
Merge 105768 - Incorrect positioning of floating pseudo-elements in table captions
BUG=105133
Review URL: https://chromiumcodereview.appspot.com/9271030
Modified Paths
Added Paths
Diff
Copied: branches/chromium/963/LayoutTests/fast/table/caption-encloses-overhanging-float-expected.html (from rev 105768, trunk/LayoutTests/fast/table/caption-encloses-overhanging-float-expected.html) (0 => 105810)
--- branches/chromium/963/LayoutTests/fast/table/caption-encloses-overhanging-float-expected.html (rev 0)
+++ branches/chromium/963/LayoutTests/fast/table/caption-encloses-overhanging-float-expected.html 2012-01-24 22:25:32 UTC (rev 105810)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ </head>
+ <body>
+ <!--
+ https://bugs.webkit.org/show_bug.cgi?id=76664
+ The 'a' should be in a red box that sits on the bottom left of an enclosing yellow box.
+ -->
+ <style>
+ .caption1 { background-color:yellow; width: 40px; display: inline-block;}
+ .fl { float: left; background-color:red;}
+ </style>
+ <div class="caption1">caption1<div class="fl">a</div></div>
+ </body>
+</html>
\ No newline at end of file
Copied: branches/chromium/963/LayoutTests/fast/table/caption-encloses-overhanging-float.html (from rev 105768, trunk/LayoutTests/fast/table/caption-encloses-overhanging-float.html) (0 => 105810)
--- branches/chromium/963/LayoutTests/fast/table/caption-encloses-overhanging-float.html (rev 0)
+++ branches/chromium/963/LayoutTests/fast/table/caption-encloses-overhanging-float.html 2012-01-24 22:25:32 UTC (rev 105810)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ </head>
+ <body>
+ <!--
+ https://bugs.webkit.org/show_bug.cgi?id=76664
+ The 'a' should be in a red box that sits on the bottom left of an enclosing yellow box.
+ -->
+ <style>
+ .caption1 { background-color:yellow; width: 40px; }
+ .fl { float: left; background-color:red;}
+ </style>
+ <table>
+ <caption class="caption1">caption1<div class="fl">a</div></caption>
+ </table>
+ </body>
+</html>
\ No newline at end of file
Modified: branches/chromium/963/Source/WebCore/rendering/RenderBlock.cpp (105809 => 105810)
--- branches/chromium/963/Source/WebCore/rendering/RenderBlock.cpp 2012-01-24 22:24:02 UTC (rev 105809)
+++ branches/chromium/963/Source/WebCore/rendering/RenderBlock.cpp 2012-01-24 22:25:32 UTC (rev 105810)
@@ -1497,7 +1497,7 @@
bool RenderBlock::expandsToEncloseOverhangingFloats() const
{
return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || (parent() && parent()->isDeprecatedFlexibleBox())
- || hasColumns() || isTableCell() || isFieldset() || isWritingModeRoot() || isRoot();
+ || hasColumns() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot();
}
void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo)
Modified: branches/chromium/963/Source/WebCore/rendering/RenderTable.cpp (105809 => 105810)
--- branches/chromium/963/Source/WebCore/rendering/RenderTable.cpp 2012-01-24 22:24:02 UTC (rev 105809)
+++ branches/chromium/963/Source/WebCore/rendering/RenderTable.cpp 2012-01-24 22:25:32 UTC (rev 105810)
@@ -266,11 +266,20 @@
}
}
-void RenderTable::adjustLogicalHeightForCaption(RenderBlock* caption)
+void RenderTable::layoutCaption(RenderTableCaption* caption)
{
IntRect captionRect(caption->x(), caption->y(), caption->width(), caption->height());
+ if (caption->needsLayout()) {
+ // The margins may not be available but ensure the caption is at least located beneath any previous sibling caption
+ // so that it does not mistakenly think any floats in the previous caption intrude into it.
+ caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->marginBefore() + logicalHeight()));
+ // If RenderTableCaption ever gets a layout() function, use it here.
+ caption->layoutIfNeeded();
+ }
+ // Apply the margins to the location now that they are definitely available from layout
caption->setLogicalLocation(IntPoint(caption->marginStart(), caption->marginBefore() + logicalHeight()));
+
if (!selfNeedsLayout() && caption->checkForRepaintDuringLayout())
caption->repaintDuringLayoutIfMoved(captionRect);
@@ -331,10 +340,6 @@
}
}
- // Only lay out one caption, since it's the only one we're going to end up painting.
- for (unsigned i = 0; i < m_captions.size(); i++)
- m_captions[i]->layoutIfNeeded();
-
// If any table section moved vertically, we will just repaint everything from that
// section down (it is quite unlikely that any of the following sections
// did not shift).
@@ -346,7 +351,7 @@
for (unsigned i = 0; i < m_captions.size(); i++) {
if (m_captions[i]->style()->captionSide() == CAPBOTTOM)
continue;
- adjustLogicalHeightForCaption(m_captions[i]);
+ layoutCaption(m_captions[i]);
}
if (logicalHeight() != oldTableLogicalTop) {
sectionMoved = true;
@@ -406,7 +411,7 @@
for (unsigned i = 0; i < m_captions.size(); i++) {
if (m_captions[i]->style()->captionSide() != CAPBOTTOM)
continue;
- adjustLogicalHeightForCaption(m_captions[i]);
+ layoutCaption(m_captions[i]);
}
if (isPositioned())
Modified: branches/chromium/963/Source/WebCore/rendering/RenderTable.h (105809 => 105810)
--- branches/chromium/963/Source/WebCore/rendering/RenderTable.h 2012-01-24 22:24:02 UTC (rev 105809)
+++ branches/chromium/963/Source/WebCore/rendering/RenderTable.h 2012-01-24 22:25:32 UTC (rev 105810)
@@ -248,7 +248,7 @@
void recalcCollapsedBorders();
void recalcSections() const;
- void adjustLogicalHeightForCaption(RenderBlock*);
+ void layoutCaption(RenderTableCaption*);
mutable Vector<LayoutUnit> m_columnPos;
mutable Vector<ColumnStruct> m_columns;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes