Closed Bug 1367217 Opened 8 years ago Closed 8 years ago

ClearAllUndisplayedContentIn and ClearAllUndisplayedContentIn duplicate work

Categories

(Core :: Layout, enhancement)

53 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Performance Impact high
Tracking Status
firefox55 --- fixed

People

(Reporter: bzbarsky, Assigned: MatsPalmgren_bugz)

References

Details

Attachments

(1 file)

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)
Whiteboard: [qf] → [qf:p1]
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)
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+
See Also: → 1367214
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/ee20b7f985f5 Merge ClearAllUndisplayedContentIn / ClearAllDisplayContentsIn to avoid doing duplicated work. r=dholbert
> 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)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Performance Impact: --- → P1
Whiteboard: [qf:p1]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: