Title: [221409] trunk/Source/WebCore
Revision
221409
Author
an...@apple.com
Date
2017-08-30 17:31:21 -0700 (Wed, 30 Aug 2017)

Log Message

Factor RenderMultiColumnFlowThread construction and destruction into RenderTreeUpdater helper
https://bugs.webkit.org/show_bug.cgi?id=176130

Reviewed by Zalan Bujtas.

Move mutation code out of the render tree.

* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::createMultiColumnFlowThread): Deleted.
(WebCore::RenderBlockFlow::destroyMultiColumnFlowThread): Deleted.
* rendering/RenderBlockFlow.h:
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::commit):
(WebCore::RenderTreeUpdater::updateAfterDescendants):
(WebCore::updateMultiColumnFlowThread): Deleted.
* style/RenderTreeUpdater.h:
* style/RenderTreeUpdaterMultiColumn.cpp: Added.
(WebCore::RenderTreeUpdater::MultiColumn::update):
(WebCore::RenderTreeUpdater::MultiColumn::createFlowThread):
* style/RenderTreeUpdaterMultiColumn.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (221408 => 221409)


--- trunk/Source/WebCore/CMakeLists.txt	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-08-31 00:31:21 UTC (rev 221409)
@@ -2820,6 +2820,7 @@
     style/RenderTreeUpdaterFirstLetter.cpp
     style/RenderTreeUpdaterGeneratedContent.cpp
     style/RenderTreeUpdaterListItem.cpp
+    style/RenderTreeUpdaterMultiColumn.cpp
     style/StyleChange.cpp
     style/StyleFontSizeFunctions.cpp
     style/StyleInvalidator.cpp

Modified: trunk/Source/WebCore/ChangeLog (221408 => 221409)


--- trunk/Source/WebCore/ChangeLog	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/ChangeLog	2017-08-31 00:31:21 UTC (rev 221409)
@@ -1,3 +1,27 @@
+2017-08-30  Antti Koivisto  <an...@apple.com>
+
+        Factor RenderMultiColumnFlowThread construction and destruction into RenderTreeUpdater helper
+        https://bugs.webkit.org/show_bug.cgi?id=176130
+
+        Reviewed by Zalan Bujtas.
+
+        Move mutation code out of the render tree.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::createMultiColumnFlowThread): Deleted.
+        (WebCore::RenderBlockFlow::destroyMultiColumnFlowThread): Deleted.
+        * rendering/RenderBlockFlow.h:
+        * style/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::commit):
+        (WebCore::RenderTreeUpdater::updateAfterDescendants):
+        (WebCore::updateMultiColumnFlowThread): Deleted.
+        * style/RenderTreeUpdater.h:
+        * style/RenderTreeUpdaterMultiColumn.cpp: Added.
+        (WebCore::RenderTreeUpdater::MultiColumn::update):
+        (WebCore::RenderTreeUpdater::MultiColumn::createFlowThread):
+        * style/RenderTreeUpdaterMultiColumn.h: Added.
+
 2017-08-30  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Previous elements with lang= can affect fonts selected for subsequent elements

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (221408 => 221409)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-08-31 00:31:21 UTC (rev 221409)
@@ -6769,6 +6769,7 @@
 		E401E0A41C3C0B8300F34D10 /* StyleChange.h in Headers */ = {isa = PBXBuildFile; fileRef = E401E0A31C3C0B8300F34D10 /* StyleChange.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E401E0A61C3C0CF700F34D10 /* StyleChange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */; };
 		E419041F1CC6486B00C35F5D /* FontSelectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E419041E1CC6486B00C35F5D /* FontSelectorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E41FA9B91F5758FF0033858A /* RenderTreeUpdaterMultiColumn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41FA9B71F5758FD0033858A /* RenderTreeUpdaterMultiColumn.cpp */; };
 		E424A39E1330DF0100CF6DC9 /* LegacyTileGridTile.h in Headers */ = {isa = PBXBuildFile; fileRef = E424A39D1330DF0100CF6DC9 /* LegacyTileGridTile.h */; };
 		E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };
 		E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -15477,6 +15478,8 @@
 		E419041E1CC6486B00C35F5D /* FontSelectorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSelectorClient.h; sourceTree = "<group>"; };
 		E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyNames.cpp; sourceTree = "<group>"; };
 		E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueKeywords.cpp; sourceTree = "<group>"; };
+		E41FA9B71F5758FD0033858A /* RenderTreeUpdaterMultiColumn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeUpdaterMultiColumn.cpp; sourceTree = "<group>"; };
+		E41FA9BA1F57590A0033858A /* RenderTreeUpdaterMultiColumn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeUpdaterMultiColumn.h; sourceTree = "<group>"; };
 		E424A39D1330DF0100CF6DC9 /* LegacyTileGridTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyTileGridTile.h; sourceTree = "<group>"; };
 		E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyTileGridTile.mm; sourceTree = "<group>"; };
 		E425A49918292B840020CFCF /* CollectionIndexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionIndexCache.h; sourceTree = "<group>"; };
@@ -25178,6 +25181,8 @@
 				E48E33301F47436700BAB0EF /* RenderTreeUpdaterGeneratedContent.h */,
 				E48E332A1F46C98000BAB0EF /* RenderTreeUpdaterListItem.cpp */,
 				E48E33281F46C97F00BAB0EF /* RenderTreeUpdaterListItem.h */,
+				E41FA9B71F5758FD0033858A /* RenderTreeUpdaterMultiColumn.cpp */,
+				E41FA9BA1F57590A0033858A /* RenderTreeUpdaterMultiColumn.h */,
 				E401E0A51C3C0CF700F34D10 /* StyleChange.cpp */,
 				E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
 				E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
@@ -31832,6 +31837,7 @@
 				A871DE250A152AC800B12A68 /* HTMLHeadElement.cpp in Sources */,
 				A8EA7CAE0A192B9C00A8EF5F /* HTMLHeadingElement.cpp in Sources */,
 				A8EA7CB30A192B9C00A8EF5F /* HTMLHRElement.cpp in Sources */,
+				E41FA9B91F5758FF0033858A /* RenderTreeUpdaterMultiColumn.cpp in Sources */,
 				A871DE260A152AC800B12A68 /* HTMLHtmlElement.cpp in Sources */,
 				A871DE240A152AC800B12A68 /* HTMLIFrameElement.cpp in Sources */,
 				A8EA7D310A19385500A8EF5F /* HTMLImageElement.cpp in Sources */,

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (221408 => 221409)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2017-08-31 00:31:21 UTC (rev 221409)
@@ -143,23 +143,6 @@
     // Do not add any code here. Add it to willBeDestroyed() instead.
 }
 
-void RenderBlockFlow::createMultiColumnFlowThread()
-{
-    RenderMultiColumnFlowThread* flowThread = new RenderMultiColumnFlowThread(document(), RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK));
-    flowThread->initializeStyle();
-    setChildrenInline(false); // Do this to avoid wrapping inline children that are just going to move into the flow thread.
-    deleteLines();
-    RenderBlock::addChild(flowThread);
-    flowThread->populate(); // Called after the flow thread is inserted so that we are reachable by the flow thread.
-    setMultiColumnFlowThread(flowThread);
-}
-
-void RenderBlockFlow::destroyMultiColumnFlowThread()
-{
-    multiColumnFlowThread()->evacuateAndDestroy();
-    ASSERT(!multiColumnFlowThread());
-}
-
 void RenderBlockFlow::insertedIntoTree()
 {
     RenderBlock::insertedIntoTree();

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (221408 => 221409)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2017-08-31 00:31:21 UTC (rev 221409)
@@ -392,9 +392,6 @@
     void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
     void removeChild(RenderObject&) override;
 
-    void createMultiColumnFlowThread();
-    void destroyMultiColumnFlowThread();
-
     void updateColumnProgressionFromStyle(RenderStyle&);
     void updateStylesForColumnChildren();
 

Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (221408 => 221409)


--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-08-31 00:31:21 UTC (rev 221409)
@@ -44,6 +44,7 @@
 #include "RenderTreeUpdaterFirstLetter.h"
 #include "RenderTreeUpdaterGeneratedContent.h"
 #include "RenderTreeUpdaterListItem.h"
+#include "RenderTreeUpdaterMultiColumn.h"
 #include "StyleResolver.h"
 #include "StyleTreeResolver.h"
 #include <wtf/SystemTracing.h>
@@ -117,18 +118,6 @@
     return renderingRoots;
 }
 
