Title: [275606] trunk
Revision
275606
Author
commit-qu...@webkit.org
Date
2021-04-07 07:47:57 -0700 (Wed, 07 Apr 2021)

Log Message

Ignore non-null lastQuote ASSERT when continuation is broken
https://bugs.webkit.org/show_bug.cgi?id=218576

Patch by Rob Buis <rb...@igalia.com> on 2021-04-07
Reviewed by Zalan Bujtas.

Source/WebCore:

Ignore non-null lastQuote when continuation is broken.

* rendering/updating/RenderTreeBuilder.h:
(WebCore::RenderTreeBuilder::hasBrokenContinuation const):
(WebCore::RenderTreeBuilder::setHasBrokenContinuation):
* rendering/updating/RenderTreeBuilderInline.cpp:
(WebCore::RenderTreeBuilder::Inline::splitInlines):
* rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):

LayoutTests:

Add test for this.

* fast/dom/quotes-continuation-crash-expected.txt: Added.
* fast/dom/quotes-continuation-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275605 => 275606)


--- trunk/LayoutTests/ChangeLog	2021-04-07 13:13:34 UTC (rev 275605)
+++ trunk/LayoutTests/ChangeLog	2021-04-07 14:47:57 UTC (rev 275606)
@@ -1,3 +1,15 @@
+2021-04-07  Rob Buis  <rb...@igalia.com>
+
+        Ignore non-null lastQuote ASSERT when continuation is broken
+        https://bugs.webkit.org/show_bug.cgi?id=218576
+
+        Reviewed by Zalan Bujtas.
+
+        Add test for this.
+
+        * fast/dom/quotes-continuation-crash-expected.txt: Added.
+        * fast/dom/quotes-continuation-crash.html: Added.
+
 2021-04-07  Alejandro G. Castro  <a...@igalia.com>
 
         [GTK][WPE] Wrong frame scrolled when view is horizontally scrolled with async scrolling enabled

Added: trunk/LayoutTests/fast/dom/quotes-continuation-crash-expected.txt (0 => 275606)


--- trunk/LayoutTests/fast/dom/quotes-continuation-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/quotes-continuation-crash-expected.txt	2021-04-07 14:47:57 UTC (rev 275606)
@@ -0,0 +1 @@
+This test should not crash.

Added: trunk/LayoutTests/fast/dom/quotes-continuation-crash.html (0 => 275606)


--- trunk/LayoutTests/fast/dom/quotes-continuation-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/quotes-continuation-crash.html	2021-04-07 14:47:57 UTC (rev 275606)
@@ -0,0 +1,20 @@
+<script>
+_onload_ = () => {
+  if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+  }
+  let previous = document.body
+  function foo() {
+    let d0 = document.createElement('div');
+    previous.appendChild(d0);
+    let d1 = document.createElement('q');
+    previous = previous.appendChild(d1);
+  }
+
+  for (let i=0; i<202; i++) {
+    foo();
+  }
+  setTimeout(function() { document.write('This test should not crash.'); testRunner.notifyDone(); }, 0);
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (275605 => 275606)


--- trunk/Source/WebCore/ChangeLog	2021-04-07 13:13:34 UTC (rev 275605)
+++ trunk/Source/WebCore/ChangeLog	2021-04-07 14:47:57 UTC (rev 275606)
@@ -1,3 +1,20 @@
+2021-04-07  Rob Buis  <rb...@igalia.com>
+
+        Ignore non-null lastQuote ASSERT when continuation is broken
+        https://bugs.webkit.org/show_bug.cgi?id=218576
+
+        Reviewed by Zalan Bujtas.
+
+        Ignore non-null lastQuote when continuation is broken.
+
+        * rendering/updating/RenderTreeBuilder.h:
+        (WebCore::RenderTreeBuilder::hasBrokenContinuation const):
+        (WebCore::RenderTreeBuilder::setHasBrokenContinuation):
+        * rendering/updating/RenderTreeBuilderInline.cpp:
+        (WebCore::RenderTreeBuilder::Inline::splitInlines):
+        * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
+        (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
+
 2021-04-07  Imanol Fernandez  <ifernan...@igalia.com>
 
         Use frameData instead of scheduleOnNextFrame calls in WebFakeXRDevice

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h (275605 => 275606)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h	2021-04-07 13:13:34 UTC (rev 275605)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h	2021-04-07 14:47:57 UTC (rev 275606)
@@ -62,6 +62,8 @@
     void createPlaceholderForFullScreen(RenderFullScreen&, std::unique_ptr<RenderStyle>, const LayoutRect&);
 #endif
 
+    bool hasBrokenContinuation() const { return m_hasBrokenContinuation; }
+
 private:
     void attachInternal(RenderElement& parent, RenderPtr<RenderObject>, RenderObject* beforeChild);
 
@@ -91,6 +93,8 @@
 
     void reportVisuallyNonEmptyContent(const RenderElement& parent, const RenderObject& child);
 
+    void setHasBrokenContinuation() { m_hasBrokenContinuation = true; }
+
     class FirstLetter;
     class List;
     class MultiColumn;
@@ -149,6 +153,7 @@
 #if ENABLE(FULLSCREEN_API)
     std::unique_ptr<FullScreen> m_fullScreenBuilder;
 #endif
+    bool m_hasBrokenContinuation { false };
 };
 
 }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp (275605 => 275606)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp	2021-04-07 13:13:34 UTC (rev 275605)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp	2021-04-07 14:47:57 UTC (rev 275606)
@@ -352,7 +352,8 @@
                 sibling->setNeedsLayoutAndPrefWidthsRecalc();
                 sibling = next;
             }
-        }
+        } else
+            m_builder.setHasBrokenContinuation();
 
         // Keep walking up the chain.
         currentChild = current;

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp (275605 => 275606)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp	2021-04-07 13:13:34 UTC (rev 275605)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp	2021-04-07 14:47:57 UTC (rev 275606)
@@ -66,7 +66,7 @@
         if (&quote == lastQuote)
             return;
     }
-    ASSERT(!lastQuote);
+    ASSERT(!lastQuote || m_updater.m_builder.hasBrokenContinuation());
 }
 
 static bool elementIsTargetedByKeyframeEffectRequiringPseudoElement(const Element* element, PseudoId pseudoId)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to