Title: [137960] trunk
- Revision
- 137960
- Author
- [email protected]
- Date
- 2012-12-17 16:59:26 -0800 (Mon, 17 Dec 2012)
Log Message
Percentage width replaced element incorrectly rendered when intrinsic size changed
https://bugs.webkit.org/show_bug.cgi?id=102784
Patch by KyungTae Kim <[email protected]> on 2012-12-17
Reviewed by Tony Chang.
Source/WebCore:
To make relayout when the image dimension is changed,
and if the logical width is percent type and the containing block fits to it.
In this case, the containing block's width need to be updated first,
because the 'newWidth' was calculated from the 'old containing block width'.
Test: fast/css/percent-width-img-src-change.html
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageDimensionsChanged):
LayoutTests:
Add test to check when the source of images with percentage width is changed.
* fast/css/percent-width-img-src-change.html: Added.
* fast/css/percent-width-img-src-change-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (137959 => 137960)
--- trunk/LayoutTests/ChangeLog 2012-12-18 00:44:40 UTC (rev 137959)
+++ trunk/LayoutTests/ChangeLog 2012-12-18 00:59:26 UTC (rev 137960)
@@ -1,3 +1,15 @@
+2012-12-17 KyungTae Kim <[email protected]>
+
+ Percentage width replaced element incorrectly rendered when intrinsic size changed
+ https://bugs.webkit.org/show_bug.cgi?id=102784
+
+ Reviewed by Tony Chang.
+
+ Add test to check when the source of images with percentage width is changed.
+
+ * fast/css/percent-width-img-src-change.html: Added.
+ * fast/css/percent-width-img-src-change-expected.txt: Added.
+
2012-12-17 Simon Fraser <[email protected]>
Fix repositioning of fixed elements on zooming
Added: trunk/LayoutTests/fast/css/percent-width-img-src-change-expected.txt (0 => 137960)
--- trunk/LayoutTests/fast/css/percent-width-img-src-change-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/percent-width-img-src-change-expected.txt 2012-12-18 00:59:26 UTC (rev 137960)
@@ -0,0 +1,3 @@
+PASS
+
+
Added: trunk/LayoutTests/fast/css/percent-width-img-src-change.html (0 => 137960)
--- trunk/LayoutTests/fast/css/percent-width-img-src-change.html (rev 0)
+++ trunk/LayoutTests/fast/css/percent-width-img-src-change.html 2012-12-18 00:59:26 UTC (rev 137960)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/_javascript_">
+var completed = 0, failures = 0, failuresDetail = "";
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+function printResult() {
+ document.getElementById("result").innerText = failures ? "FAIL: " + failures + " cases failed\n" + failuresDetail : "PASS";
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+function imageCheckForMax(image) {
+ if (image.src.match("greenbox.png") != null)
+ image.src = ""
+ else {
+ ++completed;
+ if (image.width != 100) {
+ ++failures;
+ failuresDetail += image.id + ": " + image.width + " (expected: " + 100 + ")\n";
+ }
+ if (completed == 4)
+ printResult();
+ }
+}
+</script>
+</head>
+
+<body>
+<div id="result"></div>
+<table>
+<tbody>
+<tr>
+<td>
+<img id="percentWidthInTable" style="width:100%;" src="" _onload_="imageCheckForMax(this)">
+</td>
+</tr>
+</tbody>
+</table>
+<table>
+<tbody>
+<tr>
+<td>
+<img id="percentMaxWidthInTable" style="max-width:100%;" src="" _onload_="imageCheckForMax(this)">
+</td>
+</tr>
+</tbody>
+</table>
+<div style="position:absolute;top:110px;left:110px">
+<img id="percentWidthInAbsolute" style="width:100%;" src="" _onload_="imageCheckForMax(this)">
+</div>
+<div style="position:absolute;top:220px;left:110px">
+<img id="percentMaxWidthInAbsolute" style="max-width:100%;" src="" _onload_="imageCheckForMax(this)">
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resources/greenbox-100px.png (0 => 137960)
--- trunk/LayoutTests/fast/css/resources/greenbox-100px.png (rev 0)
+++ trunk/LayoutTests/fast/css/resources/greenbox-100px.png 2012-12-18 00:59:26 UTC (rev 137960)
@@ -0,0 +1,11 @@
+\x89PNG
+
+
+IHDR d d \xFF\x80 sRGB \xAE\xCE\xE9 gAMA \xB1\x8F\xFCa pHYs \xC3 \xC3\xC7o\xA8d 9IDATx^\xEDұ
+ 0ð\xFC\xFFt\xDB\xA2\xB9<j"<sƶێ\xE9\x80B\xEA\\xB0\x82@H=V\xA9g\xC1
+!\xF5,XA \xA4\x9E+\x84Գ`\x81\x90z\xAC RςB\xEAY\xB0\x82@H=V\xA9g\xC1
+!\xF5,XA \xA4\x9E+\x84Գ`\x81\x90z\xAC RςB\xEAY\xB0\x82@H=V\xA9g\xC1
+!\xF5,XA \xA4\x9E+\x84Գ`\x81\x90z\xAC RςB\xEAY\xB0\x82@H=V\xA9g\xC1
+!\xF5,XA \xA4\x9E+\x84Գ`\x81\x90z\xAC RςB\xEAY\xB0\x82@H=V\xA9g\xC1
+!\xF5,XA \xA4\x9E+\x84Գ`\x81\x90z\xAC RςB\xEAY\xB0\x82@H=V\xA9g\xC1
+!\xF5,XA \xA4\x9E+\x84Գ`\x81\x90z\xAC RςB\xFA\xFD\xB3.\xB2\xF4\xEB+\xD5]Ú IEND\xAEB`\x82
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (137959 => 137960)
--- trunk/Source/WebCore/ChangeLog 2012-12-18 00:44:40 UTC (rev 137959)
+++ trunk/Source/WebCore/ChangeLog 2012-12-18 00:59:26 UTC (rev 137960)
@@ -1,3 +1,20 @@
+2012-12-17 KyungTae Kim <[email protected]>
+
+ Percentage width replaced element incorrectly rendered when intrinsic size changed
+ https://bugs.webkit.org/show_bug.cgi?id=102784
+
+ Reviewed by Tony Chang.
+
+ To make relayout when the image dimension is changed,
+ and if the logical width is percent type and the containing block fits to it.
+ In this case, the containing block's width need to be updated first,
+ because the 'newWidth' was calculated from the 'old containing block width'.
+
+ Test: fast/css/percent-width-img-src-change.html
+
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::imageDimensionsChanged):
+
2012-12-17 Beth Dakin <[email protected]>
DidHitRelevantRepaintedObjectsAreaThreshold should not use the viewRect since
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (137959 => 137960)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2012-12-18 00:44:40 UTC (rev 137959)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2012-12-18 00:59:26 UTC (rev 137960)
@@ -228,7 +228,15 @@
computeLogicalHeight(height(), 0, computedValues);
LayoutUnit newHeight = computedValues.m_extent;
- if (imageSizeChanged || width() != newWidth || height() != newHeight) {
+ // FIXME: We only need to recompute the containing block's preferred size
+ // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing).
+ // There's no easy way to detect that shrink-to-fit is needed, always force a layout.
+ bool containingBlockNeedsToRecomputePreferredSize =
+ style()->logicalWidth().type() == Percent
+ || style()->logicalMaxWidth().type() == Percent
+ || style()->logicalMinWidth().type() == Percent;
+
+ if (imageSizeChanged || width() != newWidth || height() != newHeight || containingBlockNeedsToRecomputePreferredSize) {
shouldRepaint = false;
if (!selfNeedsLayout())
setNeedsLayout(true);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes