MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / resolveTreePruning

Method resolveTreePruning

native/events/Preference.cpp:353–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351 }
352
353 void Preference::resolveTreePruning(const ElementPtr &elem, const std::string &activity) {
354 if (!this->_treePrunings.empty()) {
355 for (const auto &prun: this->_treePrunings) {
356 if (prun->activity != activity)
357 continue;
358 XpathPtr xpath = prun->xpath;
359 std::vector<ElementPtr> xpathElemts;
360 if (!xpath)
361 continue;
362 if (elem->matchXpathSelector(xpath)) {
363 BLOG("pruning node %s for xpath: %s", elem->getResourceID().c_str(),
364 xpath->toString().c_str());
365 bool resetResid = 0 != InvalidProperty.compare(prun->resourceID);
366 bool resetContent = 0 != InvalidProperty.compare(prun->contentDescription);
367 bool resettext = 0 != InvalidProperty.compare(prun->text);
368 bool resetclassname = 0 != InvalidProperty.compare(prun->classname);
369
370 if (resetResid)
371 elem->reSetResourceID(prun->resourceID);
372 if (resetContent)
373 elem->reSetContentDesc(prun->contentDescription);
374 if (resettext)
375 elem->reSetText(prun->text);
376 if (resetclassname)
377 elem->reSetClassname(prun->classname);
378 }
379 }
380 }
381 }
382
383 void Preference::pruningValidTexts(const ElementPtr &element) {
384 if (!element || this->_validTexts.empty())

Callers 1

resolveElementMethod · 0.95

Calls 8

emptyMethod · 0.80
matchXpathSelectorMethod · 0.80
reSetResourceIDMethod · 0.80
reSetContentDescMethod · 0.80
reSetTextMethod · 0.80
reSetClassnameMethod · 0.80
c_strMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected