Refactoring of widget's position and size calculation.