Changeset 261703 in webkit


Ignore:
Timestamp:
May 14, 2020 12:28:41 PM (4 years ago)
Author:
Nikita Vasilyev
Message:

Web Inspector: front-end shouldn't change the order of User Style Sheet rules
https://bugs.webkit.org/show_bug.cgi?id=210893
<rdar://problem/61937118>

Reviewed by Devin Rousso.

Source/WebCore:

Previously, some style sheets were falsly detected as Inspector::Protocol::CSS::StyleSheetOrigin::User
causing incorrect order of style rules in Web Inspector.

Test: inspector/css/getMatchedStylesForNode.html

  • inspector/agents/InspectorCSSAgent.cpp:

(WebCore::InspectorCSSAgent::detectOrigin):

LayoutTests:

Test that AuthorCSS and UserCSS are correctly arranged.

  • inspector/css/getMatchedStylesForNode-expected.txt:
  • inspector/css/getMatchedStylesForNode.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261702 r261703  
     12020-05-14  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: front-end shouldn't change the order of User Style Sheet rules
     4        https://bugs.webkit.org/show_bug.cgi?id=210893
     5        <rdar://problem/61937118>
     6
     7        Reviewed by Devin Rousso.
     8
     9        Test that AuthorCSS and UserCSS are correctly arranged.
     10
     11        * inspector/css/getMatchedStylesForNode-expected.txt:
     12        * inspector/css/getMatchedStylesForNode.html:
     13
    1142020-05-14  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/LayoutTests/inspector/css/getMatchedStylesForNode-expected.txt

    r261669 r261703  
    88Matched:
    99[
     10  {
     11    "rule": {
     12      "selectorList": {
     13        "selectors": [
     14          {
     15            "text": "div",
     16            "specificity": [
     17              0,
     18              0,
     19              1
     20            ]
     21          }
     22        ],
     23        "text": "div"
     24      },
     25      "sourceLine": "<filtered>",
     26      "origin": "user",
     27      "style": {
     28        "cssProperties": [
     29          {
     30            "name": "z-index",
     31            "value": "600"
     32          }
     33        ],
     34        "shorthandEntries": [],
     35        "styleId": "<filtered>",
     36        "width": "",
     37        "height": ""
     38      },
     39      "sourceURL": "<filtered>"
     40    },
     41    "matchingSelectors": [
     42      0
     43    ]
     44  },
     45  {
     46    "rule": {
     47      "selectorList": {
     48        "selectors": [
     49          {
     50            "text": "div",
     51            "specificity": [
     52              0,
     53              0,
     54              1
     55            ]
     56          }
     57        ],
     58        "text": "div"
     59      },
     60      "sourceLine": "<filtered>",
     61      "origin": "user",
     62      "style": {
     63        "cssProperties": [
     64          {
     65            "name": "z-index",
     66            "value": "500"
     67          }
     68        ],
     69        "shorthandEntries": [],
     70        "styleId": "<filtered>",
     71        "width": "",
     72        "height": ""
     73      },
     74      "sourceURL": "<filtered>"
     75    },
     76    "matchingSelectors": [
     77      0
     78    ]
     79  },
     80  {
     81    "rule": {
     82      "selectorList": {
     83        "selectors": [
     84          {
     85            "text": "div",
     86            "specificity": [
     87              0,
     88              0,
     89              1
     90            ]
     91          }
     92        ],
     93        "text": "div"
     94      },
     95      "sourceLine": "<filtered>",
     96      "origin": "regular",
     97      "style": {
     98        "cssProperties": [
     99          {
     100            "name": "z-index",
     101            "value": "400"
     102          }
     103        ],
     104        "shorthandEntries": [],
     105        "styleId": "<filtered>",
     106        "width": "",
     107        "height": ""
     108      },
     109      "sourceURL": "<filtered>",
     110      "ruleId": "<filtered>"
     111    },
     112    "matchingSelectors": [
     113      0
     114    ]
     115  },
     116  {
     117    "rule": {
     118      "selectorList": {
     119        "selectors": [
     120          {
     121            "text": "div",
     122            "specificity": [
     123              0,
     124              0,
     125              1
     126            ]
     127          }
     128        ],
     129        "text": "div"
     130      },
     131      "sourceLine": "<filtered>",
     132      "origin": "regular",
     133      "style": {
     134        "cssProperties": [
     135          {
     136            "name": "z-index",
     137            "value": "300"
     138          }
     139        ],
     140        "shorthandEntries": [],
     141        "styleId": "<filtered>",
     142        "width": "",
     143        "height": ""
     144      },
     145      "sourceURL": "<filtered>",
     146      "ruleId": "<filtered>"
     147    },
     148    "matchingSelectors": [
     149      0
     150    ]
     151  },
    10152  {
    11153    "rule": {
  • trunk/LayoutTests/inspector/css/getMatchedStylesForNode.html

    r248943 r261703  
    22<head>
    33<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     4<script>
     5window.internals.insertAuthorCSS("div { z-index: 400; }");
     6window.internals.insertUserCSS("div { z-index: 600; }");
     7window.internals.insertAuthorCSS("div { z-index: 300; }");
     8window.internals.insertUserCSS("div { z-index: 500; }");
     9</script>
    410<style>
    511    @import url(resources/external.css?1) (min-width: 0px);
  • trunk/Source/WebCore/ChangeLog

    r261700 r261703  
     12020-05-14  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: front-end shouldn't change the order of User Style Sheet rules
     4        https://bugs.webkit.org/show_bug.cgi?id=210893
     5        <rdar://problem/61937118>
     6
     7        Reviewed by Devin Rousso.
     8
     9        Previously, some style sheets were falsly detected as Inspector::Protocol::CSS::StyleSheetOrigin::User
     10        causing incorrect order of style rules in Web Inspector.
     11
     12        Test: inspector/css/getMatchedStylesForNode.html
     13
     14        * inspector/agents/InspectorCSSAgent.cpp:
     15        (WebCore::InspectorCSSAgent::detectOrigin):
     16
    1172020-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
    218
  • trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp

    r261669 r261703  
    932932        return Inspector::Protocol::CSS::StyleSheetOrigin::UserAgent;
    933933
    934     if (pageStyleSheet && pageStyleSheet->ownerNode() && pageStyleSheet->ownerNode()->nodeName() == "#document")
     934    if (pageStyleSheet && pageStyleSheet->contents().isUserStyleSheet())
    935935        return Inspector::Protocol::CSS::StyleSheetOrigin::User;
    936936
Note: See TracChangeset for help on using the changeset viewer.