-static void updateMultiColumnFlowThread(RenderBlockFlow& flow)
-{
-    bool needsFlowThread = flow.requiresColumns(flow.style().columnCount());
-    if (!needsFlowThread) {
-        if (flow.multiColumnFlowThread())
-            flow.destroyMultiColumnFlowThread();
-        return;
-    }
-    if (!flow.multiColumnFlowThread())
-        flow.createMultiColumnFlowThread();
-}
-
 void RenderTreeUpdater::commit(std::unique_ptr<const Style::Update> styleUpdate)
 {
     ASSERT(&m_document == &styleUpdate->document());
@@ -147,7 +136,7 @@
 
     generatedContent().updateRemainingQuotes();
 
-    updateMultiColumnFlowThread(renderView());
+    MultiColumn::update(renderView());
 
     m_styleUpdate = nullptr;
 }
@@ -278,7 +267,7 @@
     if (is<RenderListItem>(*renderer))
         ListItem::updateMarker(downcast<RenderListItem>(*renderer));
     if (is<RenderBlockFlow>(*renderer))
-        updateMultiColumnFlowThread(downcast<RenderBlockFlow>(*renderer));
+        MultiColumn::update(downcast<RenderBlockFlow>(*renderer));
 
     if (element.hasCustomStyleResolveCallbacks() && styleChange == Style::Detach)
         element.didAttachRenderers();

Modified: trunk/Source/WebCore/style/RenderTreeUpdater.h (221408 => 221409)


--- trunk/Source/WebCore/style/RenderTreeUpdater.h	2017-08-30 23:46:39 UTC (rev 221408)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.h	2017-08-31 00:31:21 UTC (rev 221409)
@@ -56,6 +56,7 @@
 
 private:
     class GeneratedContent;
+    class MultiColumn;
 
     void updateRenderTree(ContainerNode& root);
     void updateTextRenderer(Text&, const Style::TextUpdate*);

Added: trunk/Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp (0 => 221409)


--- trunk/Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp	                        (rev 0)
+++ trunk/Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp	2017-08-31 00:31:21 UTC (rev 221409)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (kn...@kde.org)
+ *           (C) 1999 Antti Koivisto (koivi...@kde.org)
+ *           (C) 2007 David Smith (catfish....@gmail.com)
+ * Copyright (C) 2003-2015, 2017 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "RenderTreeUpdaterMultiColumn.h"
+
+#include "RenderBlockFlow.h"
+#include "RenderMultiColumnFlowThread.h"
+
+namespace WebCore {
+
+void RenderTreeUpdater::MultiColumn::update(RenderBlockFlow& flow)
+{
+    bool needsFlowThread = flow.requiresColumns(flow.style().columnCount());
+    auto* multiColumnFlowThread = flow.multiColumnFlowThread();
+    if (!needsFlowThread) {
+        if (multiColumnFlowThread) {
+            multiColumnFlowThread->evacuateAndDestroy();
+            ASSERT(!flow.multiColumnFlowThread());
+        }
+        return;
+    }
+    if (!multiColumnFlowThread)
+        createFlowThread(flow);
+}
+
+void RenderTreeUpdater::MultiColumn::createFlowThread(RenderBlockFlow& flow)
+{
+    RenderMultiColumnFlowThread* flowThread = new RenderMultiColumnFlowThread(flow.document(), RenderStyle::createAnonymousStyleWithDisplay(flow.style(), BLOCK));
+    flowThread->initializeStyle();
+    flow.setChildrenInline(false); // Do this to avoid wrapping inline children that are just going to move into the flow thread.
+    flow.deleteLines();
+    flow.RenderBlock::addChild(flowThread);
+    flowThread->populate(); // Called after the flow thread is inserted so that we are reachable by the flow thread.
+    flow.setMultiColumnFlowThread(flowThread);
+}
+
+
+}

Added: trunk/Source/WebCore/style/RenderTreeUpdaterMultiColumn.h (0 => 221409)


--- trunk/Source/WebCore/style/RenderTreeUpdaterMultiColumn.h	                        (rev 0)
+++ trunk/Source/WebCore/style/RenderTreeUpdaterMultiColumn.h	2017-08-31 00:31:21 UTC (rev 221409)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2017 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 "RenderTreeUpdater.h"
+
+namespace WebCore {
+
+class RenderBlockFlow;
+
+class RenderTreeUpdater::MultiColumn {
+public:
+    static void update(RenderBlockFlow&);
+
+private:
+    static void createFlowThread(RenderBlockFlow&);
+};
+
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to