This reverts commit 88008cd8ca.
Revert "Bug 2012637 - part 8: Make `nsContentUtils::ComparePoints` handle `TreeKind::Flat` and `TreeKind::FlatForSelection` correctly r=smaug,dom-core"
This reverts commit 73e6f6587b.
Revert "Bug 2012637 - part 7: Make `RangeUtils::CompareNodeToRangeBoundaries()` use `nsContentUtils::ComparePoints` with valid point in the tree r=smaug"
This reverts commit 6985d5e80f.
Revert "Bug 2012637 - part 6: Make `nsRange::CutContents()` convert the range boundaries to the ones in the DOM before comparing r=smaug"
This reverts commit 73b585af3d.
Revert "Bug 2012637 - part 5: Delete the default template parameter of `nsContentUtils::ComparePoints` and relatives r=smaug,dom-core"
This reverts commit 1a7f24e5b5.
Revert "Bug 2012637 - part 4: Make `nsContentUtils` use `nsIContent` for taking a child node as a parameter r=smaug"
This reverts commit a6ea8d6824.
Revert "Bug 2012637 - part 3: Add template `nsINode` API which can switch to call API from `TreeKind` r=smaug,dom-core,webidl"
This reverts commit a4211e9df0.
Revert "Bug 2012637 - part 2: Add `TreeKind::FlatForSelection` and change the template parameter of `ChildIteratorBase` to `TreeKind` r=smaug,dom-core"
This reverts commit 0241749ee7.
Revert "Bug 2012637 - part 1: Make `ChildIterBase` template class to re-implement `FlattenedChildIterator` for DOM, Flat and FlatForSelection TreeKind r=smaug,dom-core,layout-reviewers,emilio"
This reverts commit 9e71cb77fb.
They accept any kind of points even if it does not match with the
template parameter's `TreeKind` because the caller wants to check the
relation in different kind of tree. Therefore, any callers need to
consider the `TreeKind` more carefully and clarify the `TreeKind` makes
developers easier to find a bug.
Differential Revision: https://phabricator.services.mozilla.com/D281308
`FlattenedChildIterator` is a non-template class and work only for the
flattened tree (i.e., in the `TreeKind::Flat` mode).
To centralize the implementation to access children from a parent node
in the various kinds of tree except `ShadowIncludingDOM`, this patch
makes it a template class and support the simple DOM (for
`TreeKind::DOM`), the flattened tree (for`TreeKind::Flat`) and also the
flattened tree for selection whose `TreeKind` will be added by the next
patch.
The reason why this patch does not support
`TreeKind::ShadowIncludingDOM` is, it is not clear that which children
should be handled when the parent is a shadow host, i.e., whether the
children of the host or the `ShadowRoot`. Therefore, the caller should
use `ShadowRoot` if the users want to list up the the children from a
host. Then, the code is really clear about what it does.
Differential Revision: https://phabricator.services.mozilla.com/D281303
The previous behavior caused all sorts of edge-casey issues:
Find-in-page would open all <details> or hidden=until-found elements
which contain the search string. Therefore, accordions would open
one after another, and the last one would be opened instead of the one
with the match.
Finding a text fragment on a page would open all details/hidden=until-found elements
which contain any of a context term of the text directive.
Creating a text fragment link (context menu -> Copy Link to Highlight) would open
all hidden=until-found/details elements which contain the target range.
The reason for this behavior was `nsFind::Find()` calling the reveal algorithm unconditionally.
This patch fixes this by only calling the reveal algorithm at the appropriate places,
which is inside the find-in-page backend (`nsTypeAheadFind.cpp`),
in the `window.find()` backend (`nsWebBrowserFind.cpp`),
and in the text fragment finder backend (`TextDirectiveFinder.cpp`).
In addition, this patch refactors the tests for finding hidden=until-found / <details> elements:
- test_nsFind.html only tests that text inside hidden=until-found or <details> can be found
- New tests in `browser_findbar_hidden_beforematch.js` and `test_find.html` ensure that
the elements are visible after they are found, and that `beforematch` is fired for hidden=until-found elements
- New tests have been added for finding and creating text fragments to ensure that only the correct elements are revealed.
Differential Revision: https://phabricator.services.mozilla.com/D269160
This patch updates all occurrences of the type `nsTextFragment` into its new name, `mozilla::dom::CharacterDataBuffer`.
It also updates the includes, including sorting.
Differential Revision: https://phabricator.services.mozilla.com/D259867
This patch refactors the find functionality in a few ways:
- A C++-only method `FindFromRangeBoundaries()` is introduced,
which uses `RangeBoundary`s instead of collapsed `nsRange`s
to describe the search range.
- Use `nsContentUtils::ComparePoints()` to check whether the
end of the search range has been reached. This is more robust
than the previous check and finds the end point also when it's
in a node which is being skipped (eg. a non-text-node).
- Clarify the interface: The search start and end points are now
always in document read order, and independent of
the search direction.
Therefore, the start point must always be before the end
(this is asserted). All usages of the find code are updated
accordingly.
- Some bugs in the tests, which have surfaced because of
the broken end point implementation have been fixed.
Differential Revision: https://phabricator.services.mozilla.com/D237497
The original IsSpace macro uses nsCRT::IsAsciiSpace which doesn't handle
UTF-32 characters (characters above U+FFFF) correctly. Add a check for UTF-32
characters to ensure correct matching behavior. Also add a test case to
test_nsFind.html to verify the fix for Bug 1943846.
Differential Revision: https://phabricator.services.mozilla.com/D236455
The original IsSpace macro uses nsCRT::IsAsciiSpace which doesn't handle
UTF-32 characters (characters above U+FFFF) correctly. Add a check for UTF-32
characters to ensure correct matching behavior. Also add a test case to
test_nsFind.html to verify the fix for Bug 1943846.
Differential Revision: https://phabricator.services.mozilla.com/D236455
The original IsSpace macro uses nsCRT::IsAsciiSpace which doesn't handle
UTF-32 characters (characters above U+FFFF) correctly. Add a check for UTF-32
characters to ensure correct matching behavior. Also add a test case to
test_nsFind.html to verify the fix for Bug 1943846.
Differential Revision: https://phabricator.services.mozilla.com/D236455
Turns out that `nsFind::BreakInBetween()` is called a lot,
especially for large documents.
If `nsFind::Find()` is then called in a loop (e.g. for creating a text directive),
the alloc cost for the word segmenter shows up in profiles.
This can be avoided by having the segmenter be a member of `nsFind`.
Differential Revision: https://phabricator.services.mozilla.com/D227804
It's a rather useless interface:
* nsITextControlFrame is only implemented by nsTextControlFrame, so we
can just use that.
* nsIFormControlFrame had very few actual functionality, mostly
scattered around:
* SetFormProperty(select) was only useful for nsTextControlFrame.
* SetFormProperty(value) was only called on file controls.
* SetFocus() did mostly nothing, or things that can be done in
ElementStateChanged instead.
There are some do_QueryFrame calls that I replaced for better checks in
font inflation and nsIFrame, but I'll adjust to preserve behavior if you
insist (it just such a somewhat-random check).
Differential Revision: https://phabricator.services.mozilla.com/D217322
`nsFind` is updated in this patch to allow checking for word boundaries at the beginning and the end of the match pattern instead of only allowing to specify whether a whole word should be searched (ie., word boundary at start and end), or not (ie., no word boundary required at start and end).
This change does not affect the IDL interface and is only available from C++. It is tested by the scroll-to-text-fragment WPTs.
This patch also introduces some more verbose debug logging for the algorithm to find a text directive.
Differential Revision: https://phabricator.services.mozilla.com/D211029
`nsFind` is updated in this patch to allow checking for word boundaries at the beginning and the end of the match pattern instead of only allowing to specify whether a whole word should be searched (ie., word boundary at start and end), or not (ie., no word boundary required at start and end).
This change does not affect the IDL interface and is only available from C++. It is tested by the scroll-to-text-fragment WPTs.
This patch also introduces some more verbose debug logging for the algorithm to find a text directive.
Differential Revision: https://phabricator.services.mozilla.com/D211029
Make all UA widgets also NAC.
Keep the UA widget flag but break at anonymous subtree boundaries, so
that only nodes inside the UA widget directly (and not NAC from those)
get the flag.
This is important because two callers depend on this difference:
* The style system, since we still want to match content rules from
stylesheets in the UA widget. We also match user rules, which is a
bit sketchy, but that was the previous behavior, will file a
follow-up for that.
* The reflector code, since we want the scope for UA widgets to not
include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
got it wrong.
After this patch, ChromeOnlyAccess is equivalent to
IsInNativeAnonymousSubtree, so we should probably unify the naming.
That's left for a follow-up patch because I don't have a strong
preference.
Differential Revision: https://phabricator.services.mozilla.com/D174310
This change adds support for `content-visibilty: auto` as well as
showing and hiding content based on the relevancy of the content as
defined in the specification. Changes to relevancy are handled by
triggering updates in a set of `content-visibility: auto` frames stored
in PresShell at the appropriate time in the document lifecycle.
Some tests are now failing due to this feature exposing the failures,
but they will be fixed in later changes.
This change is a reland of an earlier version that properly updates
intrinsic sizes and triggers an update of remembered size for the
purposes of contain-intrinsic-size when content relevancy changes.
Co-authored-by: Jihye Hong <[email protected]>
Differential Revision: https://phabricator.services.mozilla.com/D159693
This change adds support for `content-visibilty: auto` as well as
showing and hiding content based on the relevancy of the content as
defined in the specification. Changes to relevancy are handled by
triggering updates in a set of `content-visibility: auto` frames stored
in PresShell at the appropriate time in the document lifecycle.
Some tests are now failing due to this feature exposing the failures,
but they will be fixed in later changes.
Co-authored-by: Jihye Hong <[email protected]>
Differential Revision: https://phabricator.services.mozilla.com/D159693
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.
This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.
In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.
Differential Revision: https://phabricator.services.mozilla.com/D157306
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.
This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.
In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.
Differential Revision: https://phabricator.services.mozilla.com/D157306
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.
This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.
In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.
Differential Revision: https://phabricator.services.mozilla.com/D156473