MCPcopy Create free account
hub / github.com/RevoSucks/BM64Recomp / TagMatchRecursive

Function TagMatchRecursive

src/ui/ui_state.cpp:36–56  ·  view source on GitHub ↗

Copied from lib\RmlUi\Source\Core\Elements\ElementLabel.cpp Get the first descending element whose tag name matches one of tags.

Source from the content-addressed store, hash-verified

34//! Copied from lib\RmlUi\Source\Core\Elements\ElementLabel.cpp
35// Get the first descending element whose tag name matches one of tags.
36static Rml::Element* TagMatchRecursive(const Rml::StringList& tags, Rml::Element* element)
37{
38 const int num_children = element->GetNumChildren();
39
40 for (int i = 0; i < num_children; i++)
41 {
42 Rml::Element* child = element->GetChild(i);
43
44 for (const Rml::String& tag : tags)
45 {
46 if (child->GetTagName() == tag)
47 return child;
48 }
49
50 Rml::Element* matching_element = TagMatchRecursive(tags, child);
51 if (matching_element)
52 return matching_element;
53 }
54
55 return nullptr;
56}
57
58Rml::Element* get_target(Rml::ElementDocument* document, Rml::Element* element) {
59 // Labels can have targets, so check if this element is a label.

Callers 1

get_targetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected