Change DOM HostContext to number instead of string (#26698)

In React DOM, we use HostContext to represent the namespace of whatever
is currently rendering — SVG, Math, or HTML. Because there is a fixed
set of possible values, we can switch this to be a number instead. My
motivation is that I want to start tracking additional information in
this type, and I want to pack all of it into a single number instead of
turning it into an object. For better performance.

(In dev, the host context type is already an object that includes
additional information, but that's dev so who cares.)

Technically, before this change, the host context could be any namespace
URI string, but any value other than SVG or Math was treated the same
way. Only SVG and Math have special behavior. So in the new structure,
there are three enum values: SVG, Math, or None, which represents the
HTML namespace as well as all other possible namespaces.

DiffTrain build for commit https://github.com/facebook/react/commit/8f42196892847a3dd1ab4c84eda0c8d52508ecf6.
This commit is contained in:
acdlite
2023-04-22 01:50:30 +00:00
parent 0b74c7bac8
commit 6267517df2
13 changed files with 19 additions and 19 deletions
@@ -23848,7 +23848,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-967d46c76-20230421";
var ReactVersion = "18.3.0-next-8f4219689-20230421";
// Might add PROFILE later.
@@ -8601,7 +8601,7 @@ var devToolsConfig$jscomp$inline_1021 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-967d46c76-20230421",
version: "18.3.0-next-8f4219689-20230421",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1206 = {
@@ -8632,7 +8632,7 @@ var internals$jscomp$inline_1206 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-967d46c76-20230421"
reconcilerVersion: "18.3.0-next-8f4219689-20230421"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1207 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9027,7 +9027,7 @@ var devToolsConfig$jscomp$inline_1063 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-967d46c76-20230421",
version: "18.3.0-next-8f4219689-20230421",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1247 = {
@@ -9058,7 +9058,7 @@ var internals$jscomp$inline_1247 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-967d46c76-20230421"
reconcilerVersion: "18.3.0-next-8f4219689-20230421"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1248 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-next-967d46c76-20230421";
var ReactVersion = "18.3.0-next-8f4219689-20230421";
// ATTENTION
// When adding new symbols to this file,
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-967d46c76-20230421";
exports.version = "18.3.0-next-8f4219689-20230421";
@@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-967d46c76-20230421";
exports.version = "18.3.0-next-8f4219689-20230421";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
967d46c76cf9f7f35cf659a6a47c9ad456c685a8
8f42196892847a3dd1ab4c84eda0c8d52508ecf6
@@ -27158,7 +27158,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-967d46c76-20230421";
var ReactVersion = "18.3.0-next-8f4219689-20230421";
function createPortal$1(
children,
@@ -9472,7 +9472,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1045 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-967d46c76-20230421",
version: "18.3.0-next-8f4219689-20230421",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -9514,7 +9514,7 @@ var internals$jscomp$inline_1276 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-967d46c76-20230421"
reconcilerVersion: "18.3.0-next-8f4219689-20230421"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1277 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10181,7 +10181,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1123 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-967d46c76-20230421",
version: "18.3.0-next-8f4219689-20230421",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -10236,7 +10236,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-967d46c76-20230421"
reconcilerVersion: "18.3.0-next-8f4219689-20230421"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
@@ -27671,7 +27671,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-967d46c76-20230421";
var ReactVersion = "18.3.0-next-8f4219689-20230421";
function createPortal$1(
children,
@@ -9731,7 +9731,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1100 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-967d46c76-20230421",
version: "18.3.0-next-8f4219689-20230421",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -9773,7 +9773,7 @@ var internals$jscomp$inline_1345 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-967d46c76-20230421"
reconcilerVersion: "18.3.0-next-8f4219689-20230421"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1346 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -10440,7 +10440,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1178 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-967d46c76-20230421",
version: "18.3.0-next-8f4219689-20230421",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -10495,7 +10495,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-967d46c76-20230421"
reconcilerVersion: "18.3.0-next-8f4219689-20230421"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {