Title: [128389] trunk
- Revision
- 128389
- Author
- [email protected]
- Date
- 2012-09-12 17:30:07 -0700 (Wed, 12 Sep 2012)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (128388 => 128389)
--- trunk/LayoutTests/ChangeLog 2012-09-13 00:18:07 UTC (rev 128388)
+++ trunk/LayoutTests/ChangeLog 2012-09-13 00:30:07 UTC (rev 128389)
@@ -1,3 +1,16 @@
+2012-09-12 Julien Chaffraix <[email protected]>
+
+ 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 <[email protected]>
Assert in NetscapePlugin::destroy() with async plugin init
Added: trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt (0 => 128389)
--- trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced-expected.txt 2012-09-13 00:30:07 UTC (rev 128389)
@@ -0,0 +1,4 @@
+This test checks that we add the right padding on a replaced element in vertical-writing mode.
+
+
+PASS
Added: trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced.html (0 => 128389)
--- trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced.html (rev 0)
+++ trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced.html 2012-09-13 00:30:07 UTC (rev 128389)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<head>
+<script src=""
+<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="" data-expected-height="100" data-expected-width="200"></img></div>
+</body>
Property changes on: trunk/LayoutTests/fast/replaced/vertical-writing-mode-max-logical-width-replaced.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt (0 => 128389)
--- trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths-expected.txt 2012-09-13 00:30:07 UTC (rev 128389)
@@ -0,0 +1,7 @@
+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...
Added: trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths.html (0 => 128389)
--- trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths.html (rev 0)
+++ trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths.html 2012-09-13 00:30:07 UTC (rev 128389)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<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=''>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>
Property changes on: trunk/LayoutTests/fast/table/bad-replaced-sizing-preferred-logical-widths.html
___________________________________________________________________
Added: svn:executable
Modified: trunk/Source/WebCore/ChangeLog (128388 => 128389)
--- trunk/Source/WebCore/ChangeLog 2012-09-13 00:18:07 UTC (rev 128388)
+++ trunk/Source/WebCore/ChangeLog 2012-09-13 00:30:07 UTC (rev 128389)
@@ -1,3 +1,30 @@
+2012-09-12 Julien Chaffraix <[email protected]>
+
+ 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 <[email protected]>
[CSS Shaders] Cached validated programs are destroyed and recreated when there is only one custom filter animating
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (128388 => 128389)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2012-09-13 00:18:07 UTC (rev 128388)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2012-09-13 00:30:07 UTC (rev 128389)
@@ -437,12 +437,26 @@
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));
Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (128388 => 128389)
--- trunk/Source/WebCore/rendering/RenderReplaced.h 2012-09-13 00:18:07 UTC (rev 128388)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h 2012-09-13 00:30:07 UTC (rev 128389)
@@ -67,6 +67,7 @@
virtual bool canHaveChildren() const { return false; }
+ LayoutUnit computeMaxPreferredLogicalWidth() const;
virtual void computePreferredLogicalWidths();
virtual void paintReplaced(PaintInfo&, const LayoutPoint&) { }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes