Bug 81319

Summary: Web Inspector: Implement the removal of CSS rules
Product: WebKit Reporter: Nikita Vasilyev <me>
Component: Web Inspector (Deprecated)Assignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED INVALID    
Severity: Enhancement CC: apavlov, bburg, bweinstein, joepeck, keishi, loislo, macpherson, menard, pfeldman, pmuellr, rik, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 84017    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch pfeldman: review-

Description Nikita Vasilyev 2012-03-16 01:42:29 PDT
Screencast: http://www.screenr.com/NkN8

Removing a rule added in Styles pane causes an error: "Error during DOMAgent operation: Server error(-32000): DOM Error while querying.". I can reproduce it on every page in WebKit Nightly and Chrome (stable, dev, and canary).
Comment 1 Pavel Feldman 2012-03-16 04:19:24 PDT
Could you please provide step-by-step repro?
Comment 2 Pavel Feldman 2012-03-16 04:22:49 PDT
(In reply to comment #1)
> Could you please provide step-by-step repro?

Oh, missed the attachment, never mind.
Comment 3 Alexander Pavlov (apavlov) 2012-04-16 07:59:08 PDT
Created attachment 137348 [details]
Patch
Comment 4 Early Warning System Bot 2012-04-16 08:15:18 PDT
Comment on attachment 137348 [details]
Patch

Attachment 137348 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12410676
Comment 5 Early Warning System Bot 2012-04-16 08:18:07 PDT
Comment on attachment 137348 [details]
Patch

Attachment 137348 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12418084
Comment 6 Build Bot 2012-04-16 08:20:28 PDT
Comment on attachment 137348 [details]
Patch

Attachment 137348 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12416122
Comment 7 Alexander Pavlov (apavlov) 2012-04-16 08:46:49 PDT
Created attachment 137351 [details]
Patch
Comment 8 Build Bot 2012-04-16 09:05:58 PDT
Comment on attachment 137351 [details]
Patch

Attachment 137351 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12412409
Comment 9 Alexander Pavlov (apavlov) 2012-04-16 09:19:54 PDT
Created attachment 137352 [details]
Patch
Comment 10 Pavel Feldman 2012-04-18 05:19:37 PDT
Comment on attachment 137352 [details]
Patch

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

> Source/WebCore/css/CSSGrammar.y:447
> +    before_ruleset ruleset {

This could be a separate patch with a test.

> Source/WebCore/inspector/InspectorCSSAgent.cpp:471
> +        return m_styleSheet->insertRuleBefore(m_originalRuleString, m_anchorId, m_originalRuleTextRange.start, ec);

This implies that you drop the information about the enabled state.

> Source/WebCore/inspector/InspectorStyleSheet.cpp:63
> +struct RuleNode : public RefCounted<RuleNode> {

As we agreed offline, I'd suggest that you expose the stylesheet structure via the protocol. Otherwise, you logic for insertion of a rule into a given place of the stylesheet is only accessible as an undo operation for the delete rule.