Title: [176619] trunk
Revision
176619
Author
[email protected]
Date
2014-12-01 17:59:32 -0800 (Mon, 01 Dec 2014)

Log Message

Twitter avatar moves when hovering/unhovering the "follow" button.
https://bugs.webkit.org/show_bug.cgi?id=139147
rdar://problem/19096508

Reviewed by Simon Fraser.

This patch ensures that the out of flow positioned render boxes (RenderReplaced) do not
get repositioned when their inline box wrappers move.
Ideally, out of flow positioned renderers do not have inline wrappers by the time we start
placing inline boxes, but in certain case (optimized code path for descendantsHaveSameLineHeightAndBaseline()),
they are still part of the inline box tree.
This patch prevents those renderer boxes from getting positioned as part of the inline box placement.
They will get removed later at RenderBlockFlow::computeBlockDirectionPositionsForLine().

Source/WebCore:

Test: fast/inline/out-of-flow-positioned-render-replaced-box-moves.html

* rendering/InlineBox.cpp:
(WebCore::InlineBox::adjustPosition):

LayoutTests:

* fast/inline/out-of-flow-positioned-render-replaced-box-moves-expected.html: Added.
* fast/inline/out-of-flow-positioned-render-replaced-box-moves.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176618 => 176619)


--- trunk/LayoutTests/ChangeLog	2014-12-02 01:49:49 UTC (rev 176618)
+++ trunk/LayoutTests/ChangeLog	2014-12-02 01:59:32 UTC (rev 176619)
@@ -1,3 +1,22 @@
+2014-12-01  Zalan Bujtas  <[email protected]>
+
+        Twitter avatar moves when hovering/unhovering the "follow" button.
+        https://bugs.webkit.org/show_bug.cgi?id=139147
+        rdar://problem/19096508
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that the out of flow positioned render boxes (RenderReplaced) do not
+        get repositioned when their inline box wrappers move.
+        Ideally, out of flow positioned renderers do not have inline wrappers by the time we start
+        placing inline boxes, but in certain case (optimized code path for descendantsHaveSameLineHeightAndBaseline()),
+        they are still part of the inline box tree.
+        This patch prevents those renderer boxes from getting positioned as part of the inline box placement.
+        They will get removed later at RenderBlockFlow::computeBlockDirectionPositionsForLine().
+
+        * fast/inline/out-of-flow-positioned-render-replaced-box-moves-expected.html: Added.
+        * fast/inline/out-of-flow-positioned-render-replaced-box-moves.html: Added.
+
 2014-12-01  Daniel Bates  <[email protected]>
 
         [iOS] Unskip LayoutTests/dom tests

Added: trunk/LayoutTests/fast/inline/out-of-flow-positioned-render-replaced-box-moves-expected.html (0 => 176619)


--- trunk/LayoutTests/fast/inline/out-of-flow-positioned-render-replaced-box-moves-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/out-of-flow-positioned-render-replaced-box-moves-expected.html	2014-12-02 01:59:32 UTC (rev 176619)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when inline content gets changed (width changes), the out of flow positioned element on the same line does not move.</title>
+<style>
+  h2 {
+    display: inline; 
+    line-height: 300px;
+  }
+
+  img {
+    position: absolute;
+    top: 100px;
+    left: 100px;
+    width: 100px;
+    height: 100px;
+  }
+  
+  button {
+    width: 100px;
+  }
+</style>
+</head>
+<body>
+  <h2>
+    <a><img src=""
+  </h2>
+  <button>button</button>
+</body>
+</html>

Added: trunk/LayoutTests/fast/inline/out-of-flow-positioned-render-replaced-box-moves.html (0 => 176619)


--- trunk/LayoutTests/fast/inline/out-of-flow-positioned-render-replaced-box-moves.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/out-of-flow-positioned-render-replaced-box-moves.html	2014-12-02 01:59:32 UTC (rev 176619)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when inline content gets changed (width changes), the out of flow positioned element on the same line does not move.</title>
+<style>
+  h2 {
+    display: inline; 
+    line-height: 300px;
+  }
+
+  img {
+    position: absolute;
+    top: 100px;
+    left: 100px;
+    width: 100px;
+    height: 100px;
+  }
+</style>
+</head>
+<body>
+  <h2>
+    <a><img src=""
+  </h2>
+  <button id=changethis>button</button>
+  <script>
+    if (window.testRunner)
+      testRunner.waitUntilDone();
+    setTimeout(function() { 
+      document.getElementById("changethis").style.width = "100px";
+      if (window.testRunner)
+        testRunner.notifyDone();
+     }, 10);
+  </script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (176618 => 176619)


--- trunk/Source/WebCore/ChangeLog	2014-12-02 01:49:49 UTC (rev 176618)
+++ trunk/Source/WebCore/ChangeLog	2014-12-02 01:59:32 UTC (rev 176619)
@@ -1,3 +1,24 @@
+2014-12-01  Zalan Bujtas  <[email protected]>
+
+        Twitter avatar moves when hovering/unhovering the "follow" button.
+        https://bugs.webkit.org/show_bug.cgi?id=139147
+        rdar://problem/19096508
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that the out of flow positioned render boxes (RenderReplaced) do not
+        get repositioned when their inline box wrappers move.
+        Ideally, out of flow positioned renderers do not have inline wrappers by the time we start
+        placing inline boxes, but in certain case (optimized code path for descendantsHaveSameLineHeightAndBaseline()),
+        they are still part of the inline box tree.
+        This patch prevents those renderer boxes from getting positioned as part of the inline box placement.
+        They will get removed later at RenderBlockFlow::computeBlockDirectionPositionsForLine().
+
+        Test: fast/inline/out-of-flow-positioned-render-replaced-box-moves.html
+
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::adjustPosition):
+
 2014-12-01  Tim Horton  <[email protected]>
 
         Null deref under TextIndicator::createWithSelectionInFrame using find-in-page on bugzilla

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (176618 => 176619)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2014-12-02 01:49:49 UTC (rev 176618)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2014-12-02 01:59:32 UTC (rev 176619)
@@ -176,6 +176,9 @@
 {
     m_topLeft.move(dx, dy);
 
+    if (m_renderer.isOutOfFlowPositioned())
+        return;
+
     if (m_renderer.isReplaced())
         downcast<RenderBox>(renderer()).move(dx, dy);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to