Commit 0eba3f5e authored by Jan Scheffler's avatar Jan Scheffler Committed by Commit Bot

[devtools] Fix compositing reasons for layers

This patch uses the descriptions from composititing_reasons.cc
when tracing layers but transfers the reason via their short
name to make it compatible with LayerTree.compositingReasons
from the devtools protocol.

Bug: chromium:737838
Change-Id: Id019d725d51ae7b740ab10bd94a470c8a053bc0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1800410Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706404}
parent 2c305063
......@@ -230,7 +230,8 @@ LayerViewer.LayerDetailsView = class extends UI.Widget {
this._compositingReasonsCell.removeChildren();
const list = this._compositingReasonsCell.createChild('ul');
for (let i = 0; i < compositingReasons.length; ++i) {
let text = LayerViewer.LayerDetailsView.CompositingReasonDetail[compositingReasons[i]] || compositingReasons[i];
// The reason is coming straight from third_party/blink/renderer/platform/graphics/compositing_reasons.cc
let text = compositingReasons[i];
// If the text is more than one word but does not terminate with period, add the period.
if (/\s.*[^.]$/.test(text)) {
text += '.';
......@@ -248,57 +249,6 @@ LayerViewer.LayerDetailsView.Events = {
PaintProfilerRequested: Symbol('PaintProfilerRequested')
};
/**
* @type {!Object.<string, string>}
*/
LayerViewer.LayerDetailsView.CompositingReasonDetail = {
'transform3D': Common.UIString('Composition due to association with an element with a CSS 3D transform.'),
'video': Common.UIString('Composition due to association with a <video> element.'),
'canvas': Common.UIString('Composition due to the element being a <canvas> element.'),
'plugin': Common.UIString('Composition due to association with a plugin.'),
'iFrame': Common.UIString('Composition due to association with an <iframe> element.'),
'backfaceVisibilityHidden':
Common.UIString('Composition due to association with an element with a "backface-visibility: hidden" style.'),
'animation': Common.UIString('Composition due to association with an animated element.'),
'filters': Common.UIString('Composition due to association with an element with CSS filters applied.'),
'scrollDependentPosition': Common.UIString(
'Composition due to association with an element with a "position: fixed" or "position: sticky" style.'),
'overflowScrollingTouch':
Common.UIString('Composition due to association with an element with a "overflow-scrolling: touch" style.'),
'blending':
Common.UIString('Composition due to association with an element that has blend mode other than "normal".'),
'assumedOverlap':
Common.UIString('Composition due to association with an element that may overlap other composited elements.'),
'overlap': Common.UIString('Composition due to association with an element overlapping other composited elements.'),
'negativeZIndexChildren':
Common.UIString('Composition due to association with an element with descendants that have a negative z-index.'),
'transformWithCompositedDescendants':
Common.UIString('Composition due to association with an element with composited descendants.'),
'opacityWithCompositedDescendants': Common.UIString(
'Composition due to association with an element with opacity applied and composited descendants.'),
'maskWithCompositedDescendants':
Common.UIString('Composition due to association with a masked element and composited descendants.'),
'reflectionWithCompositedDescendants':
Common.UIString('Composition due to association with an element with a reflection and composited descendants.'),
'filterWithCompositedDescendants': Common.UIString(
'Composition due to association with an element with CSS filters applied and composited descendants.'),
'blendingWithCompositedDescendants': Common.UIString(
'Composition due to association with an element with CSS blending applied and composited descendants.'),
'clipsCompositingDescendants':
Common.UIString('Composition due to association with an element clipping compositing descendants.'),
'perspective': Common.UIString('Composition due to association with an element with perspective applied.'),
'preserve3D':
Common.UIString('Composition due to association with an element with a "transform-style: preserve-3d" style.'),
'root': Common.UIString('Root layer.'),
'layerForClip': Common.UIString('Layer for clip.'),
'layerForScrollbar': Common.UIString('Layer for scrollbar.'),
'layerForScrollingContainer': Common.UIString('Layer for scrolling container.'),
'layerForForeground': Common.UIString('Layer for foreground.'),
'layerForBackground': Common.UIString('Layer for background.'),
'layerForMask': Common.UIString('Layer for mask.'),
'layerForVideoOverlay': Common.UIString('Layer for video overlay.'),
};
LayerViewer.LayerDetailsView._slowScrollRectNames = new Map([
[SDK.Layer.ScrollRectType.NonFastScrollable, Common.UIString('Non fast scrollable')],
[SDK.Layer.ScrollRectType.TouchEventHandler, Common.UIString('Touch event handler')],
......
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<message name="IDS_DEVTOOLS_05245b74ad79bb210a68107f7de0c27f" desc="Text in Layer Details View of the Layers panel">
Layer for scrolling container.
</message>
<message name="IDS_DEVTOOLS_08415c56f6c6c2efb0218629836e31bc" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with a &quot;backface-visibility: hidden&quot; style.
</message>
<message name="IDS_DEVTOOLS_0aa3ae694efd06789ae1867c80d30222" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with a &quot;position: fixed&quot; or &quot;position: sticky&quot; style.
</message>
<message name="IDS_DEVTOOLS_0b4eb322e51b61340668247151340346" desc="Tooltip text that appears when hovering over largeicon rotate button in Transform Controller of the Layers panel">
Rotate mode (V)
</message>
<message name="IDS_DEVTOOLS_0dd70cbbb618cf0ea39d7e01238ca1b9" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an animated element.
</message>
<message name="IDS_DEVTOOLS_135d78fcc62ff8df8028c33c768900c5" desc="Text in Layer Details View of the Layers panel">
Layer for background.
</message>
<message name="IDS_DEVTOOLS_219e2fb2d37a581ab2bae57397b601f1" desc="Text in Layer Details View of the Layers panel">
&lt;unnamed&gt;
</message>
<message name="IDS_DEVTOOLS_233612553595af00e5d227e136252422" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with composited descendants.
</message>
<message name="IDS_DEVTOOLS_25d066be1268d5c07cae5cc26e06ad2b" desc="Text in Layer Details View of the Layers panel">
Slow scroll regions
</message>
<message name="IDS_DEVTOOLS_28b5b4891eb05cc50f537526b24038a9" desc="Text in Layer Details View of the Layers panel">
Composition due to association with a masked element and composited descendants.
</message>
<message name="IDS_DEVTOOLS_2a2924d1d77c00d27ce2509c34861804" desc="Text in Layer Details View of the Layers panel">
Layer for clip.
</message>
<message name="IDS_DEVTOOLS_2ca2308d45c04266f0fb51786e407287" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with CSS filters applied and composited descendants.
</message>
<message name="IDS_DEVTOOLS_3228417bf9ed949e7447e7c8dcb17090" desc="Text in Layer Details View of the Layers panel">
Memory estimate
</message>
<message name="IDS_DEVTOOLS_37de7295335e95cb7caf78303a1edad3" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with a CSS 3D transform.
</message>
<message name="IDS_DEVTOOLS_398b889c147f3b2cb3c674cfb07315b5" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with opacity applied and composited descendants.
</message>
<message name="IDS_DEVTOOLS_441f5e043a240bac8dca50f90f7be3de" desc="Text in DView of the Layers panel">
repaints on scroll
</message>
......@@ -66,18 +33,12 @@
<message name="IDS_DEVTOOLS_4ee55709b19d806bb2f83a264a8a0f75" desc="Sticky box rect element text content in Layer Details View of the Layers panel">
Sticky Box <ph name="STICKYBOXRECT_WIDTH">$1d<ex>10</ex></ph> × <ph name="STICKYBOXRECT_HEIGHT">$2d<ex>10</ex></ph> (at <ph name="STICKYBOXRECT_X">$3d<ex>10</ex></ph>, <ph name="STICKYBOXRECT_Y">$4d<ex>10</ex></ph>)
</message>
<message name="IDS_DEVTOOLS_5337a3314b26561ccf364e1777455933" desc="Text in Layer Details View of the Layers panel">
Composition due to association with a &lt;video&gt; element.
</message>
<message name="IDS_DEVTOOLS_5639e2813d9549835010567a48349127" desc="Details text content in Layer Tree Outline of the Layers panel">
''' (<ph name="THIS__LAYER_WIDTH__">$1d<ex>10</ex></ph> × <ph name="THIS__LAYER_HEIGHT__">$2d<ex>10</ex></ph>)
</message>
<message name="IDS_DEVTOOLS_602f4c0713480f019b24f09218dcc7e0" desc="A context menu item in the DView of the Layers panel">
Reset View
</message>
<message name="IDS_DEVTOOLS_697e0fb75c6cf44734697517d44b5922" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element clipping compositing descendants.
</message>
<message name="IDS_DEVTOOLS_6fac3a4381f0fb07bbf498a08d301d40" desc="Text in Layer Details View of the Layers panel">
Repaints on scroll
</message>
......@@ -90,21 +51,12 @@
<message name="IDS_DEVTOOLS_71084df87a4cc161f7542a0f5295a950" desc="Text in Layer Details View of the Layers panel">
Select a layer to see its details
</message>
<message name="IDS_DEVTOOLS_73c57dbc070bac535d75b4abe9f614a3" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element overlapping other composited elements.
</message>
<message name="IDS_DEVTOOLS_74248c725e00bf9fe04df4e35b249a19" desc="Text in Paint Profiler View of the Layers panel">
Misc
</message>
<message name="IDS_DEVTOOLS_74ae7b35b54cd38a932ccc4f1d1c3775" desc="Text in Layer Details View of the Layers panel">
Touch event handler
</message>
<message name="IDS_DEVTOOLS_791faaf55ae39199cc0b4edde837f07a" desc="Text in Layer Details View of the Layers panel">
Layer for video overlay.
</message>
<message name="IDS_DEVTOOLS_7eb830853b9ed22a567e4d7582eafe7c" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with CSS filters applied.
</message>
<message name="IDS_DEVTOOLS_82505980aa6b0cabf4cb8013a8a43b62" desc="Text in Layer Details View of the Layers panel">
Non fast scrollable
</message>
......@@ -114,30 +66,15 @@
<message name="IDS_DEVTOOLS_86ee74baff479d85d18f2cda9f8a9518" desc="Text in Paint Profiler View of the Layers panel">
Bitmap
</message>
<message name="IDS_DEVTOOLS_8810c4e0c498b81a6e4adaeabcb9f624" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with a &quot;overflow-scrolling: touch&quot; style.
</message>
<message name="IDS_DEVTOOLS_894982f4a3bc0e770cece61dd12dde55" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an &lt;iframe&gt; element.
</message>
<message name="IDS_DEVTOOLS_932a3ef55ce8133be7b33ded2992fd97" desc="Text in Layer Details View of the Layers panel">
Compositing Reasons
</message>
<message name="IDS_DEVTOOLS_93c3341232864688bcea4d53dff1bf10" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with perspective applied.
</message>
<message name="IDS_DEVTOOLS_991bd14abd9e6004de4e7b9bc0769d9d" desc="Text in Layer Details View of the Layers panel">
Layer for foreground.
</message>
<message name="IDS_DEVTOOLS_9b8379825de60ccb900acf83934e1409" desc="Text in Layer View Host of the Layers panel">
Show internal layers
</message>
<message name="IDS_DEVTOOLS_a673813c8d6c5f511cc4d80830fc4503" desc="Text in DView of the Layers panel">
Can&apos;t display layers,
</message>
<message name="IDS_DEVTOOLS_aefd09cd861bbb01d381cfd74856e877" desc="Text in Layer Details View of the Layers panel">
Composition due to the element being a &lt;canvas&gt; element.
</message>
<message name="IDS_DEVTOOLS_b336b2cbaa7391e6e0dfef888d35a837" desc="Text in DView of the Layers panel">
touch event listener
</message>
......@@ -162,21 +99,6 @@
<message name="IDS_DEVTOOLS_ce1efcf7f040106cc8cb2f24c9efee35" desc="A context menu item in the DView of the Layers panel">
Show Paint Profiler
</message>
<message name="IDS_DEVTOOLS_cf4db365a841e7208aad0d474cbfa8e3" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with descendants that have a negative z-index.
</message>
<message name="IDS_DEVTOOLS_d446f65fe70f9a640908576792497e25" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with a reflection and composited descendants.
</message>
<message name="IDS_DEVTOOLS_dd4d335a4deb975546acc9fb5aa3ffce" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element that may overlap other composited elements.
</message>
<message name="IDS_DEVTOOLS_dff689f21faf977ee865e312c011c84a" desc="Text in Layer Details View of the Layers panel">
Root layer.
</message>
<message name="IDS_DEVTOOLS_e397c87a940fc2c10225a407c7f124a7" desc="Text in Layer Details View of the Layers panel">
Composition due to association with a plugin.
</message>
<message name="IDS_DEVTOOLS_e763043c4af617c6f33da361d990a77b" desc="Tooltip text that appears when hovering over the largeicon center button in the Transform Controller of the Layers panel">
Reset transform (0)
</message>
......@@ -186,21 +108,6 @@
<message name="IDS_DEVTOOLS_ed3a481889f16ef0aab2349f5d8b5f12" desc="Containing block rect element text content in Layer Details View of the Layers panel">
Containing Block <ph name="CONTAININGBLOCKRECT_WIDTH">$1d<ex>10</ex></ph> × <ph name="CONTAININGBLOCKRECT_HEIGHT">$2d<ex>10</ex></ph> (at <ph name="CONTAININGBLOCKRECT_X">$3d<ex>10</ex></ph>, <ph name="CONTAININGBLOCKRECT_Y">$4d<ex>10</ex></ph>)
</message>
<message name="IDS_DEVTOOLS_f1eb415fdb8a15856c29cc2b679e416b" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with a &quot;transform-style: preserve-3d&quot; style.
</message>
<message name="IDS_DEVTOOLS_f2a4f55a424726ae504f2e694e3dc2a2" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element with CSS blending applied and composited descendants.
</message>
<message name="IDS_DEVTOOLS_fa055d01c0a331d642c2f55a39d4e1bb" desc="Text in Layer Details View of the Layers panel">
Composition due to association with an element that has blend mode other than &quot;normal&quot;.
</message>
<message name="IDS_DEVTOOLS_fb8ed4e0cd9d6ac3630df425c80d9036" desc="Text in Layer Details View of the Layers panel">
Layer for mask.
</message>
<message name="IDS_DEVTOOLS_fd63c694ddc8073cf10bb8025aa9aaaf" desc="Text in Layer Details View of the Layers panel">
Layer for scrollbar.
</message>
<message name="IDS_DEVTOOLS_a3ed19b48390aad906de764e0476142d" desc="Text for a checkbox in the toolbar of the Layers panel to show the paints of the page">
Paints
</message>
......
......@@ -190,7 +190,12 @@ TimelineModel.TracingLayer = class {
this._parent = null;
this._quad = payload.layer_quad || [];
this._createScrollRects(payload);
this._compositingReasons = payload.compositing_reasons || [];
// Keep payload.compositing_reasons as a default
// but use the newer payload.debug_info.compositing_reasons
// if the first one is not set.
this._compositingReasons =
payload.compositing_reasons || (payload.debug_info && payload.debug_info.compositing_reasons) || [];
this._drawsContent = !!payload.draws_content;
this._gpuMemoryUsage = payload.gpu_memory_usage;
this._paints = [];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment