Changeset 291824 in webkit


Ignore:
Timestamp:
Mar 24, 2022 4:29:30 PM (4 months ago)
Author:
Patrick Angle
Message:

Web Inspector: Blank inspector in a page with container queries
https://bugs.webkit.org/show_bug.cgi?id=238338

Reviewed by Devin Rousso.

Because there is no CSSOM implementation for container queries, we are unable to inspect them currently.
However, we should be resilient to the absence of that implementation and expect that not all rules have a
matching CSSOM implementation, instead of just crashing when it happens. This patch only resolves crashes as the
result of the presence of container queries, and followup work will be done to actually plumb the correct
information to Web Inspector to show these rules.

  • inspector/InspectorStyleSheet.cpp:

(WebCore::InspectorStyleSheet::collectFlatRules):

  • inspector/agents/InspectorCSSAgent.cpp:

(WebCore::InspectorCSSAgent::collectStyleSheets):

  • style/InspectorCSSOMWrappers.cpp:

(WebCore::Style::InspectorCSSOMWrappers::collect):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r291817 r291824  
     12022-03-24  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: Blank inspector in a page with container queries
     4        https://bugs.webkit.org/show_bug.cgi?id=238338
     5
     6        Reviewed by Devin Rousso.
     7
     8        Because there is no CSSOM implementation for container queries, we are unable to inspect them currently.
     9        However, we should be resilient to the absence of that implementation and expect that not all rules have a
     10        matching CSSOM implementation, instead of just crashing when it happens. This patch only resolves crashes as the
     11        result of the presence of container queries, and followup work will be done to actually plumb the correct
     12        information to Web Inspector to show these rules.
     13
     14        * inspector/InspectorStyleSheet.cpp:
     15        (WebCore::InspectorStyleSheet::collectFlatRules):
     16        * inspector/agents/InspectorCSSAgent.cpp:
     17        (WebCore::InspectorCSSAgent::collectStyleSheets):
     18        * style/InspectorCSSOMWrappers.cpp:
     19        (WebCore::Style::InspectorCSSOMWrappers::collect):
     20
    1212022-03-24  Antoine Quint  <graouts@webkit.org>
    222
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r287046 r291824  
    15271527    for (unsigned i = 0, size = ruleList->length(); i < size; ++i) {
    15281528        CSSRule* rule = ruleList->item(i);
     1529        if (!rule)
     1530            continue;
     1531       
    15291532        CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(*rule);
    15301533        if (styleRule)
  • trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp

    r288623 r291824  
    649649
    650650    for (unsigned i = 0, size = styleSheet->length(); i < size; ++i) {
    651         CSSRule* rule = styleSheet->item(i);
    652         if (is<CSSImportRule>(*rule)) {
    653             if (CSSStyleSheet* importedStyleSheet = downcast<CSSImportRule>(*rule).styleSheet())
     651        if (auto* rule = dynamicDowncast<CSSImportRule>(styleSheet->item(i))) {
     652            if (CSSStyleSheet* importedStyleSheet = rule->styleSheet())
    654653                collectStyleSheets(importedStyleSheet, result);
    655654        }
  • trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp

    r286916 r291824  
    6060    for (unsigned i = 0; i < size; ++i) {
    6161        CSSRule* cssRule = listType->item(i);
     62        if (!cssRule)
     63            continue;
     64       
    6265        switch (cssRule->styleRuleType()) {
    6366        case StyleRuleType::Import:
Note: See TracChangeset for help on using the changeset viewer.