Bug 46487

Summary: Implement CSSStyleRule::setSelectorText()
Product: WebKit Reporter: Alexander Pavlov (apavlov) <apavlov>
Component: CSSAssignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED FIXED    
Severity: Enhancement CC: hyatt, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
[PATCH] Suggested solution
sam: review-
[PATCH] Comments addressed sam: review+

Alexander Pavlov (apavlov)
Reported 2010-09-24 10:59:14 PDT
CSSStyleRule::setSelectorText() is needed for the new upcoming Web Inspector CSS editing approach.
Attachments
[PATCH] Suggested solution (11.35 KB, patch)
2010-09-24 11:43 PDT, Alexander Pavlov (apavlov)
sam: review-
[PATCH] Comments addressed (13.89 KB, patch)
2010-09-27 02:36 PDT, Alexander Pavlov (apavlov)
sam: review+
Alexander Pavlov (apavlov)
Comment 1 2010-09-24 11:43:01 PDT
Created attachment 68722 [details] [PATCH] Suggested solution The only thing is, I'm not sure about the correct way of notifying the document about the selector change, doc->styleSelectorChanged(DeferRecalcStyle); Should it perhaps use RecalcStyleImmediately instead?
Sam Weinig
Comment 2 2010-09-24 12:00:10 PDT
Comment on attachment 68722 [details] [PATCH] Suggested solution View in context: https://bugs.webkit.org/attachment.cgi?id=68722&action=review Can you add some tests of invalid selectors? > WebCore/css/CSSStyleRule.cpp:57 > +void CSSStyleRule::setSelectorText(const String& selectorText, ExceptionCode& /*ec*/) We should remove the ExcpectionCode parameter (and the raises in the IDL file) since the latest spec (http://dev.w3.org/csswg/cssom/#dom-cssstylerule-selectortext) doesn't have it ever raising. > WebCore/css/CSSStyleRule.cpp:60 > + CSSParser p; > + CSSSelectorList selectorList; There is no reason to declare these at the top of the function.
Alexander Pavlov (apavlov)
Comment 3 2010-09-27 02:36:36 PDT
Created attachment 68890 [details] [PATCH] Comments addressed
Alexander Pavlov (apavlov)
Comment 4 2010-09-27 03:10:08 PDT
(In reply to comment #2) > (From update of attachment 68722 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=68722&action=review > > Can you add some tests of invalid selectors? Done. > > WebCore/css/CSSStyleRule.cpp:57 > > +void CSSStyleRule::setSelectorText(const String& selectorText, ExceptionCode& /*ec*/) > > We should remove the ExcpectionCode parameter (and the raises in the IDL file) since the latest spec (http://dev.w3.org/csswg/cssom/#dom-cssstylerule-selectortext) doesn't have it ever raising. Good point. Fixed "raises" in CSSStyleRule.idl and CSSPageRule.idl > > WebCore/css/CSSStyleRule.cpp:60 > > + CSSParser p; > > + CSSSelectorList selectorList; > > There is no reason to declare these at the top of the function. Right, was moving the code around and forgot to follow on these.
Alexander Pavlov (apavlov)
Comment 5 2010-09-27 06:41:18 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ... M LayoutTests/ChangeLog A LayoutTests/fast/css/css-set-selector-text-expected.txt A LayoutTests/fast/css/css-set-selector-text.html M WebCore/ChangeLog M WebCore/css/CSSPageRule.idl M WebCore/css/CSSStyleRule.cpp M WebCore/css/CSSStyleRule.h M WebCore/css/CSSStyleRule.idl Committed r68388
Note You need to log in before you can comment on or make changes to this bug.