Diff
Modified: branches/safari-612.1.5-branch/LayoutTests/ChangeLog (273861 => 273862)
--- branches/safari-612.1.5-branch/LayoutTests/ChangeLog 2021-03-04 01:00:45 UTC (rev 273861)
+++ branches/safari-612.1.5-branch/LayoutTests/ChangeLog 2021-03-04 01:00:49 UTC (rev 273862)
@@ -1,5 +1,55 @@
2021-03-03 Alan Coon <alanc...@apple.com>
+ Cherry-pick r273821. rdar://problem/75009461
+
+ REGRESSION (r266288): Web Inspector: ::marker shows on every element now
+ https://bugs.webkit.org/show_bug.cgi?id=222384
+
+ Reviewed by Devin Rousso.
+
+ Source/WebCore:
+
+ Test: inspector/css/getMatchedStylesForNodeMarkerPseudoId.html
+
+ Add filtering of the `::marker` CSS rule for elements that are not list items, as they do no apply to the
+ element.
+
+ * inspector/agents/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
+ - Added filtering for `*::marker` rules on non-`display:list-item` elements.
+ (WebCore::InspectorCSSAgent::buildObjectForRule):
+ - Drive-by refactoring to reduce code duplication.
+
+ LayoutTests:
+
+ Added test for the filtering of `*::marker` selector from the rule results of `CSS.getMatchedStyleForNode` on
+ elements that don't support `::marker`.
+
+ * inspector/css/getMatchedStylesForNode-expected.txt:
+ - Updated expectations to account for the abscence of the `::marker` rule on non-list elements.
+ * inspector/css/getMatchedStylesForNodeMarkerPseudoId-expected.txt: Added.
+ * inspector/css/getMatchedStylesForNodeMarkerPseudoId.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-03-03 Patrick Angle <pan...@apple.com>
+
+ REGRESSION (r266288): Web Inspector: ::marker shows on every element now
+ https://bugs.webkit.org/show_bug.cgi?id=222384
+
+ Reviewed by Devin Rousso.
+
+ Added test for the filtering of `*::marker` selector from the rule results of `CSS.getMatchedStyleForNode` on
+ elements that don't support `::marker`.
+
+ * inspector/css/getMatchedStylesForNode-expected.txt:
+ - Updated expectations to account for the abscence of the `::marker` rule on non-list elements.
+ * inspector/css/getMatchedStylesForNodeMarkerPseudoId-expected.txt: Added.
+ * inspector/css/getMatchedStylesForNodeMarkerPseudoId.html: Added.
+
+2021-03-03 Alan Coon <alanc...@apple.com>
+
Cherry-pick r273764. rdar://problem/75009398
The layout of SVGImage should force the layout for its clients
Modified: branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNode-expected.txt (273861 => 273862)
--- branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNode-expected.txt 2021-03-04 01:00:45 UTC (rev 273861)
+++ branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNode-expected.txt 2021-03-04 01:00:49 UTC (rev 273862)
@@ -379,54 +379,6 @@
]
},
{
- "pseudoId": "marker",
- "matches": [
- {
- "rule": {
- "selectorList": {
- "selectors": [
- {
- "text": "div::marker",
- "specificity": [
- 0,
- 0,
- 2
- ]
- }
- ],
- "text": "div::marker",
- "range": "<filtered>"
- },
- "sourceLine": "<filtered>",
- "origin": "author",
- "style": {
- "cssProperties": [
- {
- "name": "z-index",
- "value": "3",
- "text": "z-index: 3;",
- "range": "<filtered>",
- "implicit": false,
- "status": "active"
- }
- ],
- "shorthandEntries": [],
- "styleId": "<filtered>",
- "width": "",
- "height": "",
- "range": "<filtered>",
- "cssText": " z-index: 3; "
- },
- "sourceURL": "<filtered>",
- "ruleId": "<filtered>"
- },
- "matchingSelectors": [
- 0
- ]
- }
- ]
- },
- {
"pseudoId": "before",
"matches": [
{
Added: branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNodeMarkerPseudoId-expected.txt (0 => 273862)
--- branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNodeMarkerPseudoId-expected.txt (rev 0)
+++ branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNodeMarkerPseudoId-expected.txt 2021-03-04 01:00:49 UTC (rev 273862)
@@ -0,0 +1,14 @@
+Tests for the CSS.getMatchedStyleForNode command and the `::marker` CSS rule selector.
+
+
+== Running test suite: CSS.getMatchedStyleForNode.MarkerPseudoId
+-- Running test case: CSS.getMatchedStyleForNode.MarkerPseudoId.ListItem
+PASS: Expected exactly 2 rules for selector `*::marker`.
+
+-- Running test case: CSS.getMatchedStyleForNode.MarkerPseudoId.NonListItem
+PASS: Expected no rules entry for selector `*::marker`.
+
+-- Running test case: CSS.getMatchedStyleForNode.MarkerPseudoId.NonListItemWithMarkerSpecified
+PASS: Expected no rules entry for selector `*::marker`.
+PASS: Expected 3 rules for selector `*::marker`.
+
Added: branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNodeMarkerPseudoId.html (0 => 273862)
--- branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNodeMarkerPseudoId.html (rev 0)
+++ branches/safari-612.1.5-branch/LayoutTests/inspector/css/getMatchedStylesForNodeMarkerPseudoId.html 2021-03-04 01:00:49 UTC (rev 273862)
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function changeElementDisplayValue(id, value)
+{
+ document.getElementById(id).style.display = value;
+}
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("CSS.getMatchedStyleForNode.MarkerPseudoId");
+
+ function addTestCase({name, description, selector, domNodeStylesHandler})
+ {
+ suite.addTestCase({
+ name,
+ description,
+ async test() {
+ let documentNode = await WI.domManager.requestDocument();
+ let nodeId = await documentNode.querySelector(selector);
+ let domNode = WI.domManager.nodeForId(nodeId);
+ InspectorTest.assert(domNode, `Should find DOM Node for selector '${selector}'.`);
+
+ let domNodeStyles = WI.cssManager.stylesForNode(domNode);
+ InspectorTest.assert(domNodeStyles, `Should find CSS Styles for DOM Node.`);
+ await domNodeStyles.refreshIfNeeded();
+
+ await domNodeStylesHandler(domNodeStyles);
+ },
+ });
+ }
+
+ async function changeElementDisplayValue(id, value)
+ {
+ await InspectorTest.evaluateInPage(`changeElementDisplayValue("${id}", "${value}")`);
+ }
+
+ addTestCase({
+ name: "CSS.getMatchedStyleForNode.MarkerPseudoId.ListItem",
+ description: "A list item should have both the User Agent and authored `::marker` rules.",
+ selector: "#listItem",
+ async domNodeStylesHandler(styles) {
+ InspectorTest.expectEqual(styles.pseudoElements.get(WI.CSSManager.PseudoSelectorNames.Marker).matchedRules.length, 2, "Expected exactly 2 rules for selector `*::marker`.");
+ }
+ });
+
+ addTestCase({
+ name: "CSS.getMatchedStyleForNode.MarkerPseudoId.NonListItem",
+ description: "A non-list item should have no `::marker` rules.",
+ selector: "#nonListItem",
+ async domNodeStylesHandler(styles) {
+ InspectorTest.expectEqual(styles.pseudoElements.get(WI.CSSManager.PseudoSelectorNames.Marker), undefined, "Expected no rules entry for selector `*::marker`.");
+ }
+ });
+
+ addTestCase({
+ name: "CSS.getMatchedStyleForNode.MarkerPseudoId.NonListItemWithMarkerSpecified",
+ description: "A non-list item with a `base-selector::marker` specified should not show the specified rule unless it becomes a list item.",
+ selector: "#nonListItemWithMarkerSpecified",
+ async domNodeStylesHandler(styles) {
+ InspectorTest.expectEqual(styles.pseudoElements.get(WI.CSSManager.PseudoSelectorNames.Marker), undefined, "Expected no rules entry for selector `*::marker`.");
+ await changeElementDisplayValue("nonListItemWithMarkerSpecified", "list-item");
+ await styles.refresh();
+ InspectorTest.expectEqual(styles.pseudoElements.get(WI.CSSManager.PseudoSelectorNames.Marker).matchedRules.length, 3, "Expected 3 rules for selector `*::marker`.");
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+<style>
+ ::marker {
+ color: red;
+ }
+ #nonListItemWithMarkerSpecified::marker {
+ color: green;
+ }
+</style>
+</head>
+<body _onload_="runTest()">
+ <p>Tests for the CSS.getMatchedStyleForNode command and the `::marker` CSS rule selector.</p>
+ <ul>
+ <li id="listItem"></li>
+ </ul>
+ <div id="nonListItem"></div>
+ <div id="nonListItemWithMarkerSpecified"></div>
+</body>
+</html>
Modified: branches/safari-612.1.5-branch/Source/WebCore/ChangeLog (273861 => 273862)
--- branches/safari-612.1.5-branch/Source/WebCore/ChangeLog 2021-03-04 01:00:45 UTC (rev 273861)
+++ branches/safari-612.1.5-branch/Source/WebCore/ChangeLog 2021-03-04 01:00:49 UTC (rev 273862)
@@ -1,5 +1,58 @@
2021-03-03 Alan Coon <alanc...@apple.com>
+ Cherry-pick r273821. rdar://problem/75009461
+
+ REGRESSION (r266288): Web Inspector: ::marker shows on every element now
+ https://bugs.webkit.org/show_bug.cgi?id=222384
+
+ Reviewed by Devin Rousso.
+
+ Source/WebCore:
+
+ Test: inspector/css/getMatchedStylesForNodeMarkerPseudoId.html
+
+ Add filtering of the `::marker` CSS rule for elements that are not list items, as they do no apply to the
+ element.
+
+ * inspector/agents/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
+ - Added filtering for `*::marker` rules on non-`display:list-item` elements.
+ (WebCore::InspectorCSSAgent::buildObjectForRule):
+ - Drive-by refactoring to reduce code duplication.
+
+ LayoutTests:
+
+ Added test for the filtering of `*::marker` selector from the rule results of `CSS.getMatchedStyleForNode` on
+ elements that don't support `::marker`.
+
+ * inspector/css/getMatchedStylesForNode-expected.txt:
+ - Updated expectations to account for the abscence of the `::marker` rule on non-list elements.
+ * inspector/css/getMatchedStylesForNodeMarkerPseudoId-expected.txt: Added.
+ * inspector/css/getMatchedStylesForNodeMarkerPseudoId.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-03-03 Patrick Angle <pan...@apple.com>
+
+ REGRESSION (r266288): Web Inspector: ::marker shows on every element now
+ https://bugs.webkit.org/show_bug.cgi?id=222384
+
+ Reviewed by Devin Rousso.
+
+ Test: inspector/css/getMatchedStylesForNodeMarkerPseudoId.html
+
+ Add filtering of the `::marker` CSS rule for elements that are not list items, as they do no apply to the
+ element.
+
+ * inspector/agents/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
+ - Added filtering for `*::marker` rules on non-`display:list-item` elements.
+ (WebCore::InspectorCSSAgent::buildObjectForRule):
+ - Drive-by refactoring to reduce code duplication.
+
+2021-03-03 Alan Coon <alanc...@apple.com>
+
Cherry-pick r273764. rdar://problem/75009398
The layout of SVGImage should force the layout for its clients
Modified: branches/safari-612.1.5-branch/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp (273861 => 273862)
--- branches/safari-612.1.5-branch/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2021-03-04 01:00:45 UTC (rev 273861)
+++ branches/safari-612.1.5-branch/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2021-03-04 01:00:49 UTC (rev 273862)
@@ -501,6 +501,9 @@
if (!includePseudo || *includePseudo) {
pseudoElements = JSON::ArrayOf<Protocol::CSS::PseudoIdMatches>::create();
for (PseudoId pseudoId = PseudoId::FirstPublicPseudoId; pseudoId < PseudoId::AfterLastInternalPseudoId; pseudoId = static_cast<PseudoId>(static_cast<unsigned>(pseudoId) + 1)) {
+ // `*::marker` selectors are only applicable to elements with `display: list-item`.
+ if (pseudoId == PseudoId::Marker && element->computedStyle()->display() != DisplayType::ListItem)
+ continue;
if (auto protocolPseudoId = protocolValueForPseudoId(pseudoId)) {
auto matchedRules = styleResolver.pseudoStyleRulesForElement(element, pseudoId, Style::Resolver::AllCSSRules);
if (!matchedRules.isEmpty()) {
@@ -1088,11 +1091,7 @@
styleResolver.inspectorCSSOMWrappers().collectScopeWrappers(shadowRoot->styleScope());
CSSStyleRule* cssomWrapper = styleResolver.inspectorCSSOMWrappers().getWrapperForRuleInSheets(styleRule);
- if (!cssomWrapper)
- return nullptr;
-
- InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(cssomWrapper->parentStyleSheet());
- return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(cssomWrapper) : nullptr;
+ return buildObjectForRule(cssomWrapper);
}
RefPtr<Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(CSSStyleRule* rule)