Bug 144930

Summary: Modernize ContainerNode::childElementCount
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, kangil.han
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Sam Weinig 2015-05-12 14:42:02 PDT
Modernize ContainerNode::childElementCount
Comment 1 Sam Weinig 2015-05-12 14:45:52 PDT
Created attachment 252986 [details]
Patch
Comment 2 WebKit Commit Bot 2015-05-12 14:48:05 PDT
Attachment 252986 [details] did not pass style-queue:


ERROR: Source/WebCore/dom/ElementChildIterator.h:36:  value_type is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/dom/ElementChildIterator.h:37:  difference_type is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/dom/ElementChildIterator.h:40:  iterator_category is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/dom/ElementChildIterator.h:50:  value_type is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/dom/ElementChildIterator.h:51:  difference_type is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/dom/ElementChildIterator.h:54:  iterator_category is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 6 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2015-05-12 21:46:00 PDT
Comment on attachment 252986 [details]
Patch

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

> Source/WebCore/dom/ElementChildIterator.h:40
> +    typedef ElementType value_type;
> +    typedef ptrdiff_t difference_type;
> +    typedef ElementType* pointer;
> +    typedef ElementType& reference;
> +    typedef std::forward_iterator_tag iterator_category;

The modern way to do this is to derive from std::iterator<std::forward_iterator_tag, ElementType>; std::iterator handles the rest by default.

> Source/WebCore/dom/ElementChildIterator.h:54
> +    typedef const ElementType value_type;
> +    typedef ptrdiff_t difference_type;
> +    typedef const ElementType* pointer;
> +    typedef const ElementType& reference;
> +    typedef std::forward_iterator_tag iterator_category;

The modern way to do this is to derive from std::iterator<std::forward_iterator_tag, const ElementType>; std::iterator handles the rest by default.
Comment 4 WebKit Commit Bot 2015-05-13 15:08:13 PDT
Comment on attachment 252986 [details]
Patch

Clearing flags on attachment: 252986

Committed r184309: <http://trac.webkit.org/changeset/184309>
Comment 5 WebKit Commit Bot 2015-05-13 15:08:18 PDT
All reviewed patches have been landed.  Closing bug.