Diff
Modified: trunk/Source/WebCore/ChangeLog (265629 => 265630)
--- trunk/Source/WebCore/ChangeLog 2020-08-13 22:20:04 UTC (rev 265629)
+++ trunk/Source/WebCore/ChangeLog 2020-08-13 22:28:42 UTC (rev 265630)
@@ -1,3 +1,24 @@
+2020-08-13 Zalan Bujtas <[email protected]>
+
+ Add RenderTreeMutationDisallowedScope to track intrusive render tree mutations
+ https://bugs.webkit.org/show_bug.cgi?id=215463
+ <rdar://problem/67012831>
+
+ Reviewed by Simon Fraser.
+
+ RenderLayer::enclosingScrollableLayer should not mutate the render tree accidentally.
+ This is related to <rdar://problem/64739768>.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/RenderTreeMutationDisallowedScope.cpp: Added.
+ * rendering/RenderTreeMutationDisallowedScope.h: Added.
+ (WebCore::RenderTreeMutationDisallowedScope::RenderTreeMutationDisallowedScope):
+ (WebCore::RenderTreeMutationDisallowedScope::~RenderTreeMutationDisallowedScope):
+ (WebCore::RenderTreeMutationDisallowedScope::isMutationAllowed):
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::destroy):
+
2020-08-13 Chris Dumez <[email protected]>
REGRESSION (r260684): Messages YouTube inline video: after Multitasking away and Back, Audio is heard but icon indicates "muted"
Modified: trunk/Source/WebCore/Sources.txt (265629 => 265630)
--- trunk/Source/WebCore/Sources.txt 2020-08-13 22:20:04 UTC (rev 265629)
+++ trunk/Source/WebCore/Sources.txt 2020-08-13 22:28:42 UTC (rev 265630)
@@ -2171,6 +2171,7 @@
rendering/RenderTextLineBoxes.cpp
rendering/RenderTheme.cpp
rendering/RenderTreeAsText.cpp
+rendering/RenderTreeMutationDisallowedScope.cpp
rendering/RenderVTTCue.cpp
rendering/RenderVideo.cpp
rendering/RenderView.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265629 => 265630)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-13 22:20:04 UTC (rev 265629)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-13 22:28:42 UTC (rev 265630)
@@ -385,6 +385,7 @@
115CFA82208B8EDA001E6991 /* FloatingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA80208B8EDA001E6991 /* FloatingState.h */; settings = {ATTRIBUTES = (Private, ); }; };
115CFA86208B9066001E6991 /* FloatingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA84208B9066001E6991 /* FloatingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
115CFA97208B952B001E6991 /* LayoutBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA95208B952B001E6991 /* LayoutBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1163F82424E5D5AE000AB960 /* RenderTreeMutationDisallowedScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 1163F82124E5D59B000AB960 /* RenderTreeMutationDisallowedScope.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 */; };
119340971FED715500935F1E /* RenderTreeBuilderFormControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340951FED715500935F1E /* RenderTreeBuilderFormControls.h */; };
@@ -6091,6 +6092,8 @@
115CFA89208B921A001E6991 /* BlockMarginCollapse.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockMarginCollapse.cpp; sourceTree = "<group>"; };
115CFA95208B952B001E6991 /* LayoutBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutBox.h; sourceTree = "<group>"; };
115CFA96208B952B001E6991 /* LayoutBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutBox.cpp; sourceTree = "<group>"; };
+ 1163F82124E5D59B000AB960 /* RenderTreeMutationDisallowedScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeMutationDisallowedScope.h; sourceTree = "<group>"; };
+ 1163F82324E5D59B000AB960 /* RenderTreeMutationDisallowedScope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeMutationDisallowedScope.cpp; sourceTree = "<group>"; };
119340761FE8B92300935F1E /* RenderTreeBuilderTable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderTable.cpp; sourceTree = "<group>"; };
119340771FE8B92300935F1E /* RenderTreeBuilderTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderTable.h; sourceTree = "<group>"; };
119340871FEB355D00935F1E /* RenderTreeBuilderRuby.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderRuby.cpp; sourceTree = "<group>"; };
@@ -28863,6 +28866,8 @@
BCEA4849097D93020094C9E4 /* RenderThemeMac.mm */,
93955A4203D72932008635CE /* RenderTreeAsText.cpp */,
93955A4103D72932008635CE /* RenderTreeAsText.h */,
+ 1163F82324E5D59B000AB960 /* RenderTreeMutationDisallowedScope.cpp */,
+ 1163F82124E5D59B000AB960 /* RenderTreeMutationDisallowedScope.h */,
E4B41E330CBFB60900AF2ECE /* RenderVideo.cpp */,
E4B41E340CBFB60900AF2ECE /* RenderVideo.h */,
BCEA4828097D93020094C9E4 /* RenderView.cpp */,
@@ -33222,6 +33227,7 @@
E47C39331FE6E10800BBBC6B /* RenderTreeBuilderMultiColumn.h in Headers */,
1193408A1FEB355D00935F1E /* RenderTreeBuilderRuby.h in Headers */,
119340791FE8B92300935F1E /* RenderTreeBuilderTable.h in Headers */,
+ 1163F82424E5D5AE000AB960 /* RenderTreeMutationDisallowedScope.h in Headers */,
E47C392E1FE6E0F700BBBC6B /* RenderTreePosition.h in Headers */,
E47C392F1FE6E0F900BBBC6B /* RenderTreeUpdater.h in Headers */,
E47C39311FE6E10200BBBC6B /* RenderTreeUpdaterGeneratedContent.h in Headers */,
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (265629 => 265630)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-08-13 22:20:04 UTC (rev 265629)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-08-13 22:28:42 UTC (rev 265630)
@@ -111,6 +111,7 @@
#include "RenderText.h"
#include "RenderTheme.h"
#include "RenderTreeAsText.h"
+#include "RenderTreeMutationDisallowedScope.h"
#include "RenderView.h"
#include "RuntimeEnabledFeatures.h"
#include "SVGNames.h"
@@ -1865,6 +1866,8 @@
RenderLayer* RenderLayer::enclosingScrollableLayer(IncludeSelfOrNot includeSelf, CrossFrameBoundaries crossFrameBoundaries) const
{
+ RenderTreeMutationDisallowedScope renderTreeMutationDisallowedScope;
+
auto isConsideredScrollable = [](const RenderLayer& layer) {
return is<RenderBox>(layer.renderer()) && downcast<RenderBox>(layer.renderer()).canBeScrolledAndHasScrollableArea();
};
Added: trunk/Source/WebCore/rendering/RenderTreeMutationDisallowedScope.cpp (0 => 265630)
--- trunk/Source/WebCore/rendering/RenderTreeMutationDisallowedScope.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/RenderTreeMutationDisallowedScope.cpp 2020-08-13 22:28:42 UTC (rev 265630)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 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 "RenderTreeMutationDisallowedScope.h"
+
+namespace WebCore {
+
+RenderTreeMutationDisallowedScope* RenderTreeMutationDisallowedScope::s_currentMutationAssertion = nullptr;
+
+}
Added: trunk/Source/WebCore/rendering/RenderTreeMutationDisallowedScope.h (0 => 265630)
--- trunk/Source/WebCore/rendering/RenderTreeMutationDisallowedScope.h (rev 0)
+++ trunk/Source/WebCore/rendering/RenderTreeMutationDisallowedScope.h 2020-08-13 22:28:42 UTC (rev 265630)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 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
+
+namespace WebCore {
+
+class RenderTreeMutationDisallowedScope {
+public:
+ RenderTreeMutationDisallowedScope()
+ : m_previousMutationAssertion(s_currentMutationAssertion)
+ {
+ s_currentMutationAssertion = this;
+ }
+
+ ~RenderTreeMutationDisallowedScope()
+ {
+ s_currentMutationAssertion = m_previousMutationAssertion;
+ }
+
+ static bool isMutationAllowed() { return !s_currentMutationAssertion; }
+
+private:
+ RenderTreeMutationDisallowedScope* m_previousMutationAssertion { nullptr };
+ static RenderTreeMutationDisallowedScope* s_currentMutationAssertion;
+};
+
+}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (265629 => 265630)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2020-08-13 22:20:04 UTC (rev 265629)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2020-08-13 22:28:42 UTC (rev 265630)
@@ -67,6 +67,7 @@
#include "RenderTreeBuilderRuby.h"
#include "RenderTreeBuilderSVG.h"
#include "RenderTreeBuilderTable.h"
+#include "RenderTreeMutationDisallowedScope.h"
#include "RenderView.h"
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
@@ -163,6 +164,7 @@
void RenderTreeBuilder::destroy(RenderObject& renderer)
{
+ RELEASE_ASSERT(RenderTreeMutationDisallowedScope::isMutationAllowed());
ASSERT(renderer.parent());
auto toDestroy = detach(*renderer.parent(), renderer);