Title: [250014] branches/safari-608-branch
Revision
250014
Author
[email protected]
Date
2019-09-17 18:15:21 -0700 (Tue, 17 Sep 2019)

Log Message

Cherry-pick r249954. rdar://problem/55461404

    [First-letter] Use WeakPtr for the first-letter insertion point.
    https://bugs.webkit.org/show_bug.cgi?id=201842
    <rdar://problem/51373788>

    Reviewed by Antti Koivisto.

    Source/WebCore:

    The about-to-be-removed first letter renderer's sibling could potentially be destroyed too as the result of the anonymous subtree collapsing logic (when the next sibling is a generated anonymous block and it is not needed anymore.)

    Test: fast/text/first-letter-with-columns-crash.html

    * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
    (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):

    LayoutTests:

    * fast/text/first-letter-with-columns-crash-expected.txt: Added.
    * fast/text/first-letter-with-columns-crash.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249954 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (250013 => 250014)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-09-18 01:15:18 UTC (rev 250013)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-09-18 01:15:21 UTC (rev 250014)
@@ -1,5 +1,42 @@
 2019-09-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r249954. rdar://problem/55461404
+
+    [First-letter] Use WeakPtr for the first-letter insertion point.
+    https://bugs.webkit.org/show_bug.cgi?id=201842
+    <rdar://problem/51373788>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    The about-to-be-removed first letter renderer's sibling could potentially be destroyed too as the result of the anonymous subtree collapsing logic (when the next sibling is a generated anonymous block and it is not needed anymore.)
+    
+    Test: fast/text/first-letter-with-columns-crash.html
+    
+    * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
+    (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
+    
+    LayoutTests:
+    
+    * fast/text/first-letter-with-columns-crash-expected.txt: Added.
+    * fast/text/first-letter-with-columns-crash.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-17  Zalan Bujtas  <[email protected]>
+
+            [First-letter] Use WeakPtr for the first-letter insertion point.
+            https://bugs.webkit.org/show_bug.cgi?id=201842
+            <rdar://problem/51373788>
+
+            Reviewed by Antti Koivisto.
+
+            * fast/text/first-letter-with-columns-crash-expected.txt: Added.
+            * fast/text/first-letter-with-columns-crash.html: Added.
+
+2019-09-17  Alan Coon  <[email protected]>
+
         Cherry-pick r247573. rdar://problem/55461395
 
     [Pointer Events] The button and buttons properties are incorrect on iOS

Added: branches/safari-608-branch/LayoutTests/fast/text/first-letter-with-columns-crash-expected.txt (0 => 250014)


--- branches/safari-608-branch/LayoutTests/fast/text/first-letter-with-columns-crash-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/text/first-letter-with-columns-crash-expected.txt	2019-09-18 01:15:21 UTC (rev 250014)
@@ -0,0 +1 @@
+First letter -PASS if no crash.

Added: branches/safari-608-branch/LayoutTests/fast/text/first-letter-with-columns-crash.html (0 => 250014)


--- branches/safari-608-branch/LayoutTests/fast/text/first-letter-with-columns-crash.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/text/first-letter-with-columns-crash.html	2019-09-18 01:15:21 UTC (rev 250014)
@@ -0,0 +1,23 @@
+<style>
+:first-letter {
+    float: right;
+    content: url()
+}
+
+body {
+    columns: 2;
+}
+</style>
+<body>First letter -PASS if no crash.<span id=outer><span id=inner>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+outer.addEventListener("DOMSubtreeModified", function() {
+    document.execCommand(false);
+    document.body.style.setProperty("-webkit-columns","initial");
+    inner.setAttribute("foobar","");
+    document.body.style.setProperty("-webkit-writing-mode","vertical-lr");
+    
+});
+outer.setAttribute("foobar","");
+</script>

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (250013 => 250014)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-18 01:15:18 UTC (rev 250013)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-18 01:15:21 UTC (rev 250014)
@@ -1,5 +1,46 @@
 2019-09-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r249954. rdar://problem/55461404
+
+    [First-letter] Use WeakPtr for the first-letter insertion point.
+    https://bugs.webkit.org/show_bug.cgi?id=201842
+    <rdar://problem/51373788>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    The about-to-be-removed first letter renderer's sibling could potentially be destroyed too as the result of the anonymous subtree collapsing logic (when the next sibling is a generated anonymous block and it is not needed anymore.)
+    
+    Test: fast/text/first-letter-with-columns-crash.html
+    
+    * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
+    (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
+    
+    LayoutTests:
+    
+    * fast/text/first-letter-with-columns-crash-expected.txt: Added.
+    * fast/text/first-letter-with-columns-crash.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-17  Zalan Bujtas  <[email protected]>
+
+            [First-letter] Use WeakPtr for the first-letter insertion point.
+            https://bugs.webkit.org/show_bug.cgi?id=201842
+            <rdar://problem/51373788>
+
+            Reviewed by Antti Koivisto.
+
+            The about-to-be-removed first letter renderer's sibling could potentially be destroyed too as the result of the anonymous subtree collapsing logic (when the next sibling is a generated anonymous block and it is not needed anymore.)
+
+            Test: fast/text/first-letter-with-columns-crash.html
+
+            * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
+            (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
+
+2019-09-17  Alan Coon  <[email protected]>
+
         Cherry-pick r249888. rdar://problem/55461403
 
     [WebIDL] Derived dictionaries should inherit their inherited dictionaries' partials

Modified: branches/safari-608-branch/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp (250013 => 250014)


--- branches/safari-608-branch/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp	2019-09-18 01:15:18 UTC (rev 250013)
+++ branches/safari-608-branch/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp	2019-09-18 01:15:21 UTC (rev 250014)
@@ -185,7 +185,6 @@
             m_builder.attach(*newFirstLetter, WTFMove(toMove));
         }
 
-        RenderObject* nextSibling = firstLetter->nextSibling();
         if (RenderTextFragment* remainingText = downcast<RenderBoxModelObject>(*firstLetter).firstLetterRemainingText()) {
             ASSERT(remainingText->isAnonymous() || remainingText->textNode()->renderer() == remainingText);
             // Replace the old renderer with the new one.
@@ -192,8 +191,9 @@
             remainingText->setFirstLetter(*newFirstLetter);
             newFirstLetter->setFirstLetterRemainingText(*remainingText);
         }
+        WeakPtr<RenderObject> nextSibling = makeWeakPtr(firstLetter->nextSibling());
         m_builder.destroy(*firstLetter);
-        m_builder.attach(*firstLetterContainer, WTFMove(newFirstLetter), nextSibling);
+        m_builder.attach(*firstLetterContainer, WTFMove(newFirstLetter), nextSibling.get());
         return;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to