- Revision
- 277358
- Author
- hey...@apple.com
- Date
- 2021-05-11 23:04:18 -0700 (Tue, 11 May 2021)
Log Message
Include reasons for compositing in showLayerTree output
https://bugs.webkit.org/show_bug.cgi?id=225640
Reviewed by Simon Fraser.
Source/WebCore:
Since it seems useful to know why a layer is composited.
The logging code was only including one reason, rather than the
whole set of reasons, and that's unchanged (except for the function
name to make that clearer), although we could also just make that
include all of the reasons too.
There were two reason strings missing, which are also added --
OverflowScrollPositioning and WillChange -- which the use of a
switch should help catch in the future.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):
(WebCore::compositingReasonToString):
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::operator<<):
* rendering/RenderLayerCompositor.h:
* rendering/RenderTreeAsText.cpp:
LayoutTests:
* fast/harness/render-tree-as-text-options-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (277357 => 277358)
--- trunk/LayoutTests/ChangeLog 2021-05-12 05:55:23 UTC (rev 277357)
+++ trunk/LayoutTests/ChangeLog 2021-05-12 06:04:18 UTC (rev 277358)
@@ -1,3 +1,12 @@
+2021-05-11 Cameron McCormack <hey...@apple.com>
+
+ Include reasons for compositing in showLayerTree output
+ https://bugs.webkit.org/show_bug.cgi?id=225640
+
+ Reviewed by Simon Fraser.
+
+ * fast/harness/render-tree-as-text-options-expected.txt:
+
2021-05-11 Toshio Ogasawara <toshio.ogasaw...@access-company.com>
[MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize.
Modified: trunk/LayoutTests/fast/harness/render-tree-as-text-options-expected.txt (277357 => 277358)
--- trunk/LayoutTests/fast/harness/render-tree-as-text-options-expected.txt 2021-05-12 05:55:23 UTC (rev 277357)
+++ trunk/LayoutTests/fast/harness/render-tree-as-text-options-expected.txt 2021-05-12 06:04:18 UTC (rev 277358)
@@ -1,11 +1,11 @@
-layer at (0,0) size 800x600 (composited, bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
+layer at (0,0) size 800x600 (composited [root], bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
RenderView at (0,0) size 800x600
positive z-order list (1)
- layer at (0,0) size 800x516 layerType: background only (composited, bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
+ layer at (0,0) size 800x516 layerType: background only (composited [negative z-index children], bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
negative z-order list (1)
- layer at (8,258) size 102x52 (composited, bounds=at (0,0) size 102x52, drawsContent=1, paints into ancestor=0)
+ layer at (8,258) size 102x52 (composited [3D transform], bounds=at (0,0) size 102x52, drawsContent=1, paints into ancestor=0)
RenderBlock (positioned) zI: -1 {DIV} at (8,258) size 102x52 [border: (1px solid #000000)]
- layer at (0,0) size 800x516 layerType: foreground only (composited, bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
+ layer at (0,0) size 800x516 layerType: foreground only (composited [negative z-index children], bounds=at (0,0) size 800x600, drawsContent=1, paints into ancestor=0)
RenderBlock {HTML} at (0,0) size 800x516
RenderBody {BODY} at (8,8) size 784x500
RenderBlock {DIV} at (0,0) size 200x250 (layout overflow 0,0 200x400)
Modified: trunk/Source/WebCore/ChangeLog (277357 => 277358)
--- trunk/Source/WebCore/ChangeLog 2021-05-12 05:55:23 UTC (rev 277357)
+++ trunk/Source/WebCore/ChangeLog 2021-05-12 06:04:18 UTC (rev 277358)
@@ -1,3 +1,29 @@
+2021-05-11 Cameron McCormack <hey...@apple.com>
+
+ Include reasons for compositing in showLayerTree output
+ https://bugs.webkit.org/show_bug.cgi?id=225640
+
+ Reviewed by Simon Fraser.
+
+ Since it seems useful to know why a layer is composited.
+
+ The logging code was only including one reason, rather than the
+ whole set of reasons, and that's unchanged (except for the function
+ name to make that clearer), although we could also just make that
+ include all of the reasons too.
+
+ There were two reason strings missing, which are also added --
+ OverflowScrollPositioning and WillChange -- which the use of a
+ switch should help catch in the future.
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::logLayerInfo):
+ (WebCore::compositingReasonToString):
+ (WebCore::RenderLayerCompositor::logReasonsForCompositing):
+ (WebCore::operator<<):
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderTreeAsText.cpp:
+
2021-05-11 Chris Dumez <cdu...@apple.com>
Port WTF::FileSystem::listDirectory to std::filesystem
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (277357 => 277358)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-05-12 05:55:23 UTC (rev 277357)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-05-12 06:04:18 UTC (rev 277358)
@@ -1537,7 +1537,7 @@
if (!layer.renderer().style().hasAutoUsedZIndex())
logString.append(" z-index: ", layer.renderer().style().usedZIndex());
- logString.append(" (", logReasonsForCompositing(layer), ") ");
+ logString.append(" (", logOneReasonForCompositing(layer), ") ");
if (backing->graphicsLayer()->contentsOpaque() || backing->paintsIntoCompositedAncestor() || backing->foregroundLayer() || backing->backgroundLayer()) {
logString.append('[');
@@ -2770,91 +2770,46 @@
return reasons;
}
+static const char* compositingReasonToString(CompositingReason reason)
+{
+ switch (reason) {
+ case CompositingReason::Transform3D: return "3D transform";
+ case CompositingReason::Video: return "video";
+ case CompositingReason::Canvas: return "canvas";
+ case CompositingReason::Plugin: return "plugin";
+ case CompositingReason::IFrame: return "iframe";
+ case CompositingReason::BackfaceVisibilityHidden: return "backface-visibility: hidden";
+ case CompositingReason::ClipsCompositingDescendants: return "clips compositing descendants";
+ case CompositingReason::Animation: return "animation";
+ case CompositingReason::Filters: return "filters";
+ case CompositingReason::PositionFixed: return "position: fixed";
+ case CompositingReason::PositionSticky: return "position: sticky";
+ case CompositingReason::OverflowScrolling: return "async overflow scrolling";
+ case CompositingReason::Stacking: return "stacking";
+ case CompositingReason::Overlap: return "overlap";
+ case CompositingReason::OverflowScrollPositioning: return "overflow scroll positioning";
+ case CompositingReason::NegativeZIndexChildren: return "negative z-index children";
+ case CompositingReason::TransformWithCompositedDescendants: return "transform with composited descendants";
+ case CompositingReason::OpacityWithCompositedDescendants: return "opacity with composited descendants";
+ case CompositingReason::MaskWithCompositedDescendants: return "mask with composited descendants";
+ case CompositingReason::ReflectionWithCompositedDescendants: return "reflection with composited descendants";
+ case CompositingReason::FilterWithCompositedDescendants: return "filter with composited descendants";
+ case CompositingReason::BlendingWithCompositedDescendants: return "blending with composited descendants";
+ case CompositingReason::IsolatesCompositedBlendingDescendants: return "isolates composited blending descendants";
+ case CompositingReason::Perspective: return "perspective";
+ case CompositingReason::Preserve3D: return "preserve-3d";
+ case CompositingReason::WillChange: return "will-change";
+ case CompositingReason::Root: return "root";
+ case CompositingReason::Model: return "model";
+ }
+ return "";
+}
+
#if !LOG_DISABLED
-const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer& layer)
+const char* RenderLayerCompositor::logOneReasonForCompositing(const RenderLayer& layer)
{
- OptionSet<CompositingReason> reasons = reasonsForCompositing(layer);
-
- if (reasons & CompositingReason::Transform3D)
- return "3D transform";
-
- if (reasons & CompositingReason::Video)
- return "video";
-
- if (reasons & CompositingReason::Canvas)
- return "canvas";
-
- if (reasons & CompositingReason::Plugin)
- return "plugin";
-
- if (reasons & CompositingReason::IFrame)
- return "iframe";
-
- if (reasons & CompositingReason::BackfaceVisibilityHidden)
- return "backface-visibility: hidden";
-
- if (reasons & CompositingReason::ClipsCompositingDescendants)
- return "clips compositing descendants";
-
- if (reasons & CompositingReason::Animation)
- return "animation";
-
- if (reasons & CompositingReason::Filters)
- return "filters";
-
- if (reasons & CompositingReason::PositionFixed)
- return "position: fixed";
-
- if (reasons & CompositingReason::PositionSticky)
- return "position: sticky";
-
- if (reasons & CompositingReason::OverflowScrolling)
- return "async overflow scrolling";
-
- if (reasons & CompositingReason::Stacking)
- return "stacking";
-
- if (reasons & CompositingReason::Overlap)
- return "overlap";
-
- if (reasons & CompositingReason::NegativeZIndexChildren)
- return "negative z-index children";
-
- if (reasons & CompositingReason::TransformWithCompositedDescendants)
- return "transform with composited descendants";
-
- if (reasons & CompositingReason::OpacityWithCompositedDescendants)
- return "opacity with composited descendants";
-
- if (reasons & CompositingReason::MaskWithCompositedDescendants)
- return "mask with composited descendants";
-
- if (reasons & CompositingReason::ReflectionWithCompositedDescendants)
- return "reflection with composited descendants";
-
- if (reasons & CompositingReason::FilterWithCompositedDescendants)
- return "filter with composited descendants";
-
-#if ENABLE(CSS_COMPOSITING)
- if (reasons & CompositingReason::BlendingWithCompositedDescendants)
- return "blending with composited descendants";
-
- if (reasons & CompositingReason::IsolatesCompositedBlendingDescendants)
- return "isolates composited blending descendants";
-#endif
-
- if (reasons & CompositingReason::Perspective)
- return "perspective";
-
- if (reasons & CompositingReason::Preserve3D)
- return "preserve-3d";
-
- if (reasons & CompositingReason::Root)
- return "root";
-
- if (reasons & CompositingReason::Model)
- return "model";
-
+ for (auto reason : reasonsForCompositing(layer))
+ return compositingReasonToString(reason);
return "";
}
#endif
@@ -5055,6 +5010,11 @@
return ts;
}
+TextStream& operator<<(TextStream& ts, CompositingReason compositingReason)
+{
+ return ts << compositingReasonToString(compositingReason);
+}
+
#if PLATFORM(IOS_FAMILY)
typedef HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>> LayerMap;
typedef HashMap<PlatformLayer*, PlatformLayer*> StickyContainerMap;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (277357 => 277358)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2021-05-12 05:55:23 UTC (rev 277357)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2021-05-12 06:04:18 UTC (rev 277358)
@@ -569,7 +569,7 @@
bool shouldCompositeOverflowControls() const;
#if !LOG_DISABLED
- const char* logReasonsForCompositing(const RenderLayer&);
+ const char* logOneReasonForCompositing(const RenderLayer&);
void logLayerInfo(const RenderLayer&, const char*, int depth);
#endif
@@ -654,6 +654,7 @@
WTF::TextStream& operator<<(WTF::TextStream&, CompositingUpdateType);
WTF::TextStream& operator<<(WTF::TextStream&, CompositingPolicy);
+WTF::TextStream& operator<<(WTF::TextStream&, CompositingReason);
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (277357 => 277358)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2021-05-12 05:55:23 UTC (rev 277357)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2021-05-12 06:04:18 UTC (rev 277358)
@@ -689,7 +689,9 @@
if (behavior.contains(RenderAsTextFlag::ShowCompositedLayers)) {
if (layer.isComposited()) {
- ts << " (composited, bounds=" << layer.backing()->compositedBounds() << ", drawsContent=" << layer.backing()->graphicsLayer()->drawsContent()
+ ts << " (composited " << layer.compositor().reasonsForCompositing(layer)
+ << ", bounds=" << layer.backing()->compositedBounds()
+ << ", drawsContent=" << layer.backing()->graphicsLayer()->drawsContent()
<< ", paints into ancestor=" << layer.backing()->paintsIntoCompositedAncestor() << ")";
} else if (layer.paintsIntoProvidedBacking())
ts << " (shared backing of " << layer.backingProviderLayer() << ")";