New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document.applets.length is O(n) #12689
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about as much code as my EmptyHTMLCollection proposal. Also, the document.applets collection will still have an unnecessary CollectionIndexCache. It will also still register with the document for invalidation and get calls for invalidation when the DOM tree changes AFAICT.
Could you clarify why this is better?
That's true. Maybe we should go with EmptyHTMLCollection then. |
EWS run on previous version of this PR (hash d06699c) |
I don't mind writing up the EmptyHTMLCollection patch tomorrow. I assume it will be trivial but we can re-evaluate when we see the alternative patch. |
EWS run on previous version of this PR (hash 7d0a912) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit.
@@ -6294,7 +6295,7 @@ Ref<HTMLCollection> Document::images() | |||
|
|||
Ref<HTMLCollection> Document::applets() | |||
{ | |||
return ensureCachedCollection<DocEmpty>(); | |||
return ensureRareData().ensureNodeLists().addCachedCollection<EmptyHTMLCollection>(*this, DocEmpty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to move DocEmpty
to the ASSERT_NOT_REACHED() section (with DocAll
) inside
GenericCachedHTMLCollection<traversalType>::elementMatches(Element&
instead of making it look like GenericCachedHTMLCollection is dealing with this type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right, I forgot to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit.
And thanks for writing up the patch! |
EWS run on current version of this PR (hash bd86b3b) |
https://bugs.webkit.org/show_bug.cgi?id=255389 Reviewed by Chris Dumez. Introduce and deploy EmptyHTMLCollection, which is always empty, for document.applets. * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::applets): * Source/WebCore/html/EmptyHTMLCollection.h: Added. * Source/WebCore/html/GenericCachedHTMLCollection.cpp: (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const): Canonical link: https://commits.webkit.org/262911@main
bd86b3b
to
db245cc
Compare
Committed 262911@main (db245cc): https://commits.webkit.org/262911@main Reviewed commits have been landed. Closing PR #12689 and removing active labels. |
db245cc
bd86b3b