Add lambda versions of nsIDocument::EnumerateSubDocuments

NEW
Assigned to

Status

()

Core
DOM: Core & HTML
2 years ago
2 years ago

People

(Reporter: seth, Assigned: seth)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

2 years ago
It'd be extremely natural for nsIDocument::EnumerateSubDocuments() to take a lambda function, so let's add a version that does so. (Given that EnumerateSubDocuments() is virtual and the lambda version should be a template, we actually need to add a different method that calls the original.)

While we're at it, it's a common need to apply the same function to both a document and all of its subdocuments. This is especially convenient when using lambdas. Let's add another variant of EnumerateSubDocuments() for that purpose, too.
(Assignee)

Comment 1

2 years ago
Created attachment 8752037 [details] [diff] [review]
Add lambda versions of nsIDocument::EnumerateSubDocuments().

Here's the patch. The new methods use a local captureless lambda to create a
normal function pointer which can be passed to EnumerateSubDocuments(), so the
original implementation is used under the hood.
Attachment #8752037 - Flags: review?(mrbkap)
(Assignee)

Comment 2

2 years ago
Created attachment 8752039 [details] [diff] [review]
Add lambda versions of nsIDocument::EnumerateSubDocuments().

Argh, noticed a comment typo immediately after uploading.
Attachment #8752039 - Flags: review?(mrbkap)
(Assignee)

Updated

2 years ago
Attachment #8752037 - Attachment is obsolete: true
Attachment #8752037 - Flags: review?(mrbkap)
Comment on attachment 8752039 [details] [diff] [review]
Add lambda versions of nsIDocument::EnumerateSubDocuments().

Review of attachment 8752039 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsIDocument.h
@@ +1553,5 @@
>     */
>    typedef bool (*nsSubDocEnumFunc)(nsIDocument *aDocument, void *aData);
>    virtual void EnumerateSubDocuments(nsSubDocEnumFunc aCallback,
>                                       void *aData) = 0;
> +  /**

Nit: add a blank line before the beginning of this comment.
Attachment #8752039 - Flags: review?(mrbkap) → review+
You need to log in before you can comment on or make changes to this bug.