Title: [287046] trunk/Source/WebCore
Revision
287046
Author
[email protected]
Date
2021-12-14 14:04:50 -0800 (Tue, 14 Dec 2021)

Log Message

Web Inspector: After r286657, anonymous layers are providing an empty string for their grouping text
https://bugs.webkit.org/show_bug.cgi?id=234012

Reviewed by Devin Rousso.

Covered by existing test: LayoutTests/inspector/css/getMatchedStylesForNodeLayerGrouping.html

For anonymous layers, we should not provide the `text` property to the frontend, as there is technically no
text, not an empty string, provided by the author. This is effectively a minor optimization, as the frontend
does correctly handle an empty string the same way it handles no string.

* inspector/InspectorStyleSheet.cpp:
(WebCore::buildArrayForGroupings):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287045 => 287046)


--- trunk/Source/WebCore/ChangeLog	2021-12-14 21:31:59 UTC (rev 287045)
+++ trunk/Source/WebCore/ChangeLog	2021-12-14 22:04:50 UTC (rev 287046)
@@ -1,3 +1,19 @@
+2021-12-14  Patrick Angle  <[email protected]>
+
+        Web Inspector: After r286657, anonymous layers are providing an empty string for their grouping text
+        https://bugs.webkit.org/show_bug.cgi?id=234012
+
+        Reviewed by Devin Rousso.
+
+        Covered by existing test: LayoutTests/inspector/css/getMatchedStylesForNodeLayerGrouping.html
+
+        For anonymous layers, we should not provide the `text` property to the frontend, as there is technically no
+        text, not an empty string, provided by the author. This is effectively a minor optimization, as the frontend
+        does correctly handle an empty string the same way it handles no string.
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::buildArrayForGroupings):
+
 2021-12-14  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Take text-align offset into account when computing the RTL display box geometry

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (287045 => 287046)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2021-12-14 21:31:59 UTC (rev 287045)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2021-12-14 22:04:50 UTC (rev 287046)
@@ -478,7 +478,9 @@
             auto layerRulePayload = Protocol::CSS::Grouping::create()
                 .setType(Protocol::CSS::Grouping::Type::LayerRule)
                 .release();
-            layerRulePayload->setText(downcast<CSSLayerBlockRule>(parentRule)->name());
+            auto layerName = downcast<CSSLayerBlockRule>(parentRule)->name();
+            if (!layerName.isEmpty())
+                layerRulePayload->setText(layerName);
             ruleGroupingPayloads.append(WTFMove(layerRulePayload));
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to