Bug 70116

Summary: CSSStyleSheet should only ever contain CSSRules.
Product: WebKit Reporter: Andreas Kling <kling>
Component: CSSAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: koivisto, luiz, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Proposed patch koivisto: review+

Andreas Kling
Reported 2011-10-14 10:55:36 PDT
SSIA.
Attachments
Proposed patch (21.29 KB, patch)
2011-10-14 11:05 PDT, Andreas Kling
koivisto: review+
Andreas Kling
Comment 1 2011-10-14 11:05:29 PDT
Created attachment 111029 [details] Proposed patch
WebKit Review Bot
Comment 2 2011-10-14 11:09:43 PDT
Attachment 111029 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/css/CSSStyleSelector.cpp:2005: An else should appear on the same line as the preceding } [whitespace/newline] [4] Total errors found: 1 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Antti Koivisto
Comment 3 2011-10-14 11:18:00 PDT
Comment on attachment 111029 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=111029&action=review Nice! r=me, with one change. > Source/WebCore/css/CSSStyleSheet.h:113 > + unsigned length() const { return m_children.size(); } > + CSSRule* item(unsigned index) { return index < length() ? m_children.at(index).get() : 0; } Just go ahead and expose the vector instead here const Vector<RefPtr<CSSRule> >& rules() const > Source/WebCore/xml/XSLStyleSheet.h:60 > + unsigned length() const { return m_children.size(); } > + StyleBase* item(unsigned index) { return index < length() ? m_children.at(index).get() : 0; } here too
Antti Koivisto
Comment 4 2011-10-14 11:22:29 PDT
Actually, please land as-is, refactor the array interface separately.
Andreas Kling
Comment 5 2011-10-14 11:37:00 PDT
Antti Koivisto
Comment 6 2011-10-14 11:43:04 PDT
Comment on attachment 111029 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=111029&action=review > Source/WebCore/css/CSSRule.h:-66 > + virtual bool isRule() const { return true; } > + > protected: > CSSRule(CSSStyleSheet* parent) > : StyleBase(parent) > { > } > - > -private: > - virtual bool isRule() const { return true; } Oh, no need make this public... > Source/WebCore/css/CSSStyleSheet.cpp:108 > + CSSRule* c = child.get(); > + ASSERT(c->isRule()); ... as these asserts are not really necessary at all!
Note You need to log in before you can comment on or make changes to this bug.