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

Method loadFromXmlNode

src/eepp/ui/uiwidget.cpp:2262–2302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2260}
2261
2262void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) {
2263 beginAttributesTransaction();
2264
2265 for ( pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end();
2266 ++ait ) {
2267 if ( String::iequals( ait->name(), "style" ) ) {
2268 StyleSheetPropertiesParser propertiesParser;
2269 propertiesParser.parse( std::string_view{ ait->value() } );
2270 if ( !propertiesParser.getProperties().empty() ) {
2271 for ( auto& [_, property] : propertiesParser.getProperties() ) {
2272 auto propertyImportant( property );
2273 propertyImportant.setImportant( true );
2274 if ( mStyle )
2275 mStyle->setStyleSheetProperty( propertyImportant );
2276 applyProperty( propertyImportant );
2277 }
2278 }
2279 continue;
2280 }
2281
2282 // Create a property without trimming its value
2283 StyleSheetProperty prop( ait->name(), ait->value(), false,
2284 StyleSheetSelectorRule::SpecificityInline );
2285
2286 if ( prop.getShorthandDefinition() != NULL ) {
2287 auto properties = prop.getShorthandDefinition()->parse( ait->value() );
2288
2289 for ( auto& property : properties ) {
2290 if ( NULL != mStyle )
2291 mStyle->setStyleSheetProperty( property );
2292 applyProperty( property );
2293 }
2294 } else {
2295 if ( NULL != mStyle )
2296 mStyle->setStyleSheetProperty( prop );
2297 applyProperty( prop );
2298 }
2299 }
2300
2301 endAttributesTransaction();
2302}
2303
2304bool UIWidget::loadsItsChildren() const {
2305 return ( mFlags & UI_LOADS_ITS_CHILDREN ) != 0;

Callers

nothing calls this directly

Calls 6

setImportantMethod · 0.80
setStyleSheetPropertyMethod · 0.80
parseMethod · 0.45
valueMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected