Closed
Bug 1447098
Opened 8 years ago
Closed 8 years ago
Rename FromContent to FromNode
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla61
| Tracking | Status | |
|---|---|---|
| firefox61 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(3 files, 1 obsolete file)
|
175.45 KB,
patch
|
nika
:
review+
|
Details | Diff | Splinter Review |
|
32.57 KB,
patch
|
nika
:
review+
|
Details | Diff | Splinter Review |
|
3.40 KB,
patch
|
nika
:
review+
|
Details | Diff | Splinter Review |
In bug 1446533 I changed FromContent to take an nsINode*, because that was useful in some places. Turns out that compiles fine. Given that, I'd like to rename it to nsINode.
| Assignee | ||
Comment 1•8 years ago
|
||
MozReview-Commit-ID: 202nkbmkwfR
Attachment #8960770 -
Flags: review?(nika)
| Assignee | ||
Comment 2•8 years ago
|
||
Attachment #8960771 -
Flags: review?(nika)
| Assignee | ||
Comment 3•8 years ago
|
||
Some condition functions are faster on subclasses of nsINode than on nsINode itself.
Attachment #8960772 -
Flags: review?(nika)
Updated•8 years ago
|
Attachment #8960770 -
Flags: review?(nika) → review+
Updated•8 years ago
|
Attachment #8960771 -
Flags: review?(nika) → review+
Comment 4•8 years ago
|
||
Comment on attachment 8960772 [details] [diff] [review]
part 3. Add some FromNode overloads for different arg types
Review of attachment 8960772 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsIContent.h
@@ +1013,3 @@
> #define NS_IMPL_FROMNODE_HELPER(_class, _check) \
> + template<typename ArgType> \
> + static _class* FromNode(ArgType* aNode) \
Hmm, this is a lot more overloads than seems like should be necessary...
This I think would let you avoid the need for a special overload for smart pointers
#define NS_IMPL_FROMNODE_HELPER(_class, _check) \
template<typename ArgType> \
static _class* FromNode(ArgType&& aNode) { \
return aNode->_check ? static_cast<_class*>(static_cast<nsINode*>(aNode)) : nullptr; \
}
Attachment #8960772 -
Flags: review?(nika)
| Assignee | ||
Comment 5•8 years ago
|
||
To preserve current semantics, we need something to handle "nsINode* -> Foo*", "const nsINode* -> const Foo*", "const RefPtr<nsINode> -> Foo*" (no const on the return type here). I don't think the rvalue proposal does that (and in particular it fails to compile as-is when "const nsIContent*" is the ArgType; I did try it before ending up with the thing I have now).
Flags: needinfo?(nika)
| Assignee | ||
Comment 6•8 years ago
|
||
Attachment #8960952 -
Flags: review?(nika)
| Assignee | ||
Updated•8 years ago
|
Attachment #8960772 -
Attachment is obsolete: true
Updated•8 years ago
|
Attachment #8960952 -
Flags: review?(nika) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/eb4e6e094d20
part 1. Rename FromContent on various DOM classes to FromNode. r=mystor
https://hg.mozilla.org/integration/mozilla-inbound/rev/fd041053a1b5
part 2. Rename the NS_IMPL_FROMCONTENT macros to NS_IMPL_FROMNODE. r=mystor
https://hg.mozilla.org/integration/mozilla-inbound/rev/7db110ae9111
part 3. Add some FromNode overloads for different arg types. r=mystor
Comment 8•8 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/eb4e6e094d20
https://hg.mozilla.org/mozilla-central/rev/fd041053a1b5
https://hg.mozilla.org/mozilla-central/rev/7db110ae9111
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Updated•8 years ago
|
Flags: needinfo?(nika)
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•