Currently when we call a `Focus` we always scroll a focusable element to
the center of the container. However, this would causes a different
behavior where UAs wouldn't scroll when a focus is called to a visible
element. This PR add implementations following the behavior of Firefox
[nsFocusManager::ScrollIntoView](e613f4df35/dom/base/nsFocusManager.cpp (L3121)),
where we are scrolling to the element if it is not visible.
This would enhance the user experience of focusing an input element,
where we should avoid moving the element if it is visible.
Incidentally fix a calculation bug for the calculation of
`ScrollIntoView` with `nearest` block or inline option.
Testing: Private WPT for the implementation defined behavior and public
WPT for the bug.
---------
Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>