+2018-02-21 Zalan Bujtas <zalan@apple.com>
+
+ [RenderTreeBuilder] Move RenderFullScreen::willBeRemoved() mutation logic to RenderTreeBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=182947
+ <rdar://problem/37690848>
+
+ Reviewed by Antti Koivisto.
+
+ No change in functionality.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/RenderFullScreen.cpp:
+ (WebCore::RenderFullScreen::willBeDestroyed):
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::takeChild):
+ * rendering/updating/RenderTreeBuilder.h:
+ (WebCore::RenderTreeBuilder::fullScreenBuilder):
+ * rendering/updating/RenderTreeBuilderFullScreen.cpp: Added.
+ (WebCore::RenderTreeBuilder::FullScreen::FullScreen):
+ (WebCore::RenderTreeBuilder::FullScreen::cleanupOnRemoval):
+ * rendering/updating/RenderTreeBuilderFullScreen.h: Added.
+ * rendering/updating/RenderTreeBuilderMathML.cpp:
+
2018-02-20 Zalan Bujtas <zalan@apple.com>
[RenderTreeBuilder] Move RenderListItem::willBeRemoved() mutation logic to RenderTreeBuilder
rendering/updating/RenderTreeBuilderBlockFlow.cpp
rendering/updating/RenderTreeBuilderFirstLetter.cpp
rendering/updating/RenderTreeBuilderFormControls.cpp
+rendering/updating/RenderTreeBuilderFullScreen.cpp
rendering/updating/RenderTreeBuilderInline.cpp
rendering/updating/RenderTreeBuilderList.cpp
rendering/updating/RenderTreeBuilderMathML.cpp
1193408A1FEB355D00935F1E /* RenderTreeBuilderRuby.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340881FEB355D00935F1E /* RenderTreeBuilderRuby.h */; };
119340971FED715500935F1E /* RenderTreeBuilderFormControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340951FED715500935F1E /* RenderTreeBuilderFormControls.h */; };
119340A31FEE024000935F1E /* RenderTreeBuilderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */; };
+ 11CB2789203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 11CB2787203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h */; };
11E067EE1E6246E500162D16 /* SimpleLineLayoutCoverage.h in Headers */ = {isa = PBXBuildFile; fileRef = 11E067ED1E6246E500162D16 /* SimpleLineLayoutCoverage.h */; settings = {ATTRIBUTES = (Private, ); }; };
1400D7A817136EA70077CE05 /* ScriptWrappableInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
11C5F12C2004231E0001AE60 /* RenderTreeBuilderSVG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderSVG.cpp; sourceTree = "<group>"; };
11C5F132200527F80001AE60 /* RenderTreeBuilderMathML.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderMathML.cpp; sourceTree = "<group>"; };
11C5F134200527F90001AE60 /* RenderTreeBuilderMathML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderMathML.h; sourceTree = "<group>"; };
+ 11CB2786203BA570004A1DC9 /* RenderTreeBuilderFullScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderFullScreen.cpp; sourceTree = "<group>"; };
+ 11CB2787203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderFullScreen.h; 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>"; };
E47C39261FE6E0DC00BBBC6B /* RenderTreeBuilderFirstLetter.h */,
119340941FED715500935F1E /* RenderTreeBuilderFormControls.cpp */,
119340951FED715500935F1E /* RenderTreeBuilderFormControls.h */,
+ 11CB2786203BA570004A1DC9 /* RenderTreeBuilderFullScreen.cpp */,
+ 11CB2787203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h */,
11C5F1162003E7750001AE60 /* RenderTreeBuilderInline.cpp */,
11C5F1182003E7760001AE60 /* RenderTreeBuilderInline.h */,
E47C392B1FE6E0DF00BBBC6B /* RenderTreeBuilderList.cpp */,
119340A31FEE024000935F1E /* RenderTreeBuilderBlock.h in Headers */,
E47C39301FE6E0FD00BBBC6B /* RenderTreeBuilderFirstLetter.h in Headers */,
119340971FED715500935F1E /* RenderTreeBuilderFormControls.h in Headers */,
+ 11CB2789203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h in Headers */,
E47C39321FE6E10500BBBC6B /* RenderTreeBuilderList.h in Headers */,
E47C39331FE6E10800BBBC6B /* RenderTreeBuilderMultiColumn.h in Headers */,
1193408A1FEB355D00935F1E /* RenderTreeBuilderRuby.h in Headers */,
setReplaced(false);
}
-void RenderFullScreen::willBeDestroyed(RenderTreeBuilder& builder)
+RenderFullScreen::~RenderFullScreen()
{
- if (m_placeholder) {
- builder.removeAndDestroy(*m_placeholder);
- ASSERT(!m_placeholder);
- }
-
- RenderFlexibleBox::willBeDestroyed(builder);
+ ASSERT(!m_placeholder);
}
static RenderStyle createFullScreenStyle()
WTF_MAKE_ISO_ALLOCATED(RenderFullScreen);
public:
RenderFullScreen(Document&, RenderStyle&&);
+ virtual ~RenderFullScreen();
const char* renderName() const override { return "RenderFullScreen"; }
private:
bool isRenderFullScreen() const override { return true; }
- void willBeDestroyed(RenderTreeBuilder&) override;
bool isFlexibleBoxImpl() const override { return true; }
protected:
#include "RenderButton.h"
#include "RenderCounter.h"
#include "RenderElement.h"
+#include "RenderFullScreen.h"
#include "RenderGrid.h"
#include "RenderLineBreak.h"
#include "RenderMathMLFenced.h"
#include "RenderTreeBuilderBlockFlow.h"
#include "RenderTreeBuilderFirstLetter.h"
#include "RenderTreeBuilderFormControls.h"
+#include "RenderTreeBuilderFullScreen.h"
#include "RenderTreeBuilderInline.h"
#include "RenderTreeBuilderList.h"
#include "RenderTreeBuilderMathML.h"
, m_inlineBuilder(std::make_unique<Inline>(*this))
, m_svgBuilder(std::make_unique<SVG>(*this))
, m_mathMLBuilder(std::make_unique<MathML>(*this))
+#if ENABLE(FULLSCREEN_API)
+ , m_fullScreenBuilder(std::make_unique<FullScreen>(*this))
+#endif
{
RELEASE_ASSERT(!s_current || &m_view != &s_current->m_view);
m_previous = s_current;
s_current = m_previous;
}
-void RenderTreeBuilder::removeAndDestroy(RenderObject& child)
+void RenderTreeBuilder::removeAndDestroy(RenderObject& renderer)
{
- ASSERT(child.parent());
- auto toDestroy = takeChild(*child.parent(), child);
+ ASSERT(renderer.parent());
+ auto toDestroy = takeChild(*renderer.parent(), renderer);
+
+#if ENABLE(FULLSCREEN_API)
+ if (is<RenderFullScreen>(renderer))
+ fullScreenBuilder().cleanupOnDestroy(downcast<RenderFullScreen>(renderer));
+#endif
+
// 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.
class Inline;
class SVG;
class MathML;
+#if ENABLE(FULLSCREEN_API)
+ class FullScreen;
+#endif
FirstLetter& firstLetterBuilder() { return *m_firstLetterBuilder; }
List& listBuilder() { return *m_listBuilder; }
Inline& inlineBuilder() { return *m_inlineBuilder; }
SVG& svgBuilder() { return *m_svgBuilder; }
MathML& mathMLBuilder() { return *m_mathMLBuilder; }
+#if ENABLE(FULLSCREEN_API)
+ FullScreen& fullScreenBuilder() { return *m_fullScreenBuilder; }
+#endif
RenderView& m_view;
RenderTreeBuilder* m_previous { nullptr };
std::unique_ptr<Inline> m_inlineBuilder;
std::unique_ptr<SVG> m_svgBuilder;
std::unique_ptr<MathML> m_mathMLBuilder;
+#if ENABLE(FULLSCREEN_API)
+ std::unique_ptr<FullScreen> m_fullScreenBuilder;
+#endif
};
}
--- /dev/null
+/*
+ * 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"
+
+#if ENABLE(FULLSCREEN_API)
+#include "RenderTreeBuilderFullScreen.h"
+
+#include "RenderFullScreen.h"
+
+namespace WebCore {
+
+RenderTreeBuilder::FullScreen::FullScreen(RenderTreeBuilder& builder)
+ : m_builder(builder)
+{
+}
+
+void RenderTreeBuilder::FullScreen::cleanupOnDestroy(RenderFullScreen& fullScreenRenderer)
+{
+ if (!fullScreenRenderer.placeholder())
+ return;
+ m_builder.removeAndDestroy(*fullScreenRenderer.placeholder());
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ * 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
+
+#if ENABLE(FULLSCREEN_API)
+
+#include "RenderTreeBuilder.h"
+
+namespace WebCore {
+
+class RenderElement;
+class RenderFullScreen;
+
+class RenderTreeBuilder::FullScreen {
+public:
+ FullScreen(RenderTreeBuilder&);
+
+ void cleanupOnDestroy(RenderFullScreen&);
+
+private:
+ RenderTreeBuilder& m_builder;
+};
+
+}
+
+#endif // ENABLE(FULLSCREEN_API)
#include "RenderMathMLFenced.h"
#include "RenderMathMLFencedOperator.h"
+#include "RenderTreeBuilderBlock.h"
namespace WebCore {