Title: [116331] trunk
- Revision
- 116331
- Author
- [email protected]
- Date
- 2012-05-07 11:41:08 -0700 (Mon, 07 May 2012)
Log Message
Wrong positioning due to wrong width calculation wrt width:0
https://bugs.webkit.org/show_bug.cgi?id=50135
Patch by Pravin D <[email protected]> on 2012-05-07
Reviewed by Eric Seidel.
Source/WebCore:
Test: fast/block/block-parent-with-zero-width-child.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computePreferredLogicalWidths):
When width is fixed, the specified width must be taken, provided the value is positive.
Width=0 case was being ignored.
LayoutTests:
* fast/block/block-parent-with-zero-width-child-expected.txt: Added.
* fast/block/block-parent-with-zero-width-child.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (116330 => 116331)
--- trunk/LayoutTests/ChangeLog 2012-05-07 18:34:16 UTC (rev 116330)
+++ trunk/LayoutTests/ChangeLog 2012-05-07 18:41:08 UTC (rev 116331)
@@ -1,3 +1,13 @@
+2012-05-07 Pravin D <[email protected]>
+
+ Wrong positioning due to wrong width calculation wrt width:0
+ https://bugs.webkit.org/show_bug.cgi?id=50135
+
+ Reviewed by Eric Seidel.
+
+ * fast/block/block-parent-with-zero-width-child-expected.txt: Added.
+ * fast/block/block-parent-with-zero-width-child.html: Added.
+
2012-05-07 Dominik Röttsches <[email protected]>
[GTK] media/video-seek-past-end-playing.html times out
Added: trunk/LayoutTests/fast/block/block-parent-with-zero-width-child-expected.txt (0 => 116331)
--- trunk/LayoutTests/fast/block/block-parent-with-zero-width-child-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/block/block-parent-with-zero-width-child-expected.txt 2012-05-07 18:41:08 UTC (rev 116331)
@@ -0,0 +1,11 @@
+This tests if the parent block has the correct size when the child element has fixed width as zero.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("p_topRight").getClientRects()[0].width is 50
+PASS document.getElementById("p_botRight").getClientRects()[0].width is 50
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/block/block-parent-with-zero-width-child.html (0 => 116331)
--- trunk/LayoutTests/fast/block/block-parent-with-zero-width-child.html (rev 0)
+++ trunk/LayoutTests/fast/block/block-parent-with-zero-width-child.html 2012-05-07 18:41:08 UTC (rev 116331)
@@ -0,0 +1,73 @@
+<head>
+<title>Test case for bug https://bugs.webkit.org/show_bug.cgi?id=50135</title>
+<script src=""
+<style>
+
+.wrapper {
+ height: 70px;
+ width: 400px;
+ border: 1px solid red;
+ position: relative;
+ padding-top: 50px;
+ margin-bottom: 10px;
+}
+
+.wrapper p {
+ position: absolute;
+ margin: 0;
+}
+
+.wrapper p.topright {
+ top: 0;
+ right: 0;
+}
+
+.wrapper p.bottomright {
+ bottom: 0;
+ right: 0;
+}
+
+.wrapper p span {
+ display: block;
+ width: 0;
+ height: 50px;
+ padding-left: 50px;
+ overflow: hidden;
+ background: yellow;
+}
+
+</style>
+<script>
+function startTest(){
+
+shouldBe('document.getElementById("p_topRight").getClientRects()[0].width ', '50');
+shouldBe('document.getElementById("p_botRight").getClientRects()[0].width ', '50');
+isSuccessfullyParsed();
+
+// Cleanup
+var divList = document.getElementsByClassName('wrapper');
+while(divList.length){
+ var node = divList.item(divList.length - 1);
+ document.body.removeChild(node);
+}
+
+}
+</script>
+</head>
+<body _onload_="startTest();">
+<script>
+ description("This tests if the parent block has the correct size when the child element has fixed width as zero.")
+</script>
+<div class="wrapper">
+ The yellow cube should be positioned top-right
+ <p id="p_topRight" class="topright">
+ <span>This text is hidden</span>
+ </p>
+</div>
+<div class="wrapper">
+ The yellow cube should be positioned bottom-right
+ <p id="p_botRight" class="bottomright">
+ <span>This text is hidden</span>
+ </p>
+</div>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (116330 => 116331)
--- trunk/Source/WebCore/ChangeLog 2012-05-07 18:34:16 UTC (rev 116330)
+++ trunk/Source/WebCore/ChangeLog 2012-05-07 18:41:08 UTC (rev 116331)
@@ -1,3 +1,17 @@
+2012-05-07 Pravin D <[email protected]>
+
+ Wrong positioning due to wrong width calculation wrt width:0
+ https://bugs.webkit.org/show_bug.cgi?id=50135
+
+ Reviewed by Eric Seidel.
+
+ Test: fast/block/block-parent-with-zero-width-child.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::computePreferredLogicalWidths):
+ When width is fixed, the specified width must be taken, provided the value is positive.
+ Width=0 case was being ignored.
+
2012-05-07 Noel Gordon <[email protected]>
[CG] ImageBuffer::ImageDataToDataURL: Remove alpha stuffing when encoding to JPEG
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (116330 => 116331)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-05-07 18:34:16 UTC (rev 116330)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-05-07 18:41:08 UTC (rev 116331)
@@ -5160,7 +5160,7 @@
updateFirstLetter();
RenderStyle* styleToUse = style();
- if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() > 0 && style()->marqueeBehavior() != MALTERNATE)
+ if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() >= 0 && style()->marqueeBehavior() != MALTERNATE)
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(styleToUse->logicalWidth().value());
else {
m_minPreferredLogicalWidth = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes