Move more text editor handling to the DOM, and remove more dead layout
code.
We need to move NeedToInitializeEditorForEvent down to
TextControlElement since the eager initialization of textarea was
papering over stuff.
The change needed in test_bug300691-1.html is a progression, I think.
Plain focus() generally puts the caret at the start rather than the end.
Differential Revision: https://phabricator.services.mozilla.com/D285755
Move more text editor handling to the DOM, and remove more dead layout
code.
We need to move NeedToInitializeEditorForEvent down to
TextControlElement since the eager initialization of textarea was
papering over stuff.
The change needed in test_bug300691-1.html is a progression, I think.
Plain focus() generally puts the caret at the start rather than the end.
Differential Revision: https://phabricator.services.mozilla.com/D285755
Speedometer3's TodoMVC-jQuery hits basically the worst case of my
change, which is creating a hidden text input per row. That causes tons
of extra time spent in BindToTree and so on because we now create the
shadow tree for all of those. It is specially bad because the shadow
tree is particularly expensive (see bug 2017005).
For now, keep creating the <input> shadow tree lazily from layout, but
with a key difference: Once created, we keep it around.
This should still allow us to fix the reframing issues linked from
bug 2016280 and hopefully won't be too painful. It is a bit annoying
that TextControlElement can't rely on the shadow tree existing, but that
seems ok...
Of course preferred outcome is to make shadow trees less costly. Most of
the cost is still allocation of the slots, afaict from the profiles.
Differential Revision: https://phabricator.services.mozilla.com/D284039
There's still a ton of things that can be cleaned up after this, but
this setup is nicer.
For now, editor keeps getting set-up / torn down on BindToFrame. Seems
all that could be untangled, but step by step.
The preview stuff and placeholder can just be created on demand now,
rather than requiring frame reconstruction.
Also, nsSearchControlFrame and co no longer do anything of interest, so
move the still relevant bits elsewhere and remove them.
test_bug1248459.html is removed because it messes with the editor
selection using SpecialPowers, in a way such that it crosses shadow
boundaries, and messes up the selected state triggering debug asserts.
test_focus_docnav.xhtml now triggers a different code-path because of
the shadow root (rather than the frame tree traversal). Keep it working
for now by replacing it with something that isn't a shadow root.
Differential Revision: https://phabricator.services.mozilla.com/D282953
Skipping the picker part for now, as we don't support wide color gamut yet. Color mapping doesn't work either because of how the picker element is implemented - it's using white-and-black-to-transparent linear-gradient on top of the solid color.
Differential Revision: https://phabricator.services.mozilla.com/D277905
Skipping the picker part for now, as we don't support wide color gamut yet. Color mapping doesn't work either because of how the picker element is implemented - it's using white-and-black-to-transparent linear-gradient on top of the solid color.
Differential Revision: https://phabricator.services.mozilla.com/D277905
This makes significant changes to RelatedAccIterator, nsLabelsNodeList and nsContentList:
- RelatedAccIterator is now able to walk up shadow roots where appropriate.
- HTMLLabelsIterator now eagerly constructs a TreeOrderedArray of related elements, walking up shadow roots while the shadow root's reference target is either mAcc's content or a host of one of its ancestor shadow roots.
- nsLabelsNodeList now has an array of roots as well as mRootNode in the superclass nsContentList. This list is reset under certain conditions, adding each shadow root found by walking up from the labeled element until one is found which doesn't have either the labeled element or the host of one of its ancestor shadow roots as a reference target. The last element in this list is set as mRootNode in the superclass, and is either the containing document, or the subtree root of either the labeled element or the host element whose containing shadow root doesn't have it as a reference target. Each root has a mutation observer added to ensure that the list is marked dirty when necessary, and also that roots are removed from `mRoots` when they are destroyed.
- In order to enable nsLabelsNodeList to be a mutation observer for each root, nsContentList now inherits from nsStubMultiMutationObserver instead of nsStubMutationObserver.
This change also moves the ReferenceTargetChangeObserver-related methods from DocumentOrShadowRoot on to Element, and the related data structures on to nsExtendedDOMSlots.
It also introduces a distinction between GetControlForBindings, which returns an element in the same scope as the label element it's called on, and GetLabeledElementInternal, which returns the element which actually has the label element as its label.
Differential Revision: https://phabricator.services.mozilla.com/D261368
This change adds attr-associated element observers, which observe changes in the element associated with a single-element attribute.
For example, if an element has an attribute |attr| with a value |value|, and an AttrTargetObserver has been added for |attr| on that element, the observer would fire if an element with an ID matching |value| was added to the element's document or shadow root.
Attr-associated element observers are tracked in mAttrElementObserverMap in an element's nsExtendedDOMSlots.
An attr-associated element can change in multiple ways:
- The attribute value changes;
- An element matching the content attribute value is added or removed from the element's document or shadow root;
- The explicitly-set attr element is added or removed from the element's document or shadow root;
- The resolved reference target for the explicitly set attr-element or the element whose ID matches the string value of the attribute changes.
The resolved reference target can likewise change in multiple ways:
- The referenceTarget property of the element's shadow root is added, changed or removed;
- An element whose ID matches the element's shadow root's referenceTarget value is added or removed from the shadow root;
- The resolved reference target of the element whose ID matches the shadow root's referenceTarget value changes.
These changes are tracked via reference target change observers, which observe changes to an element's resolved reference target.
Reference target change observers are added on the host element's document or shadow root, and fired when one of the above circumstances occurs.
Differential Revision: https://phabricator.services.mozilla.com/D261367
This reverts commit d46abe6d76.
Revert "Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug"
This reverts commit df11a4666d.
Revert "Bug 1981345 - Implement referenceTarget support for multiple element attributes. r=dom-core,Jamie,smaug"
This reverts commit 89cc779f5e.
Revert "Bug 1984685 - Refactor: consistently return Maybe<nsTArray<RefPtr<Element>>> when getting attr-associated elements, and key AttrRelProviders on nsAtom rather than nsString. r=dom-core,morgan,Jamie,smaug"
This reverts commit 33130e712d.
Revert "Bug 1981344 - Implement referenceTarget support for single-element attributes. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,emilio,keithamus,smaug,mtigley"
This reverts commit d6440c4cae.
Revert "Bug 1983766 - Split single element attribute getters into bindings/internals versions. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,smaug,keithamus,jwatt,mtigley"
This reverts commit 83b70e0645.
Revert "Bug 1989323 - Make `referenceTarget` IDL attributes on ShadowRoot, HTMLTemplateElement and ShadowRootInit nullable. r=dom-core,webidl,saschanaz,smaug"
This reverts commit 3a0b29121e.
This makes significant changes to RelatedAccIterator, nsLabelsNodeList and nsContentList:
- RelatedAccIterator now eagerly constructs a TreeOrderedArray of related elements, walking up shadow roots from mDependentContent while the shadow root's reference target is either mDependentContent or a host of one of its ancestor shadow roots.
- nsLabelsNodeList now has an array of roots as well as mRootNode in the superclass nsContentList. This list is reset under certain conditions, adding each shadow root found by walking up from the labeled element until one is found which doesn't have either the labeled element or the host of one of its ancestor shadow roots as a reference target. The last element in this list is set as mRootNode in the superclass, and is either the containing document, or the subtree root of either the labeled element or the host element whose containing shadow root doesn't have it as a reference target. Each root has a mutation observer added to ensure that the list is marked dirty when necessary, and also that roots are removed from `mRoots` when they are destroyed.
- In order to enable nsLabelsNodeList to be a mutation observer for each root, nsContentList now inherits from nsStubMultiMutationObserver instead of nsStubMutationObserver.
This change also moves the ReferenceTargetChangeObserver-related methods from DocumentOrShadowRoot on to Element, and the related data structures on to nsExtendedDOMSlots.
It also introduces a distinction between GetControlForBindings, which returns an element in the same scope as the label element it's called on, and GetLabeledElementInternal, which returns the element which actually has the label element as its label.
Differential Revision: https://phabricator.services.mozilla.com/D261368
This change adds attr-associated element observers, which observe changes in the element associated with a single-element attribute.
For example, if an element has an attribute |attr| with a value |value|, and an AttrTargetObserver has been added for |attr| on that element, the observer would fire if an element with an ID matching |value| was added to the element's document or shadow root.
Attr-associated element observers are tracked in mAttrElementObserverMap in an element's nsExtendedDOMSlots.
An attr-associated element can change in multiple ways:
- The attribute value changes;
- An element matching the content attribute value is added or removed from the element's document or shadow root;
- The explicitly-set attr element is added or removed from the element's document or shadow root;
- The resolved reference target for the explicitly set attr-element or the element whose ID matches the string value of the attribute changes.
The resolved reference target can likewise change in multiple ways:
- The referenceTarget property of the element's shadow root is added, changed or removed;
- An element whose ID matches the element's shadow root's referenceTarget value is added or removed from the shadow root;
- The resolved reference target of the element whose ID matches the shadow root's referenceTarget value changes.
These changes are tracked via reference target change observers, which observe changes to an element's resolved reference target.
Reference target change observers are added on the host element's document or shadow root, and fired when one of the above circumstances occurs.
Differential Revision: https://phabricator.services.mozilla.com/D261367
This reverts commit 1b5cf4cdf8.
Revert "Bug 1981346 - Add referenceTarget support for the form attribute. r=credential-management-reviewers,webidl,dimi,Jamie,smaug"
This reverts commit 2394d9205a.
Revert "Bug 1981345 - Implement referenceTarget support for multiple element attributes. r=dom-core,Jamie,smaug"
This reverts commit 571a17ff82.
Revert "Bug 1984685 - Refactor: consistently return Maybe<nsTArray<RefPtr<Element>>> when getting attr-associated elements, and key AttrRelProviders on nsAtom rather than nsString. r=dom-core,morgan,Jamie,smaug"
This reverts commit 3b389fdd62.
Revert "Bug 1981344 - Implement referenceTarget support for single-element attributes. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,emilio,keithamus,smaug,mtigley"
This reverts commit 5cc2a12756.
Revert "Bug 1983766 - Split single element attribute getters into bindings/internals versions. r=dom-core,credential-management-reviewers,webidl,layout-reviewers,smaug,keithamus,jwatt,mtigley"
This reverts commit 68e2d26aa9.
Revert "Bug 1989323 - Make `referenceTarget` IDL attributes on ShadowRoot, HTMLTemplateElement and ShadowRootInit nullable. r=dom-core,webidl,saschanaz,smaug"
This reverts commit 1234b31599.
This makes significant changes to RelatedAccIterator, nsLabelsNodeList and nsContentList:
- RelatedAccIterator now eagerly constructs a TreeOrderedArray of related elements, walking up shadow roots from mDependentContent while the shadow root's reference target is either mDependentContent or a host of one of its ancestor shadow roots.
- nsLabelsNodeList now has an array of roots as well as mRootNode in the superclass nsContentList. This list is reset under certain conditions, adding each shadow root found by walking up from the labeled element until one is found which doesn't have either the labeled element or the host of one of its ancestor shadow roots as a reference target. The last element in this list is set as mRootNode in the superclass, and is either the containing document, or the subtree root of either the labeled element or the host element whose containing shadow root doesn't have it as a reference target. Each root has a mutation observer added to ensure that the list is marked dirty when necessary, and also that roots are removed from `mRoots` when they are destroyed.
- In order to enable nsLabelsNodeList to be a mutation observer for each root, nsContentList now inherits from nsStubMultiMutationObserver instead of nsStubMutationObserver.
This change also moves the ReferenceTargetChangeObserver-related methods from DocumentOrShadowRoot on to Element, and the related data structures on to nsExtendedDOMSlots.
It also introduces a distinction between GetControlForBindings, which returns an element in the same scope as the label element it's called on, and GetLabeledElementInternal, which returns the element which actually has the label element as its label.
Differential Revision: https://phabricator.services.mozilla.com/D261368
This change adds attr-associated element observers, which observe changes in the element associated with a single-element attribute.
For example, if an element has an attribute |attr| with a value |value|, and an AttrTargetObserver has been added for |attr| on that element, the observer would fire if an element with an ID matching |value| was added to the element's document or shadow root.
Attr-associated element observers are tracked in mAttrElementObserverMap in an element's nsExtendedDOMSlots.
An attr-associated element can change in multiple ways:
- The attribute value changes;
- An element matching the content attribute value is added or removed from the element's document or shadow root;
- The explicitly-set attr element is added or removed from the element's document or shadow root;
- The resolved reference target for the explicitly set attr-element or the element whose ID matches the string value of the attribute changes.
The resolved reference target can likewise change in multiple ways:
- The referenceTarget property of the element's shadow root is added, changed or removed;
- An element whose ID matches the element's shadow root's referenceTarget value is added or removed from the shadow root;
- The resolved reference target of the element whose ID matches the shadow root's referenceTarget value changes.
These changes are tracked via reference target change observers, which observe changes to an element's resolved reference target.
Reference target change observers are added on the host element's document or shadow root, and fired when one of the above circumstances occurs.
Differential Revision: https://phabricator.services.mozilla.com/D261367
This reverts commit 6c5157b828.
Revert "Bug 2000644 - Introduce a superclass of color picker to prepare for multiple subclasses r=devtools-reviewers,nchevobbe,desktop-theme-reviewers,frontend-codestyle-reviewers,hjones"
This reverts commit 0604161977.
Revert "Bug 2004409 - Split window opener logic from DateTimePicker classes r=emilio"
This reverts commit dbe80fc5ce.
This reverts commit a0d863ae05.
Revert "Bug 2000644 - Introduce a superclass of color picker to prepare for multiple subclasses r=devtools-reviewers,nchevobbe,desktop-theme-reviewers,frontend-codestyle-reviewers,hjones"
This reverts commit 11f938e477.
Revert "Bug 2004409 - Split window opener logic from DateTimePicker classes r=emilio"
This reverts commit 16894a9e46.
Updating the picker while the user is still deciding their choice is surprising to the user.
Given neither Chrome nor Safari is doing this, it should be safe to unship this behavior.
Differential Revision: https://phabricator.services.mozilla.com/D275977