Diff
Modified: trunk/Source/WebCore/ChangeLog (226536 => 226537)
--- trunk/Source/WebCore/ChangeLog 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/ChangeLog 2018-01-08 22:04:02 UTC (rev 226537)
@@ -1,3 +1,30 @@
+2018-01-08 Zalan Bujtas <[email protected]>
+
+ [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=181348
+ <rdar://problem/36328117>
+
+ Reviewed by Antti Koivisto.
+
+ This is about moving the code, no cleanup and/or normalization (unfortunately it also means
+ some temporary changes).
+
+ No change in functionality.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::addChild):
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::RenderTreeBuilder):
+ (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
+ * rendering/updating/RenderTreeBuilder.h:
+ (WebCore::RenderTreeBuilder::blockFlowBuilder):
+ * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
+ (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
+ (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
+ * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
+
2018-01-08 Youenn Fablet <[email protected]>
Add CSP support to service workers
Modified: trunk/Source/WebCore/Sources.txt (226536 => 226537)
--- trunk/Source/WebCore/Sources.txt 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/Sources.txt 2018-01-08 22:04:02 UTC (rev 226537)
@@ -1985,6 +1985,7 @@
rendering/updating/RenderTreeBuilder.cpp
rendering/updating/RenderTreeBuilderBlock.cpp
+rendering/updating/RenderTreeBuilderBlockFlow.cpp
rendering/updating/RenderTreeBuilderFirstLetter.cpp
rendering/updating/RenderTreeBuilderFormControls.cpp
rendering/updating/RenderTreeBuilderInline.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (226536 => 226537)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-01-08 22:04:02 UTC (rev 226537)
@@ -5593,6 +5593,8 @@
119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderBlock.h; sourceTree = "<group>"; };
11C5F1162003E7750001AE60 /* RenderTreeBuilderInline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderInline.cpp; sourceTree = "<group>"; };
11C5F1182003E7760001AE60 /* RenderTreeBuilderInline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderInline.h; sourceTree = "<group>"; };
+ 11C5F11D2003F69E0001AE60 /* RenderTreeBuilderBlockFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderBlockFlow.h; sourceTree = "<group>"; };
+ 11C5F11F2003F69F0001AE60 /* RenderTreeBuilderBlockFlow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderBlockFlow.cpp; sourceTree = "<group>"; };
11E067EB1E62461300162D16 /* SimpleLineLayoutCoverage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutCoverage.cpp; sourceTree = "<group>"; };
11E067ED1E6246E500162D16 /* SimpleLineLayoutCoverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutCoverage.h; sourceTree = "<group>"; };
1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappableInlines.h; sourceTree = "<group>"; };
@@ -24633,6 +24635,8 @@
E47C392A1FE6E0DE00BBBC6B /* RenderTreeBuilder.h */,
119340A01FEE024000935F1E /* RenderTreeBuilderBlock.cpp */,
119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */,
+ 11C5F11F2003F69F0001AE60 /* RenderTreeBuilderBlockFlow.cpp */,
+ 11C5F11D2003F69E0001AE60 /* RenderTreeBuilderBlockFlow.h */,
E47C39211FE6E0DA00BBBC6B /* RenderTreeBuilderFirstLetter.cpp */,
E47C39261FE6E0DC00BBBC6B /* RenderTreeBuilderFirstLetter.h */,
119340941FED715500935F1E /* RenderTreeBuilderFormControls.cpp */,
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (226536 => 226537)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2018-01-08 22:04:02 UTC (rev 226537)
@@ -3831,12 +3831,7 @@
void RenderBlockFlow::addChild(RenderTreeBuilder& builder, RenderPtr<RenderObject> newChild, RenderObject* beforeChild)
{
- if (multiColumnFlow() && (!isFieldset() || !newChild->isLegend()))
- return builder.insertChild(*multiColumnFlow(), WTFMove(newChild), beforeChild);
- auto* beforeChildOrPlaceholder = beforeChild;
- if (auto* containingFragmentedFlow = enclosingFragmentedFlow())
- beforeChildOrPlaceholder = containingFragmentedFlow->resolveMovedChild(beforeChild);
- RenderBlock::addChild(builder, WTFMove(newChild), beforeChildOrPlaceholder);
+ builder.insertChildToRenderBlockFlow(*this, WTFMove(newChild), beforeChild);
}
RenderPtr<RenderObject> RenderBlockFlow::takeChild(RenderObject& oldChild)
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (226536 => 226537)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-01-08 22:04:02 UTC (rev 226537)
@@ -34,6 +34,7 @@
#include "RenderTableRow.h"
#include "RenderText.h"
#include "RenderTreeBuilderBlock.h"
+#include "RenderTreeBuilderBlockFlow.h"
#include "RenderTreeBuilderFirstLetter.h"
#include "RenderTreeBuilderFormControls.h"
#include "RenderTreeBuilderInline.h"
@@ -98,7 +99,6 @@
} while (!sawInline);
}
-
RenderTreeBuilder::RenderTreeBuilder(RenderView& view)
: m_view(view)
, m_firstLetterBuilder(std::make_unique<FirstLetter>(*this))
@@ -108,6 +108,7 @@
, m_rubyBuilder(std::make_unique<Ruby>(*this))
, m_formControlsBuilder(std::make_unique<FormControls>(*this))
, m_blockBuilder(std::make_unique<Block>(*this))
+ , m_blockFlowBuilder(std::make_unique<BlockFlow>(*this))
, m_inlineBuilder(std::make_unique<Inline>(*this))
{
RELEASE_ASSERT(!s_current || &m_view != &s_current->m_view);
@@ -289,6 +290,11 @@
inlineBuilder().splitFlow(parent, beforeChild, WTFMove(newBlockBox), WTFMove(child), oldCont);
}
+void RenderTreeBuilder::insertChildToRenderBlockFlow(RenderBlockFlow& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
+{
+ blockFlowBuilder().insertChild(parent, WTFMove(child), beforeChild);
+}
+
void RenderTreeBuilder::updateAfterDescendants(RenderElement& renderer)
{
if (is<RenderBlock>(renderer))
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h (226536 => 226537)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-01-08 22:04:02 UTC (rev 226537)
@@ -49,12 +49,12 @@
// These functions are temporary until after all block/inline/continuation code is moved over.
void insertChildToRenderBlock(RenderBlock& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
void insertChildToRenderBlockIgnoringContinuation(RenderBlock& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
+ void insertChildToRenderBlockFlow(RenderBlockFlow& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
+ void insertChildToRenderInline(RenderInline& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
+ void insertChildToRenderInlineIgnoringContinuation(RenderInline& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
+
void makeChildrenNonInline(RenderBlock& parent, RenderObject* insertionPoint = nullptr);
RenderObject* splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject* beforeChild);
-
- // These functions are temporary until after all block/inline/continuation code is moved over.
- void insertChildToRenderInline(RenderInline& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
- void insertChildToRenderInlineIgnoringContinuation(RenderInline& parent, RenderPtr<RenderObject>, RenderObject* beforeChild = nullptr);
void splitFlow(RenderInline& parent, RenderObject* beforeChild, RenderPtr<RenderBlock> newBlockBox, RenderPtr<RenderObject> child, RenderBoxModelObject* oldCont);
private:
@@ -65,6 +65,7 @@
class Ruby;
class FormControls;
class Block;
+ class BlockFlow;
class Inline;
FirstLetter& firstLetterBuilder() { return *m_firstLetterBuilder; }
@@ -74,6 +75,7 @@
Ruby& rubyBuilder() { return *m_rubyBuilder; }
FormControls& formControlsBuilder() { return *m_formControlsBuilder; }
Block& blockBuilder() { return *m_blockBuilder; }
+ BlockFlow& blockFlowBuilder() { return *m_blockFlowBuilder; }
Inline& inlineBuilder() { return *m_inlineBuilder; }
RenderView& m_view;
@@ -88,6 +90,7 @@
std::unique_ptr<Ruby> m_rubyBuilder;
std::unique_ptr<FormControls> m_formControlsBuilder;
std::unique_ptr<Block> m_blockBuilder;
+ std::unique_ptr<BlockFlow> m_blockFlowBuilder;
std::unique_ptr<Inline> m_inlineBuilder;
};
Added: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp (0 => 226537)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp 2018-01-08 22:04:02 UTC (rev 226537)
@@ -0,0 +1,50 @@
+/*
+ * 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 "RenderTreeBuilderBlockFlow.h"
+
+#include "RenderMultiColumnFlow.h"
+
+namespace WebCore {
+
+RenderTreeBuilder::BlockFlow::BlockFlow(RenderTreeBuilder& builder)
+ : m_builder(builder)
+{
+}
+
+void RenderTreeBuilder::BlockFlow::insertChild(RenderBlockFlow& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
+{
+ if (parent.multiColumnFlow() && (!parent.isFieldset() || !child->isLegend()))
+ return m_builder.insertChild(*parent.multiColumnFlow(), WTFMove(child), beforeChild);
+ auto* beforeChildOrPlaceholder = beforeChild;
+ if (auto* containingFragmentedFlow = parent.enclosingFragmentedFlow())
+ beforeChildOrPlaceholder = containingFragmentedFlow->resolveMovedChild(beforeChild);
+ parent.RenderBlock::addChild(m_builder, WTFMove(child), beforeChildOrPlaceholder);
+}
+
+}
+
+
Added: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.h (0 => 226537)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.h (rev 0)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.h 2018-01-08 22:04:02 UTC (rev 226537)
@@ -0,0 +1,43 @@
+/*
+ * 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 RenderTreeBuilder::BlockFlow {
+public:
+ BlockFlow(RenderTreeBuilder&);
+
+ void insertChild(RenderBlockFlow& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
+
+private:
+
+ RenderTreeBuilder& m_builder;
+};
+
+}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp (226536 => 226537)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp 2018-01-08 22:01:13 UTC (rev 226536)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp 2018-01-08 22:04:02 UTC (rev 226537)
@@ -26,6 +26,8 @@
#include "config.h"
#include "RenderTreeBuilderRuby.h"
+#include "RenderRuby.h"
+#include "RenderRubyBase.h"
#include "RenderRubyRun.h"
#include "RenderTreeBuilder.h"
@@ -168,7 +170,7 @@
if (!beforeBlock) {
auto newBlock = createAnonymousRubyInlineBlock(parent);
beforeBlock = newBlock.get();
- parent.RenderBlockFlow::addChild(m_builder, WTFMove(newBlock), parent.firstChild());
+ m_builder.insertChildToRenderBlockFlow(parent, WTFMove(newBlock), parent.firstChild());
}
beforeChild = nullptr;
return *beforeBlock;
@@ -183,7 +185,7 @@
if (!afterBlock) {
auto newBlock = createAnonymousRubyInlineBlock(parent);
afterBlock = newBlock.get();
- parent.RenderBlockFlow::addChild(m_builder, WTFMove(newBlock));
+ m_builder.insertChildToRenderBlockFlow(parent, WTFMove(newBlock));
}
beforeChild = nullptr;
return *afterBlock;
@@ -212,7 +214,7 @@
if (!lastRun || lastRun->hasRubyText()) {
auto newRun = RenderRubyRun::staticCreateRubyRun(&parent);
lastRun = newRun.get();
- parent.RenderBlockFlow::addChild(m_builder, WTFMove(newRun), beforeChild);
+ m_builder.insertChildToRenderBlockFlow(parent, WTFMove(newRun), beforeChild);
}
beforeChild = nullptr;
return *lastRun;