WebCore:
Reviewed by Dave Hyatt.
- fix https://bugs.webkit.org/show_bug.cgi?id=23739
<rdar://problem/6556371> REGRESSION (r36513): iframe isn't sized properly upon load
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::percentHeightDescendants): Added this accessor.
* rendering/RenderBlock.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows): Extended the check for
children that flex to include other descendants with percent height
which is relative to the cell.
LayoutTests:
Reviewed by Dave Hyatt.
- test, updated test and results for https://bugs.webkit.org/show_bug.cgi?id=23739
<rdar://problem/6556371> REGRESSION (r36513): iframe isn't sized properly upon load
* fast/replaced/percent-height-in-anonymous-block-in-table.html: Added.
* fast/replaced/table-percent-height-expected.txt:
* fast/replaced/table-percent-height.html:
* platform/mac/fast/replaced/percent-height-in-anonymous-block-in-table-expected.checksum: Added.
* platform/mac/fast/replaced/percent-height-in-anonymous-block-in-table-expected.png: Added.
* platform/mac/fast/replaced/percent-height-in-anonymous-block-in-table-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 0c83c5a..3f58506 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -537,17 +537,37 @@
(!table()->style()->height().isAuto() && rHeight != cell->height());
for (RenderObject* o = cell->firstChild(); o; o = o->nextSibling()) {
- if (!o->isText() && o->style()->height().isPercent() && (o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()) || flexAllChildren)) {
+ if (!o->isText() && o->style()->height().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) {
// Tables with no sections do not flex.
if (!o->isTable() || static_cast<RenderTable*>(o)->hasSections()) {
o->setNeedsLayout(true, false);
- cell->setChildNeedsLayout(true, false);
cellChildrenFlex = true;
}
}
}
-
+
+ if (HashSet<RenderBox*>* percentHeightDescendants = cell->percentHeightDescendants()) {
+ HashSet<RenderBox*>::iterator end = percentHeightDescendants->end();
+ for (HashSet<RenderBox*>::iterator it = percentHeightDescendants->begin(); it != end; ++it) {
+ RenderBox* box = *it;
+ if (!box->isReplaced() && !box->scrollsOverflow() && !flexAllChildren)
+ continue;
+
+ while (box != cell) {
+ if (box->normalChildNeedsLayout())
+ break;
+ box->setChildNeedsLayout(true, false);
+ box = box->containingBlock();
+ ASSERT(box);
+ if (!box)
+ break;
+ }
+ cellChildrenFlex = true;
+ }
+ }
+
if (cellChildrenFlex) {
+ cell->setChildNeedsLayout(true, false);
// Alignment within a cell is based off the calculated
// height, which becomes irrelevant once the cell has
// been resized based off its percentage.