Issue #24224:normalize margin calculations