MCPcopy Create free account
hub / github.com/SpartanJ/eepp / addStyleToNodeIndex

Method addStyleToNodeIndex

src/eepp/ui/css/stylesheet.cpp:168–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168bool StyleSheet::addStyleToNodeIndex( StyleSheetStyle* style ) {
169 const std::string& id = style->getSelector().getSelectorId();
170 const std::string& tag = style->getSelector().getSelectorTagName();
171 if ( style->hasProperties() || style->hasVariables() ) {
172 size_t nodeHash = this->nodeHash( "*" == tag ? "" : tag, id );
173 StyleSheetStyleVector& nodes = mNodeIndex[nodeHash];
174 auto it = std::find( nodes.begin(), nodes.end(), style );
175 if ( it == nodes.end() ) {
176 nodes.push_back( style );
177 return true;
178 } else {
179 Log::debug( "Ignored style %s", style->getSelector().getName().c_str() );
180 }
181 }
182 return false;
183}
184
185void StyleSheet::addStyle( std::shared_ptr<StyleSheetStyle> node ) {
186 if ( addStyleToNodeIndex( node.get() ) ) {

Callers

nothing calls this directly

Calls 10

nodeHashMethod · 0.95
findFunction · 0.85
debugFunction · 0.85
hasPropertiesMethod · 0.80
hasVariablesMethod · 0.80
push_backMethod · 0.80
c_strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected