WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 221357
Avoid an ancestor walk in HTMLFormControlElement::computeWillValidate()
https://bugs.webkit.org/show_bug.cgi?id=221357
Summary
Avoid an ancestor walk in HTMLFormControlElement::computeWillValidate()
Simon Fraser (smfr)
Reported
2021-02-03 13:28:19 PST
Avoid an ancestor walk in HTMLFormControlElement::computeWillValidate()
Attachments
Patch
(8.63 KB, patch)
2021-02-03 13:29 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(8.42 KB, patch)
2021-02-03 17:56 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(8.22 KB, patch)
2021-02-03 20:54 PST
,
Simon Fraser (smfr)
rniwa
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2021-02-03 13:29:35 PST
Created
attachment 419180
[details]
Patch
Ryosuke Niwa
Comment 2
2021-02-03 14:01:20 PST
Comment on
attachment 419180
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=419180&action=review
This is fine but another approach is to create a new node flag like we do for SelfOrAncestorHasDirAuto and set this bit whenever an ancestor has datalist.
> Source/WebCore/dom/Document.h:1331 > + void addDisabledFieldsetElement() { ++m_disabledFieldsetElementsCount; }
Can we avoid changing the unrelated code?
> Source/WebCore/dom/Document.h:1334 > + bool hasDataListElements() const { return m_dataListElementCount; }
We should have this in TreeScope instead. Otherwise, we're gonna have a bad time inside a ShadowRoot.
> Source/WebCore/dom/Element.cpp:2220 > + auto* page = document().page(); > + if (page) {
Please define page inside if.
> Source/WebCore/html/HTMLDataListElement.cpp:61 > + if (parentOfInsertedTree.isInTreeScope())
This isn't right. We're checking that the inserted ancestor's new parent is in a tree scope. It doesn't mean it's in the document. Make the change above to move the function to TreeScope and this will be correct but it's better to check insertionType.treeScopeChanged instead even in that case.
> Source/WebCore/html/HTMLDataListElement.cpp:70 > + if (oldParentOfRemovedTree.isInTreeScope()) > + document().decrementDataListElementCount();
Ditto.
> Source/WebCore/html/HTMLDataListElement.cpp:76 > +void HTMLDataListElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument) > +{
This function override won't be needed once we made all the changes I suggest above.
Simon Fraser (smfr)
Comment 3
2021-02-03 17:56:19 PST
Created
attachment 419212
[details]
Patch
Ryosuke Niwa
Comment 4
2021-02-03 18:37:21 PST
Comment on
attachment 419212
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=419212&action=review
> Source/WebCore/ChangeLog:13 > + * dom/Document.h: > + (WebCore::Document::addDisabledFieldsetElement):
Update these change log entries?
> Source/WebCore/html/HTMLDataListElement.cpp:64 > + if (insertionType.treeScopeChanged) > + treeScope().incrementDataListElementCount();
We can do this before calling HTMLElement::insertedIntoAncestor.
> Source/WebCore/page/PointerLockController.cpp:106 > -void PointerLockController::elementRemoved(Element& element) > +void PointerLockController::elementWasRemoved(Element& element)
Or maybe didRemoveElement?
Simon Fraser (smfr)
Comment 5
2021-02-03 20:54:30 PST
Created
attachment 419225
[details]
Patch
Simon Fraser (smfr)
Comment 6
2021-02-03 21:21:32 PST
https://trac.webkit.org/changeset/272358/webkit
Radar WebKit Bug Importer
Comment 7
2021-02-03 21:22:13 PST
<
rdar://problem/73964453
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug