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

Summary:
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.

Changelog: [Internal]

Reviewed By: poteto

Differential Revision: D45238312

fbshipit-source-id: acf5033808ce81c4854ce2b962b4e7f5140e8c0d
This commit is contained in:
acdlite
2023-04-25 11:43:52 -07:00
committed by Facebook GitHub Bot
parent 56f300888c
commit 18a47d585d
@@ -1 +1 @@
967d46c76cf9f7f35cf659a6a47c9ad456c685a8
8f42196892847a3dd1ab4c84eda0c8d52508ecf6