Title: [195212] releases/WebKitGTK/webkit-2.10
Revision
195212
Author
[email protected]
Date
2016-01-18 04:56:10 -0800 (Mon, 18 Jan 2016)

Log Message

Merge r194645 - Float with media query positioned incorrectly after window resize.
https://bugs.webkit.org/show_bug.cgi?id=152558

Reviewed by Simon Fraser and David Hyatt.

This patch ensures that when a renderer becomes floated, it is moved
to the right containing block.
When this floated renderer's previous sibling is an anonymous block, it needs
to be reparented so that the float is positioned as if there was no anonymous block at all.

Source/WebCore:

Test: fast/block/float/float-with-anonymous-previous-sibling.html

* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleDidChange):

LayoutTests:

* fast/block/float/float-with-anonymous-previous-sibling-expected.html: Added.
* fast/block/float/float-with-anonymous-previous-sibling.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (195211 => 195212)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2016-01-18 12:54:56 UTC (rev 195211)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2016-01-18 12:56:10 UTC (rev 195212)
@@ -1,5 +1,20 @@
 2016-01-06  Zalan Bujtas  <[email protected]>
 
+        Float with media query positioned incorrectly after window resize.
+        https://bugs.webkit.org/show_bug.cgi?id=152558
+
+        Reviewed by Simon Fraser and David Hyatt.
+
+        This patch ensures that when a renderer becomes floated, it is moved
+        to the right containing block.
+        When this floated renderer's previous sibling is an anonymous block, it needs
+        to be reparented so that the float is positioned as if there was no anonymous block at all.
+
+        * fast/block/float/float-with-anonymous-previous-sibling-expected.html: Added.
+        * fast/block/float/float-with-anonymous-previous-sibling.html: Added.
+
+2016-01-06  Zalan Bujtas  <[email protected]>
+
         isAnonymousInlineBlock() should exclude any ruby content.
         https://bugs.webkit.org/show_bug.cgi?id=152648
         <rdar://problem/23872549>

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/float/float-with-anonymous-previous-sibling-expected.html (0 => 195212)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/float/float-with-anonymous-previous-sibling-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/float/float-with-anonymous-previous-sibling-expected.html	2016-01-18 12:56:10 UTC (rev 195212)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that float is positioned properly when it is next to an anonymous block.</title>
+</head>
+<body>
+<span>foo</span>
+<div id="nextSibling"></div>
+<script>
+  if (window.testRunner)
+    testRunner.waitUntilDone();
+
+  setTimeout(function() {
+	var floatDiv = document.createElement("div");
+	floatDiv.style.float = "right";
+	floatDiv.innerText = "bar";
+    document.body.insertBefore(floatDiv, document.getElementById("nextSibling"));
+    if (window.testRunner)
+      testRunner.notifyDone();
+}, 0);
+</script>	
+</body></html>

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/float/float-with-anonymous-previous-sibling.html (0 => 195212)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/float/float-with-anonymous-previous-sibling.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/float/float-with-anonymous-previous-sibling.html	2016-01-18 12:56:10 UTC (rev 195212)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that float is positioned properly when it is next to an anonymous block.</title>
+</head>
+<body>
+<span>foo</span>
+<div id="float">bar</div>
+<div></div>
+<script>
+  if (window.testRunner)
+    testRunner.waitUntilDone();
+  setTimeout(function() {
+	document.getElementById("float").style.float = "right";
+	if (window.testRunner)
+	  testRunner.notifyDone();
+  }, 0);
+</script>	
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195211 => 195212)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2016-01-18 12:54:56 UTC (rev 195211)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2016-01-18 12:56:10 UTC (rev 195212)
@@ -1,5 +1,22 @@
 2016-01-06  Zalan Bujtas  <[email protected]>
 
+        Float with media query positioned incorrectly after window resize.
+        https://bugs.webkit.org/show_bug.cgi?id=152558
+
+        Reviewed by Simon Fraser and David Hyatt.
+
+        This patch ensures that when a renderer becomes floated, it is moved
+        to the right containing block.
+        When this floated renderer's previous sibling is an anonymous block, it needs
+        to be reparented so that the float is positioned as if there was no anonymous block at all.
+
+        Test: fast/block/float/float-with-anonymous-previous-sibling.html
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::styleDidChange):
+
+2016-01-06  Zalan Bujtas  <[email protected]>
+
         isAnonymousInlineBlock() should exclude any ruby content.
         https://bugs.webkit.org/show_bug.cgi?id=152648
         <rdar://problem/23872549>

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderElement.cpp (195211 => 195212)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderElement.cpp	2016-01-18 12:54:56 UTC (rev 195211)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderElement.cpp	2016-01-18 12:56:10 UTC (rev 195212)
@@ -973,8 +973,13 @@
     if (s_affectsParentBlock)
         handleDynamicFloatPositionChange();
 
-    if (s_noLongerAffectsParentBlock)
+    if (s_noLongerAffectsParentBlock) {
         removeAnonymousWrappersForInlinesIfNecessary();
+        // Fresh floats need to be reparented if they actually belong to the previous anonymous block.
+        // It copies the logic of RenderBlock::addChildIgnoringContinuation
+        if (style().isFloating() && previousSibling() && previousSibling()->isAnonymousBlock())
+            downcast<RenderBoxModelObject>(*parent()).moveChildTo(&downcast<RenderBoxModelObject>(*previousSibling()), this);
+    }
 
     SVGRenderSupport::styleChanged(*this, oldStyle);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to