Files
sousa-gecko/layout/generic/nsDirection.h
T
Masayuki Nakano 821c05533a Bug 2045219 - Improve the debug print of nsINode r=smaug,dom-core-reviewers
Currently, `operator<<(std::ostram&, const nsINode&)` prints the path
of the node with some attribute information of each node. However, there
are some issues:

1. It's unclear if the reached root is a `DocumentFragment` or
`ShadowRoot` due to the same node name, `#document-fragment`.
2. Do not print the host's path.
3. Cannot print only in a specific node such as a `contenteditable`.
4. It's hard to consider which `Text` if a node has multiple `Text`
nodes.
5. No information about the assigned `<slot>`.
6. No information about `EditContext`.

This patch appends these information to each node. Additionally, adding
`format_as()` for avoiding to use `mozilla::ToString` for `fmt::format`
and `MOZ_LOG_FMT`.

Finally, to test the new data, this makes `Selection` and `SelectionAPI`
log use `MOZ_LOG_FMT`.

Differential Revision: https://phabricator.services.mozilla.com/D304964
2026-06-08 01:00:49 +00:00

19 lines
513 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDirection_h_
#define nsDirection_h_
#include <ostream>
// This file makes the nsDirection enum present both in nsIFrame.h and
// Selection.h.
enum nsDirection { eDirNext = 0, eDirPrevious = 1 };
std::string format_as(nsDirection);
std::ostream& operator<<(std::ostream&, nsDirection);
#endif