Title: [275293] trunk/Source/WebCore
Revision
275293
Author
pan...@apple.com
Date
2021-03-31 10:49:07 -0700 (Wed, 31 Mar 2021)

Log Message

Web Inspector: CSS Grid overlay track sizes are incorrect when inline styles are applied to the element
https://bugs.webkit.org/show_bug.cgi?id=223908

Reviewed by BJ Burg.

Add checking the inline style attributes on an element when collecting authored track sizes for grid overlays.

* inspector/InspectorOverlay.cpp:
(WebCore::authoredGridTrackSizes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275292 => 275293)


--- trunk/Source/WebCore/ChangeLog	2021-03-31 17:39:10 UTC (rev 275292)
+++ trunk/Source/WebCore/ChangeLog	2021-03-31 17:49:07 UTC (rev 275293)
@@ -1,3 +1,15 @@
+2021-03-31  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: CSS Grid overlay track sizes are incorrect when inline styles are applied to the element
+        https://bugs.webkit.org/show_bug.cgi?id=223908
+
+        Reviewed by BJ Burg.
+
+        Add checking the inline style attributes on an element when collecting authored track sizes for grid overlays.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::authoredGridTrackSizes):
+
 2021-03-31  Chris Dumez  <cdu...@apple.com>
 
         ServiceWorkerContextData should not be saved both on ServiceWorkerThread & ServiceWorkerGlobalScope

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (275292 => 275293)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2021-03-31 17:39:10 UTC (rev 275292)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2021-03-31 17:49:07 UTC (rev 275293)
@@ -35,6 +35,7 @@
 #include "CSSGridAutoRepeatValue.h"
 #include "CSSGridIntegerRepeatValue.h"
 #include "CSSGridLineNamesValue.h"
+#include "CSSStyleDeclaration.h"
 #include "DOMCSSNamespace.h"
 #include "DOMTokenList.h"
 #include "Element.h"
@@ -1494,20 +1495,24 @@
 
 static Vector<String> authoredGridTrackSizes(Node* node, GridTrackSizingDirection direction, unsigned expectedTrackCount)
 {
-    if (!is<Element>(node))
+    if (!is<StyledElement>(node))
         return { };
-    
-    auto element = downcast<Element>(node);
-    auto styleRules = element->styleResolver().styleRulesForElement(element);
-    styleRules.reverse();
-    RefPtr<CSSValue> cssValue;
-    for (auto styleRule : styleRules) {
-        ASSERT(styleRule);
-        if (!styleRule)
-            continue;
-        cssValue = styleRule->properties().getPropertyCSSValue(direction == GridTrackSizingDirection::ForColumns ? CSSPropertyID::CSSPropertyGridTemplateColumns : CSSPropertyID::CSSPropertyGridTemplateRows);
-        if (cssValue)
-            break;
+
+    auto element = downcast<StyledElement>(node);
+    auto directionCSSPropertyID = direction == GridTrackSizingDirection::ForColumns ? CSSPropertyID::CSSPropertyGridTemplateColumns : CSSPropertyID::CSSPropertyGridTemplateRows;
+    RefPtr<CSSValue> cssValue = element->cssomStyle().getPropertyCSSValueInternal(directionCSSPropertyID);
+
+    if (!cssValue) {
+        auto styleRules = element->styleResolver().styleRulesForElement(element);
+        styleRules.reverse();
+        for (auto styleRule : styleRules) {
+            ASSERT(styleRule);
+            if (!styleRule)
+                continue;
+            cssValue = styleRule->properties().getPropertyCSSValue(directionCSSPropertyID);
+            if (cssValue)
+                break;
+        }
     }
     
     if (!cssValue || !is<CSSValueList>(cssValue))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to