Bug 49804 - Web Inspector: [REGRESSION] Contents of rules inside @media not displayed/editable
Summary: Web Inspector: [REGRESSION] Contents of rules inside @media not displayed/edi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-19 06:59 PST by Alexander Pavlov (apavlov)
Modified: 2010-11-22 22:15 PST (History)
14 users (show)

See Also:


Attachments
[PATCH] Suggested fix (21.80 KB, patch)
2010-11-22 08:52 PST, Alexander Pavlov (apavlov)
pfeldman: review+
Details | Formatted Diff | Diff
[PATCH] Patch attached to test compilability, review not required (21.94 KB, patch)
2010-11-22 09:56 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2010-11-19 06:59:11 PST
If a rule R resides inside a @media rule, R's properties are not displayed and R is not editable.
Comment 1 Alexander Pavlov (apavlov) 2010-11-22 08:52:16 PST
Created attachment 74557 [details]
[PATCH] Suggested fix
Comment 2 Eric Seidel (no email) 2010-11-22 08:59:29 PST
Attachment 74557 [details] did not build on mac:
Build output: http://queues.webkit.org/results/6269056
Comment 3 Pavel Feldman 2010-11-22 09:00:28 PST
Comment on attachment 74557 [details]
[PATCH] Suggested fix

Please test this thoroughly.

View in context: https://bugs.webkit.org/attachment.cgi?id=74557&action=review

> WebCore/inspector/InspectorStyleSheet.h:161
> +    bool setText(const String&, bool reparsePageStyleSheet);

Consider splitting this into two methods.
Comment 4 Early Warning System Bot 2010-11-22 09:02:53 PST
Attachment 74557 [details] did not build on qt:
Build output: http://queues.webkit.org/results/6256092
Comment 5 Eric Seidel (no email) 2010-11-22 09:10:03 PST
Attachment 74557 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/6108135
Comment 6 Alexander Pavlov (apavlov) 2010-11-22 09:56:04 PST
Created attachment 74567 [details]
[PATCH] Patch attached to test compilability, review not required
Comment 7 Alexander Pavlov (apavlov) 2010-11-22 10:36:31 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ...
        M       LayoutTests/ChangeLog
        A       LayoutTests/inspector/resources/styles-new-API-1.css
        M       LayoutTests/inspector/resources/styles-new-API.css
        M       LayoutTests/inspector/styles-new-API-expected.txt
        M       WebCore/ChangeLog
        M       WebCore/css/CSSImportRule.cpp
        M       WebCore/inspector/InspectorCSSAgent.cpp
        M       WebCore/inspector/InspectorStyleSheet.cpp
        M       WebCore/inspector/InspectorStyleSheet.h
Committed r72540
Comment 8 Alexey Proskuryakov 2010-11-22 11:19:52 PST
This only includes an Inspector regression test, but has changes that look like they would affect Web content behavior. Can you add a test for the CSSImportRule.cpp change?
Comment 9 Pavel Feldman 2010-11-22 11:25:58 PST
Comment on attachment 74567 [details]
[PATCH] Patch attached to test compilability, review not required

Clearing r? from landed patch (it was set for bots).
Comment 10 Alexander Pavlov (apavlov) 2010-11-22 15:53:58 PST
(In reply to comment #8)
> This only includes an Inspector regression test, but has changes that look like they would affect Web content behavior. Can you add a test for the CSSImportRule.cpp change?

Alexey, I'm happy to add a test in a follow-up patch if you can give me a hint on how this test should look like. If you notice, the only CSSImportRule change is an additional NULL check that eliminates a crash whenever the parent CSSStyleSheet (i.e. the one that includes an @import statement) has no parent document - this can be easily seen from the last (non-changed) line of the related snippet in the patch. This can only occur in an artificial setting like parsing text for a hand-crafted CSSStyleSheet created with CSSStyleSheet::create() (with no arguments).

Apparently, WebKit had never encountered such kind of a behavior (otherwise the crash would not have gone unnoticed), and parsing a CSSStyleSheet created for any live node in a real document would invoke addPendingStylesheet() on that document without ever remove..()-ing it. In turn, this would subsequently prevent CSSStyleSelector::styleRulesForElement() from returning ANY matched rules for any element (that's what had been happening until this patch was committed - you can try inspecting element styles at, say, apple.com).

So, I'm not sure which aspect of the involved CSSImportRule change the test should cover. Should it just confirm that the code does not crash for such a stylesheet (already implicitly covered by the updated styles-new-API.html test) or something more solid still holds for the code in question?
Comment 11 Alexey Proskuryakov 2010-11-22 22:15:39 PST
That explains why no test is needed, thanks.