This is kind of a weird series of patch, removing LayoutFactory and then readding it. I guess it allow for less code to write. Anyway, seeing the code like this now, it looks like we can do slightly better.
Maybe only set the callback if klass or group or style is set?
sorry for late update,
we are so busy as the issues season comes again...
if you think it is weird I can make them in one combined patch or create new patch that only making generic_factory on top of layout factory..
we already checked
if (pd->klass || pd->group || pd->style)