Title: [203415] trunk
Revision
203415
Author
[email protected]
Date
2016-07-19 13:10:02 -0700 (Tue, 19 Jul 2016)

Log Message

theguardian.co.uk crossword puzzles are sometimes not displaying text
https://bugs.webkit.org/show_bug.cgi?id=159924
<rdar://problem/27409483>

Reviewed by Simon Fraser.

Source/WebCore:

This patch fixes the case when
- 2 disjoint subtrees are dirty
- RenderView is also dirty.
and we end up not laying out one of the 2 subtrees.

In FrameView::scheduleRelayoutOfSubtree, we assume that when the RenderView is dirty
we already have a pending full layout which means that any previous subtree layouts have already been
converted to full layouts.
However this assumption is incorrect. RenderView can get dirty without checking if there's
already a pending subtree layout.
One option to solve this problem would be to override RenderObject::setNeedsLayout in RenderView
so that when the RenderView gets dirty, we could also convert any pending subtree layout to full layout.
However RenderObject::setNeedsLayout is a hot function and making it virtual would impact performance.
The other option is to always normalize subtree layouts in FrameView::scheduleRelayoutOfSubtree().
This patch implements the second option.

Test: fast/misc/subtree-layouts.html

* page/FrameView.cpp:
(WebCore::FrameView::scheduleRelayoutOfSubtree):

LayoutTests:

* fast/misc/subtree-layouts-expected.html: Added.
* fast/misc/subtree-layouts.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203414 => 203415)


--- trunk/LayoutTests/ChangeLog	2016-07-19 20:07:38 UTC (rev 203414)
+++ trunk/LayoutTests/ChangeLog	2016-07-19 20:10:02 UTC (rev 203415)
@@ -1,3 +1,14 @@
+2016-07-19  Zalan Bujtas  <[email protected]>
+
+        theguardian.co.uk crossword puzzles are sometimes not displaying text
+        https://bugs.webkit.org/show_bug.cgi?id=159924
+        <rdar://problem/27409483>
+
+        Reviewed by Simon Fraser.
+
+        * fast/misc/subtree-layouts-expected.html: Added.
+        * fast/misc/subtree-layouts.html: Added.
+
 2016-07-19  Nan Wang  <[email protected]>
 
         AX: Incorrect behavior for word related text marker functions when there's collapsed whitespace

Added: trunk/LayoutTests/fast/misc/subtree-layouts-expected.html (0 => 203415)


--- trunk/LayoutTests/fast/misc/subtree-layouts-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/misc/subtree-layouts-expected.html	2016-07-19 20:10:02 UTC (rev 203415)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we layout both subtrees when they change the same time with selection on.</title>
+</head>
+<body>
+<div>
+  <svg height="30" width="200">
+    <text id=first x="0" y="15">second</text>
+  </svg>
+</div>
+<div>
+  <svg height="30" width="200">
+    <text id=second x="0" y="15">first</text>
+  </svg>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/misc/subtree-layouts.html (0 => 203415)


--- trunk/LayoutTests/fast/misc/subtree-layouts.html	                        (rev 0)
+++ trunk/LayoutTests/fast/misc/subtree-layouts.html	2016-07-19 20:10:02 UTC (rev 203415)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we layout both subtrees when they change the same time with selection on.</title>
+</head>
+<body>
+<div>
+  <svg height="30" width="200">
+    <text id=first x="0" y="15">first</text>
+  </svg>
+</div>
+<div>
+  <svg height="30" width="200">
+    <text id=second x="0" y="15">second</text>
+  </svg>
+</div>
+
+<script>
+if (window.testRunner)
+  testRunner.waitUntilDone();
+var selection = window.getSelection();
+var range = document.createRange();
+range.selectNodeContents(document.getElementById("second"));
+selection.addRange(range);
+
+setTimeout(function() {
+  document.getElementById("first").textContent = "second";
+  document.getElementById("second").textContent = "first";
+  if (window.testRunner)
+    testRunner.notifyDone();
+}, 0);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (203414 => 203415)


--- trunk/Source/WebCore/ChangeLog	2016-07-19 20:07:38 UTC (rev 203414)
+++ trunk/Source/WebCore/ChangeLog	2016-07-19 20:10:02 UTC (rev 203415)
@@ -1,3 +1,32 @@
+2016-07-19  Zalan Bujtas  <[email protected]>
+
+        theguardian.co.uk crossword puzzles are sometimes not displaying text
+        https://bugs.webkit.org/show_bug.cgi?id=159924
+        <rdar://problem/27409483>
+
+        Reviewed by Simon Fraser.
+
+        This patch fixes the case when
+        - 2 disjoint subtrees are dirty
+        - RenderView is also dirty.
+        and we end up not laying out one of the 2 subtrees.
+
+        In FrameView::scheduleRelayoutOfSubtree, we assume that when the RenderView is dirty
+        we already have a pending full layout which means that any previous subtree layouts have already been
+        converted to full layouts.
+        However this assumption is incorrect. RenderView can get dirty without checking if there's
+        already a pending subtree layout.
+        One option to solve this problem would be to override RenderObject::setNeedsLayout in RenderView
+        so that when the RenderView gets dirty, we could also convert any pending subtree layout to full layout.
+        However RenderObject::setNeedsLayout is a hot function and making it virtual would impact performance.
+        The other option is to always normalize subtree layouts in FrameView::scheduleRelayoutOfSubtree().
+        This patch implements the second option.
+
+        Test: fast/misc/subtree-layouts.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scheduleRelayoutOfSubtree):
+
 2016-07-19  Anders Carlsson  <[email protected]>
 
         Some payment authorization status values should keep the sheet active

Modified: trunk/Source/WebCore/page/FrameView.cpp (203414 => 203415)


--- trunk/Source/WebCore/page/FrameView.cpp	2016-07-19 20:07:38 UTC (rev 203414)
+++ trunk/Source/WebCore/page/FrameView.cpp	2016-07-19 20:10:02 UTC (rev 203415)
@@ -2737,7 +2737,9 @@
     ASSERT(!renderView.documentBeingDestroyed());
     ASSERT(frame().view() == this);
 
-    if (renderView.needsLayout()) {
+    // When m_layoutRoot is already set, ignore the renderView's needsLayout bit
+    // since we need to resolve the conflict between the m_layoutRoot and newRelayoutRoot layouts.
+    if (renderView.needsLayout() && !m_layoutRoot) {
         m_layoutRoot = &newRelayoutRoot;
         convertSubtreeLayoutToFullLayout();
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to