Commit 9dca48a0 authored by jchaffraix@webkit.org's avatar jchaffraix@webkit.org
Browse files

REGRESSION(r122501): replaced elements with percent width are wrongly size...

REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout
https://bugs.webkit.org/show_bug.cgi?id=95892

Reviewed by Ojan Vafai.

Source/WebCore:

r122501 exposed an issue in how preferred logical widths are computed on replaced objects. The code relies on the
logical width computation methods. Unfortunately the previous code relies on the layout information, which may not
be up-to-date during preferred logical width computation.

Test: fast/table/bad-replaced-sizing-preferred-logical-widths.html
      fast/replaced/vertical-writing-mode-max-logical-width.html

* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeMaxPreferredLogicalWidth):
Added this helper method. The main difference with the old code is that it handles the percent logical width
properly before calling the old code path. This is not totally right but before forking the whole code, it's
better to have more evidence that forking preferred logical widths and logical width computation is the way to go.

(WebCore::RenderReplaced::computePreferredLogicalWidths):
Changed to call computeMaxPreferredLogicalWidth. Also fixed an existing bug in vertical-writing modes where we would
add the wrong paddings and borders.

* rendering/RenderReplaced.h:
(RenderReplaced): Added computeMaxPreferredLogicalWidth.

LayoutTests:

* fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt: Added.
* fast/replaced/vertical-writing-mode-max-logical-width-replaced.html: Added.
* fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt: Added.
* fast/table/bad-replaced-sizing-preferred-logical-widths.html: Added.
* fast/table/resources/iframe.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 08d85a54
2012-09-12 Julien Chaffraix <jchaffraix@webkit.org>
REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout
https://bugs.webkit.org/show_bug.cgi?id=95892
Reviewed by Ojan Vafai.
* fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt: Added.
* fast/replaced/vertical-writing-mode-max-logical-width-replaced.html: Added.
* fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt: Added.
* fast/table/bad-replaced-sizing-preferred-logical-widths.html: Added.
* fast/table/resources/iframe.html: Added.
2012-09-12 Brady Eidson <beidson@apple.com>
 
Assert in NetscapePlugin::destroy() with async plugin init
This test checks that we add the right padding on a replaced element in vertical-writing mode.
PASS
<!DOCTYPE html>
<head>
<script src="../../resources/check-layout.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<style>
div {
line-height: 0px;
}
img {
padding-left: 100px;
background-color: blue;
}
</style>
</head>
<body onload="checkLayout('img')">
<p>This test checks that we add the right padding on a replaced element in vertical-writing mode.</p>
<div style="-webkit-writing-mode: vertical-lr;"><img src="resources/square-blue-100x100.png" data-expected-height="100" data-expected-width="200"></img></div>
</body>
Bug 95892: REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout.
This test checks that a replaced element inside an auto-table layout properly computes its preferred logical width.
PASS
dolor sit amet...
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/check-layout.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<style>
html {
width: 800px;
}
table {
width: 100%;
border-spacing: 0px;
}
td {
height: 25px;
padding: 0px;
}
</style>
</head>
<body onload="checkLayout('iframe')">
<p>Bug <a href='https://bugs.webkit.org/show_bug.cgi?id=95892'>95892</a>: REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout.</p>
<p>This test checks that a replaced element inside an auto-table layout properly computes its preferred logical width.</p>
<table align="middle">
<tbody>
<tr>
<td>
<div style="width:100%">
<iframe srcdoc="<!DOCTYPE html><p>Lorem Ipsum</p>" width="100%" data-expected-width="602"></iframe>
</div>
</td>
<td align="right" valign="middle">
<div>dolor sit amet...</div>
</td>
</tr>
</tbody>
</table>
</script>
</body>
</html>
2012-09-12 Julien Chaffraix <jchaffraix@webkit.org>
REGRESSION(r122501): replaced elements with percent width are wrongly size when inserted inside an auto-table layout
https://bugs.webkit.org/show_bug.cgi?id=95892
Reviewed by Ojan Vafai.
r122501 exposed an issue in how preferred logical widths are computed on replaced objects. The code relies on the
logical width computation methods. Unfortunately the previous code relies on the layout information, which may not
be up-to-date during preferred logical width computation.
Test: fast/table/bad-replaced-sizing-preferred-logical-widths.html
fast/replaced/vertical-writing-mode-max-logical-width.html
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeMaxPreferredLogicalWidth):
Added this helper method. The main difference with the old code is that it handles the percent logical width
properly before calling the old code path. This is not totally right but before forking the whole code, it's
better to have more evidence that forking preferred logical widths and logical width computation is the way to go.
(WebCore::RenderReplaced::computePreferredLogicalWidths):
Changed to call computeMaxPreferredLogicalWidth. Also fixed an existing bug in vertical-writing modes where we would
add the wrong paddings and borders.
* rendering/RenderReplaced.h:
(RenderReplaced): Added computeMaxPreferredLogicalWidth.
2012-09-12 Max Vujovic <mvujovic@adobe.com>
 
[CSS Shaders] Cached validated programs are destroyed and recreated when there is only one custom filter animating
......@@ -437,12 +437,26 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const
return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHeight());
}
LayoutUnit RenderReplaced::computeMaxPreferredLogicalWidth() const
{
Length logicalWidth = style()->logicalWidth();
// We cannot resolve any percent logical width here as the available logical
// width may not be set on our containing block.
if (logicalWidth.isPercent())
return intrinsicLogicalWidth();
// FIXME: We shouldn't be calling a logical width computing function in preferred
// logical widths computation as the layout information is probably invalid.
return computeReplacedLogicalWidth(false);
}
void RenderReplaced::computePreferredLogicalWidths()
{
ASSERT(preferredLogicalWidthsDirty());
LayoutUnit borderAndPadding = borderAndPaddingWidth();
m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding;
LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
m_maxPreferredLogicalWidth = computeMaxPreferredLogicalWidth() + borderAndPadding;
if (style()->maxWidth().isFixed())
m_maxPreferredLogicalWidth = min<LayoutUnit>(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : ZERO_LAYOUT_UNIT));
......
......@@ -67,6 +67,7 @@ private:
virtual bool canHaveChildren() const { return false; }
LayoutUnit computeMaxPreferredLogicalWidth() const;
virtual void computePreferredLogicalWidths();
virtual void paintReplaced(PaintInfo&, const LayoutPoint&) { }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment