[webkit-reviews] review granted: [Bug 65297] Add iterator to CSSValueList : [Attachment 102230] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 27 23:39:02 PDT 2011


Darin Adler <darin at apple.com> has granted Luke Macpherson
<macpherson at chromium.org>'s request for review:
Bug 65297: Add iterator to CSSValueList
https://bugs.webkit.org/show_bug.cgi?id=65297

Attachment 102230: Patch
https://bugs.webkit.org/attachment.cgi?id=102230&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=102230&action=review


OK as is, some small ideas for improvements.

> Source/WebCore/css/CSSValueList.h:79
> +    CSSValueListIterator(CSSValue* value) : m_position(0) { m_list = (value
&& value->isValueList()) ? static_cast<CSSValueList*>(value) : 0; }

Could use construction syntax instead of assignment for m_list.

If you added one more function to CSSValueListExpander to get the value of the
nth element in the list, then you could use CSSValueListExpander as the type of
the m_list data member, which would save code in the constructor and obviate
the need for a length function in this class.

> Source/WebCore/css/CSSValueList.h:84
> +    size_t length() const { return m_list ? m_list->length() : 0; }

Should be private.

> Source/WebCore/css/CSSValueList.h:92
> +    CSSValueListExpander(CSSValue* value) { m_list = (value &&
value->isValueList()) ? static_cast<CSSValueList*>(value) : 0; }

Could use construction syntax instead of assignment for m_list.

Not sure that “expander” is quite the right name for this. It does two things:
Type check that this is a list, and add convenience functions for accessing
elements of the list. Can’t think of a better name, though. Maybe inspector?


More information about the webkit-reviews mailing list