Title: [229024] releases/WebKitGTK/webkit-2.20/Source/WebCore
Revision
229024
Author
[email protected]
Date
2018-02-26 08:05:58 -0800 (Mon, 26 Feb 2018)

Log Message

Merge r228899 - [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=183014
<rdar://problem/37757428>

Reviewed by Antti Koivisto.

No change in functionality.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::~RenderBoxModelObject):
(WebCore::RenderBoxModelObject::willBeDestroyed):
(WebCore::RenderBoxModelObject::continuationChainNode const):
(): Deleted.
(WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted.
* rendering/RenderBoxModelObject.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::RenderTreeBuilder):
(WebCore::RenderTreeBuilder::removeAndDestroy):
* rendering/updating/RenderTreeBuilder.h:
(WebCore::RenderTreeBuilder::continuationBuilder):
* rendering/updating/RenderTreeBuilderContinuation.cpp: Added.
(WebCore::RenderTreeBuilder::Continuation::Continuation):
(WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
* rendering/updating/RenderTreeBuilderContinuation.h: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-26 16:05:58 UTC (rev 229024)
@@ -1,3 +1,32 @@
+2018-02-21  Zalan Bujtas  <[email protected]>
+
+        [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=183014
+        <rdar://problem/37757428>
+
+        Reviewed by Antti Koivisto.
+
+        No change in functionality.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
+        (WebCore::RenderBoxModelObject::willBeDestroyed):
+        (WebCore::RenderBoxModelObject::continuationChainNode const):
+        (): Deleted.
+        (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted.
+        * rendering/RenderBoxModelObject.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::RenderTreeBuilder):
+        (WebCore::RenderTreeBuilder::removeAndDestroy):
+        * rendering/updating/RenderTreeBuilder.h:
+        (WebCore::RenderTreeBuilder::continuationBuilder):
+        * rendering/updating/RenderTreeBuilderContinuation.cpp: Added.
+        (WebCore::RenderTreeBuilder::Continuation::Continuation):
+        (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
+        * rendering/updating/RenderTreeBuilderContinuation.h: Added.
+
 2018-02-21  Philippe Normand  <[email protected]>
 
         [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/Sources.txt (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/Sources.txt	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/Sources.txt	2018-02-26 16:05:58 UTC (rev 229024)
@@ -2004,6 +2004,7 @@
 rendering/updating/RenderTreeBuilder.cpp
 rendering/updating/RenderTreeBuilderBlock.cpp
 rendering/updating/RenderTreeBuilderBlockFlow.cpp
+rendering/updating/RenderTreeBuilderContinuation.cpp
 rendering/updating/RenderTreeBuilderFirstLetter.cpp
 rendering/updating/RenderTreeBuilderFormControls.cpp
 rendering/updating/RenderTreeBuilderFullScreen.cpp

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/WebCore.xcodeproj/project.pbxproj (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-02-26 16:05:58 UTC (rev 229024)
@@ -391,6 +391,7 @@
 		0FFD4D6118651FA300512F6E /* AsyncScrollingCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FFD4D5F18651FA300512F6E /* AsyncScrollingCoordinator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; };
 		112B34D51E60B98300BB310A /* SimpleLineLayoutPagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 112B34D41E60B98300BB310A /* SimpleLineLayoutPagination.h */; };
+		113409DA203E038000C66915 /* RenderTreeBuilderContinuation.h in Headers */ = {isa = PBXBuildFile; fileRef = 113409D8203E038000C66915 /* RenderTreeBuilderContinuation.h */; };
 		113D0B521F9FDD2B00F611BB /* LayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 113D0B501F9FDD2B00F611BB /* LayoutContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		119340791FE8B92300935F1E /* RenderTreeBuilderTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340771FE8B92300935F1E /* RenderTreeBuilderTable.h */; };
 		1193408A1FEB355D00935F1E /* RenderTreeBuilderRuby.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340881FEB355D00935F1E /* RenderTreeBuilderRuby.h */; };
@@ -5612,6 +5613,8 @@
 		1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TrailingFloatsRootInlineBox.cpp; sourceTree = "<group>"; };
 		112B34D01E60B8A700BB310A /* SimpleLineLayoutPagination.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutPagination.cpp; sourceTree = "<group>"; };
 		112B34D41E60B98300BB310A /* SimpleLineLayoutPagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutPagination.h; sourceTree = "<group>"; };
+		113409D7203E038000C66915 /* RenderTreeBuilderContinuation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderContinuation.cpp; sourceTree = "<group>"; };
+		113409D8203E038000C66915 /* RenderTreeBuilderContinuation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderContinuation.h; sourceTree = "<group>"; };
 		113D0B4F1F9FDD2B00F611BB /* LayoutContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContext.cpp; sourceTree = "<group>"; };
 		113D0B501F9FDD2B00F611BB /* LayoutContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContext.h; sourceTree = "<group>"; };
 		119340761FE8B92300935F1E /* RenderTreeBuilderTable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderTable.cpp; sourceTree = "<group>"; };
@@ -24803,6 +24806,8 @@
 				119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */,
 				11C5F11F2003F69F0001AE60 /* RenderTreeBuilderBlockFlow.cpp */,
 				11C5F11D2003F69E0001AE60 /* RenderTreeBuilderBlockFlow.h */,
+				113409D7203E038000C66915 /* RenderTreeBuilderContinuation.cpp */,
+				113409D8203E038000C66915 /* RenderTreeBuilderContinuation.h */,
 				E47C39211FE6E0DA00BBBC6B /* RenderTreeBuilderFirstLetter.cpp */,
 				E47C39261FE6E0DC00BBBC6B /* RenderTreeBuilderFirstLetter.h */,
 				119340941FED715500935F1E /* RenderTreeBuilderFormControls.cpp */,
@@ -29271,6 +29276,7 @@
 				93F1998C08245E59001E9ABC /* RenderTreeAsText.h in Headers */,
 				E47C392D1FE6E0F300BBBC6B /* RenderTreeBuilder.h in Headers */,
 				119340A31FEE024000935F1E /* RenderTreeBuilderBlock.h in Headers */,
+				113409DA203E038000C66915 /* RenderTreeBuilderContinuation.h in Headers */,
 				E47C39301FE6E0FD00BBBC6B /* RenderTreeBuilderFirstLetter.h in Headers */,
 				119340971FED715500935F1E /* RenderTreeBuilderFormControls.h in Headers */,
 				11CB2789203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h in Headers */,

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderBoxModelObject.cpp (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderBoxModelObject.cpp	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderBoxModelObject.cpp	2018-02-26 16:05:58 UTC (rev 229024)
@@ -81,20 +81,6 @@
 // an anonymous block (that houses other blocks) or it will be an inline flow.
 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as
 // its continuation but the <b> will just have an inline as its continuation.
-
-struct RenderBoxModelObject::ContinuationChainNode {
-    WeakPtr<RenderBoxModelObject> renderer;
-    ContinuationChainNode* previous { nullptr };
-    ContinuationChainNode* next { nullptr };
-
-    ContinuationChainNode(RenderBoxModelObject&);
-    ~ContinuationChainNode();
-
-    void insertAfter(ContinuationChainNode&);
-
-    WTF_MAKE_FAST_ALLOCATED;
-};
-
 RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode(RenderBoxModelObject& renderer)
     : renderer(makeWeakPtr(renderer))
 {
@@ -235,14 +221,11 @@
 RenderBoxModelObject::~RenderBoxModelObject()
 {
     // Do not add any code here. Add it to willBeDestroyed() instead.
+    ASSERT(!continuation());
 }
 
 void RenderBoxModelObject::willBeDestroyed(RenderTreeBuilder& builder)
 {
-    if (continuation() && !isContinuation()) {
-        removeAndDestroyAllContinuations(builder);
-        ASSERT(!continuation());
-    }
     if (hasContinuationChainNode())
         removeFromContinuationChain();
 
@@ -2525,6 +2508,10 @@
     return nullptr;
 }
 
+RenderBoxModelObject::ContinuationChainNode* RenderBoxModelObject::continuationChainNode() const
+{
+    return continuationChainNodeMap().get(this);
+}
 
 void RenderBoxModelObject::insertIntoContinuationChainAfter(RenderBoxModelObject& afterRenderer)
 {
@@ -2551,17 +2538,6 @@
     }).iterator->value;
 }
 
-void RenderBoxModelObject::removeAndDestroyAllContinuations(RenderTreeBuilder& builder)
-{
-    ASSERT(!isContinuation());
-    ASSERT(hasContinuationChainNode());
-    ASSERT(continuationChainNodeMap().contains(this));
-    auto& continuationChainNode = *continuationChainNodeMap().get(this);
-    while (continuationChainNode.next)
-        builder.removeAndDestroy(*continuationChainNode.next->renderer);
-    removeFromContinuationChain();
-}
-
 RenderTextFragment* RenderBoxModelObject::firstLetterRemainingText() const
 {
     if (!isFirstLetter())

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderBoxModelObject.h (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderBoxModelObject.h	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderBoxModelObject.h	2018-02-26 16:05:58 UTC (rev 229024)
@@ -280,11 +280,23 @@
 
     RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const;
 
-    struct ContinuationChainNode;
+    struct ContinuationChainNode {
+        WeakPtr<RenderBoxModelObject> renderer;
+        ContinuationChainNode* previous { nullptr };
+        ContinuationChainNode* next { nullptr };
 
+        ContinuationChainNode(RenderBoxModelObject&);
+        ~ContinuationChainNode();
+
+        void insertAfter(ContinuationChainNode&);
+
+        WTF_MAKE_FAST_ALLOCATED;
+    };
+
+    ContinuationChainNode* continuationChainNode() const;
+
 private:
     ContinuationChainNode& ensureContinuationChainNode();
-    void removeAndDestroyAllContinuations(RenderTreeBuilder&);
 
     LayoutUnit computedCSSPadding(const Length&) const;
     

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-26 16:05:58 UTC (rev 229024)
@@ -50,6 +50,7 @@
 #include "RenderTextFragment.h"
 #include "RenderTreeBuilderBlock.h"
 #include "RenderTreeBuilderBlockFlow.h"
+#include "RenderTreeBuilderContinuation.h"
 #include "RenderTreeBuilderFirstLetter.h"
 #include "RenderTreeBuilderFormControls.h"
 #include "RenderTreeBuilderFullScreen.h"
@@ -130,6 +131,7 @@
     , m_inlineBuilder(std::make_unique<Inline>(*this))
     , m_svgBuilder(std::make_unique<SVG>(*this))
     , m_mathMLBuilder(std::make_unique<MathML>(*this))
+    , m_continuationBuilder(std::make_unique<Continuation>(*this))
 #if ENABLE(FULLSCREEN_API)
     , m_fullScreenBuilder(std::make_unique<FullScreen>(*this))
 #endif
@@ -157,6 +159,9 @@
     if (is<RenderTextFragment>(renderer))
         firstLetterBuilder().cleanupOnDestroy(downcast<RenderTextFragment>(renderer));
 
+    if (is<RenderBoxModelObject>(renderer))
+        continuationBuilder().cleanupOnDestroy(downcast<RenderBoxModelObject>(renderer));
+
     // We need to detach the subtree first so that the descendants don't have
     // access to previous/next sublings at takeChild().
     // FIXME: webkit.org/b/182909.

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h (229023 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h	2018-02-26 16:05:49 UTC (rev 229023)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h	2018-02-26 16:05:58 UTC (rev 229024)
@@ -91,6 +91,7 @@
     class Inline;
     class SVG;
     class MathML;
+    class Continuation;
 #if ENABLE(FULLSCREEN_API)
     class FullScreen;
 #endif
@@ -106,6 +107,7 @@
     Inline& inlineBuilder() { return *m_inlineBuilder; }
     SVG& svgBuilder() { return *m_svgBuilder; }
     MathML& mathMLBuilder() { return *m_mathMLBuilder; }
+    Continuation& continuationBuilder() { return *m_continuationBuilder; }
 #if ENABLE(FULLSCREEN_API)
     FullScreen& fullScreenBuilder() { return *m_fullScreenBuilder; }
 #endif
@@ -125,6 +127,7 @@
     std::unique_ptr<Inline> m_inlineBuilder;
     std::unique_ptr<SVG> m_svgBuilder;
     std::unique_ptr<MathML> m_mathMLBuilder;
+    std::unique_ptr<Continuation> m_continuationBuilder;
 #if ENABLE(FULLSCREEN_API)
     std::unique_ptr<FullScreen> m_fullScreenBuilder;
 #endif

Added: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.cpp (0 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.cpp	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.cpp	2018-02-26 16:05:58 UTC (rev 229024)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RenderTreeBuilderContinuation.h"
+
+#include "RenderBoxModelObject.h"
+
+namespace WebCore {
+
+RenderTreeBuilder::Continuation::Continuation(RenderTreeBuilder& builder)
+    : m_builder(builder)
+{
+}
+
+void RenderTreeBuilder::Continuation::cleanupOnDestroy(RenderBoxModelObject& renderer)
+{
+    if (!renderer.continuation() || renderer.isContinuation())
+        return;
+
+    ASSERT(renderer.hasContinuationChainNode());
+    ASSERT(renderer.continuationChainNode());
+    auto& continuationChainNode = *renderer.continuationChainNode();
+    while (continuationChainNode.next)
+        m_builder.removeAndDestroy(*continuationChainNode.next->renderer);
+    renderer.removeFromContinuationChain();
+}
+
+}

Added: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.h (0 => 229024)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.h	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.h	2018-02-26 16:05:58 UTC (rev 229024)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "RenderTreeBuilder.h"
+
+namespace WebCore {
+
+class RenderBoxModelObject;
+
+class RenderTreeBuilder::Continuation {
+public:
+    Continuation(RenderTreeBuilder&);
+
+    void cleanupOnDestroy(RenderBoxModelObject&);
+
+private:
+    RenderTreeBuilder& m_builder;
+};
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to