Closed
Bug 1367217
Opened 4 years ago
Closed 4 years ago
ClearAllUndisplayedContentIn and ClearAllUndisplayedContentIn duplicate work
Categories
(Core :: Layout, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla55
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: mats)
References
Details
(Whiteboard: [qf:p1])
Attachments
(1 file)
|
7.22 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
These two functions are always called together, like so:
ClearAllDisplayContentsIn(node->mContent);
ClearAllUndisplayedContentIn(node->mContent);
or
ClearAllUndisplayedContentIn(content);
ClearAllDisplayContentsIn(content);
or
ClearAllDisplayContentsIn(aContent);
ClearAllUndisplayedContentIn(aContent);
Then ClearAllUndisplayedContentIn does:
FlattenedChildIterator iter(aParentContent);
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
if (child->GetParent() != aParentContent) {
ClearUndisplayedContentIn(child, child->GetParent());
}
}
while ClearAllDisplayContentsIn does:
FlattenedChildIterator iter(aParentContent);
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
if (child->GetParent() != aParentContent) {
ClearDisplayContentsIn(child, child->GetParent());
ClearUndisplayedContentIn(child, child->GetParent());
}
}
That second walk over the kids repeats all the work from the first walk and adds a bit more. Could we just do a single walk over the kids that does the work from ClearAllDisplayContentsIn?Flags: needinfo?(mats)
Updated•4 years ago
|
Whiteboard: [qf] → [qf:p1]
| Assignee | ||
Comment 1•4 years ago
|
||
Yeah, I think we should just merge these two methods. Re: the loop at the end - we could skip that altogether if aParentContent had a HaveXBLOrShadowDOMChildren flag or a cheap way to test that, does it?
Assignee: nobody → mats
Flags: needinfo?(mats) → needinfo?(bzbarsky)
| Assignee | ||
Comment 2•4 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=c6a4918748716a13a02fd6a2d1246f07556aa973
| Assignee | ||
Comment 3•4 years ago
|
||
Attachment #8875377 -
Flags: review?(dholbert)
Comment 4•4 years ago
|
||
Comment on attachment 8875377 [details] [diff] [review] Merge ClearAllUndisplayedContentIn / ClearAllDisplayContentsIn to avoid doing duplicated work Review of attachment 8875377 [details] [diff] [review]: ----------------------------------------------------------------- r=me (looks like this preserves existing behavior, aside from the duplicate-work elimination) Thanks!
Attachment #8875377 -
Flags: review?(dholbert) → review+
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/ee20b7f985f5 Merge ClearAllUndisplayedContentIn / ClearAllDisplayContentsIn to avoid doing duplicated work. r=dholbert
| Reporter | ||
Comment 6•4 years ago
|
||
> we could skip that altogether if aParentContent had a HaveXBLOrShadowDOMChildren
> flag or a cheap way to test that, does it?
I don't know of one offhand.Flags: needinfo?(bzbarsky)
Comment 7•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ee20b7f985f5
Status: NEW → RESOLVED
Closed: 4 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•