Hi!
The change to make `toggle-frame-maximized' cover the entire screen (when the dock was hidden) was done much earlier, in 2015-10-23 (see link to commit below), after a discussion that started in bug 21415 (see link). At the time, everybody involved in the discussion thought that it was a good idea for Emacs to cover the full height of the screen, when the dock was hidden.
When the pretest was released, a user reported that the code didn't work properly when the dock was visible. Effectively, the dock would cover parts of Emacs. The commit you referred to is a fix for that problem.
When investigating how an application could check if the dock was hidden, it turned out that there is no standard API for this, but the normal way this is checked is to compare the result of [screen frame] (i.e. the size of a display) with [screen visibleFrame] (i.e. the size, excluding the parts occupied by the OS). The OS reserves four pixels at the edge where a hidden dock resides, my code use six as a break-off value in case this is changed in future OS versions.
I don't consider this a big change -- the fact that the change is 50 lines is that I prefer a style where each logical step is isolated, well documented, and there is a natural place for trace output. In this case I decided to represent the margins using a new struct, and place the margin calculation into two functions `ns_screen_margins' and `ns_screen_margins_ignoring_hidden_dock'. Of course, I could easily have written the code in a very condensed manner, inlining all calculations, but that wouldn't have been maintainable.
This is the original change:
Discussion:
-- Anders Lindgren